]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/dwarf2out.h
Update copyright years.
[thirdparty/gcc.git] / gcc / dwarf2out.h
CommitLineData
76ead72b 1/* dwarf2out.h - Various declarations for functions found in dwarf2out.c
5624e564 2 Copyright (C) 1998-2015 Free Software Foundation, Inc.
76ead72b 3
1322177d 4This file is part of GCC.
76ead72b 5
1322177d
LB
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1322177d 9version.
76ead72b 10
1322177d
LB
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
76ead72b
RL
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
76ead72b 19
647a1567
RH
20#ifndef GCC_DWARF2OUT_H
21#define GCC_DWARF2OUT_H 1
22
23#include "dwarf2.h" /* ??? Remove this once only used by dwarf2foo.c. */
807e902e 24#include "wide-int.h"
647a1567
RH
25
26typedef struct die_struct *dw_die_ref;
27typedef const struct die_struct *const_dw_die_ref;
28
84562394
OE
29typedef struct dw_val_node *dw_val_ref;
30typedef struct dw_cfi_node *dw_cfi_ref;
31typedef struct dw_loc_descr_node *dw_loc_descr_ref;
647a1567 32typedef struct dw_loc_list_struct *dw_loc_list_ref;
807e902e 33typedef wide_int *wide_int_ptr;
647a1567
RH
34
35
36/* Call frames are described using a sequence of Call Frame
37 Information instructions. The register number, offset
38 and address fields are provided as possible operands;
39 their use is selected by the opcode field. */
40
41enum dw_cfi_oprnd_type {
42 dw_cfi_oprnd_unused,
43 dw_cfi_oprnd_reg_num,
44 dw_cfi_oprnd_offset,
45 dw_cfi_oprnd_addr,
46 dw_cfi_oprnd_loc
47};
48
84562394 49typedef union GTY(()) {
647a1567
RH
50 unsigned int GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num;
51 HOST_WIDE_INT GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset;
52 const char * GTY ((tag ("dw_cfi_oprnd_addr"))) dw_cfi_addr;
84562394
OE
53 struct dw_loc_descr_node * GTY ((tag ("dw_cfi_oprnd_loc"))) dw_cfi_loc;
54} dw_cfi_oprnd;
647a1567 55
84562394 56struct GTY(()) dw_cfi_node {
647a1567
RH
57 enum dwarf_call_frame_info dw_cfi_opc;
58 dw_cfi_oprnd GTY ((desc ("dw_cfi_oprnd1_desc (%1.dw_cfi_opc)")))
59 dw_cfi_oprnd1;
60 dw_cfi_oprnd GTY ((desc ("dw_cfi_oprnd2_desc (%1.dw_cfi_opc)")))
61 dw_cfi_oprnd2;
84562394 62};
647a1567 63
647a1567 64
9771b263 65typedef vec<dw_cfi_ref, va_gc> *cfi_vec;
647a1567 66
84562394 67typedef struct dw_fde_node *dw_fde_ref;
647a1567
RH
68
69/* All call frame descriptions (FDE's) in the GCC generated DWARF
70 refer to a single Common Information Entry (CIE), defined at
71 the beginning of the .debug_frame section. This use of a single
72 CIE obviates the need to keep track of multiple CIE's
73 in the DWARF generation routines below. */
74
84562394 75struct GTY(()) dw_fde_node {
647a1567
RH
76 tree decl;
77 const char *dw_fde_begin;
78 const char *dw_fde_current_label;
79 const char *dw_fde_end;
80 const char *dw_fde_vms_end_prologue;
81 const char *dw_fde_vms_begin_epilogue;
82 const char *dw_fde_second_begin;
83 const char *dw_fde_second_end;
84 cfi_vec dw_fde_cfi;
85 int dw_fde_switch_cfi_index; /* Last CFI before switching sections. */
86 HOST_WIDE_INT stack_realignment;
a518b996 87
647a1567 88 unsigned funcdef_number;
a518b996
RH
89 unsigned fde_index;
90
647a1567
RH
91 /* Dynamic realign argument pointer register. */
92 unsigned int drap_reg;
93 /* Virtual dynamic realign argument pointer register. */
94 unsigned int vdrap_reg;
95 /* These 3 flags are copied from rtl_data in function.h. */
96 unsigned all_throwers_are_sibcalls : 1;
97 unsigned uses_eh_lsda : 1;
98 unsigned nothrow : 1;
99 /* Whether we did stack realign in this call frame. */
100 unsigned stack_realign : 1;
101 /* Whether dynamic realign argument pointer register has been saved. */
102 unsigned drap_reg_saved: 1;
103 /* True iff dw_fde_begin label is in text_section or cold_text_section. */
104 unsigned in_std_section : 1;
105 /* True iff dw_fde_second_begin label is in text_section or
106 cold_text_section. */
107 unsigned second_in_std_section : 1;
84562394 108};
647a1567
RH
109
110
111/* This is how we define the location of the CFA. We use to handle it
112 as REG + OFFSET all the time, but now it can be more complex.
113 It can now be either REG + CFA_OFFSET or *(REG + BASE_OFFSET) + CFA_OFFSET.
114 Instead of passing around REG and OFFSET, we pass a copy
115 of this structure. */
84562394 116struct GTY(()) dw_cfa_location {
647a1567
RH
117 HOST_WIDE_INT offset;
118 HOST_WIDE_INT base_offset;
7263c6d7 119 /* REG is in DWARF_FRAME_REGNUM space, *not* normal REGNO space. */
647a1567
RH
120 unsigned int reg;
121 BOOL_BITFIELD indirect : 1; /* 1 if CFA is accessed via a dereference. */
122 BOOL_BITFIELD in_use : 1; /* 1 if a saved cfa is stored here. */
84562394 123};
647a1567
RH
124
125
126/* Each DIE may have a series of attribute/value pairs. Values
127 can take on several forms. The forms that are used in this
128 implementation are listed below. */
129
130enum dw_val_class
131{
57e16c96 132 dw_val_class_none,
647a1567
RH
133 dw_val_class_addr,
134 dw_val_class_offset,
135 dw_val_class_loc,
136 dw_val_class_loc_list,
137 dw_val_class_range_list,
138 dw_val_class_const,
139 dw_val_class_unsigned_const,
140 dw_val_class_const_double,
807e902e 141 dw_val_class_wide_int,
647a1567
RH
142 dw_val_class_vec,
143 dw_val_class_flag,
144 dw_val_class_die_ref,
145 dw_val_class_fde_ref,
146 dw_val_class_lbl_id,
147 dw_val_class_lineptr,
148 dw_val_class_str,
149 dw_val_class_macptr,
150 dw_val_class_file,
151 dw_val_class_data8,
152 dw_val_class_decl_ref,
413de8e5
MW
153 dw_val_class_vms_delta,
154 dw_val_class_high_pc
647a1567
RH
155};
156
157/* Describe a floating point constant value, or a vector constant value. */
158
84562394 159struct GTY(()) dw_vec_const {
c0fd3497 160 unsigned char * GTY((atomic)) array;
647a1567
RH
161 unsigned length;
162 unsigned elt_size;
84562394 163};
647a1567 164
99ea153e
SA
165struct addr_table_entry_struct;
166
647a1567
RH
167/* The dw_val_node describes an attribute's value, as it is
168 represented internally. */
169
84562394 170struct GTY(()) dw_val_node {
647a1567 171 enum dw_val_class val_class;
99ea153e 172 struct addr_table_entry_struct * GTY(()) val_entry;
647a1567
RH
173 union dw_val_struct_union
174 {
175 rtx GTY ((tag ("dw_val_class_addr"))) val_addr;
176 unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_offset"))) val_offset;
177 dw_loc_list_ref GTY ((tag ("dw_val_class_loc_list"))) val_loc_list;
178 dw_loc_descr_ref GTY ((tag ("dw_val_class_loc"))) val_loc;
179 HOST_WIDE_INT GTY ((default)) val_int;
180 unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_unsigned_const"))) val_unsigned;
181 double_int GTY ((tag ("dw_val_class_const_double"))) val_double;
807e902e 182 wide_int_ptr GTY ((tag ("dw_val_class_wide_int"))) val_wide;
647a1567
RH
183 dw_vec_const GTY ((tag ("dw_val_class_vec"))) val_vec;
184 struct dw_val_die_union
185 {
186 dw_die_ref die;
187 int external;
188 } GTY ((tag ("dw_val_class_die_ref"))) val_die_ref;
189 unsigned GTY ((tag ("dw_val_class_fde_ref"))) val_fde_index;
190 struct indirect_string_node * GTY ((tag ("dw_val_class_str"))) val_str;
191 char * GTY ((tag ("dw_val_class_lbl_id"))) val_lbl_id;
192 unsigned char GTY ((tag ("dw_val_class_flag"))) val_flag;
193 struct dwarf_file_data * GTY ((tag ("dw_val_class_file"))) val_file;
194 unsigned char GTY ((tag ("dw_val_class_data8"))) val_data8[8];
195 tree GTY ((tag ("dw_val_class_decl_ref"))) val_decl_ref;
196 struct dw_val_vms_delta_union
197 {
198 char * lbl1;
199 char * lbl2;
200 } GTY ((tag ("dw_val_class_vms_delta"))) val_vms_delta;
201 }
202 GTY ((desc ("%1.val_class"))) v;
84562394 203};
647a1567
RH
204
205/* Locations in memory are described using a sequence of stack machine
206 operations. */
207
84562394 208struct GTY(()) dw_loc_descr_node {
647a1567
RH
209 dw_loc_descr_ref dw_loc_next;
210 ENUM_BITFIELD (dwarf_location_atom) dw_loc_opc : 8;
211 /* Used to distinguish DW_OP_addr with a direct symbol relocation
212 from DW_OP_addr with a dtp-relative symbol relocation. */
213 unsigned int dtprel : 1;
214 int dw_loc_addr;
215 dw_val_node dw_loc_oprnd1;
216 dw_val_node dw_loc_oprnd2;
84562394 217};
647a1567
RH
218
219
220/* Interface from dwarf2out.c to dwarf2cfi.c. */
84562394 221extern struct dw_loc_descr_node *build_cfa_loc
647a1567 222 (dw_cfa_location *, HOST_WIDE_INT);
84562394 223extern struct dw_loc_descr_node *build_cfa_aligned_loc
647a1567 224 (dw_cfa_location *, HOST_WIDE_INT offset, HOST_WIDE_INT alignment);
84562394 225extern struct dw_loc_descr_node *mem_loc_descriptor
ef4bddc2 226 (rtx, machine_mode mode, machine_mode mem_mode,
647a1567 227 enum var_init_status);
57e16c96 228extern bool loc_descr_equal_p (dw_loc_descr_ref, dw_loc_descr_ref);
a518b996 229extern dw_fde_ref dwarf2out_alloc_current_fde (void);
647a1567 230
948d330e
RH
231extern unsigned long size_of_locs (dw_loc_descr_ref);
232extern void output_loc_sequence (dw_loc_descr_ref, int);
233extern void output_loc_sequence_raw (dw_loc_descr_ref);
234
647a1567 235/* Interface from dwarf2cfi.c to dwarf2out.c. */
647a1567
RH
236extern void lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc,
237 dw_cfa_location *remember);
238extern bool cfa_equal_p (const dw_cfa_location *, const dw_cfa_location *);
239
948d330e 240extern void output_cfi (dw_cfi_ref, dw_fde_ref, int);
948d330e 241
647a1567
RH
242extern GTY(()) cfi_vec cie_cfi_vec;
243
244/* Interface from dwarf2*.c to the rest of the compiler. */
245extern enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc
246 (enum dwarf_call_frame_info cfi);
247extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc
248 (enum dwarf_call_frame_info cfi);
249
84562394 250extern void output_cfi_directive (FILE *f, struct dw_cfi_node *cfi);
2867fa7c 251
bc5612ed 252extern void dwarf2out_emit_cfi (dw_cfi_ref cfi);
83d2b3b9 253
7080f735 254extern void debug_dwarf (void);
79a2acc8 255struct die_struct;
7080f735 256extern void debug_dwarf_die (struct die_struct *);
f08649c0 257extern void debug_dwarf_loc_descr (dw_loc_descr_ref);
7b3b6ae4
LC
258extern void debug (die_struct &ref);
259extern void debug (die_struct *ptr);
7080f735 260extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
8e7745dc
DR
261#ifdef VMS_DEBUGGING_INFO
262extern void dwarf2out_vms_debug_main_pointer (void);
263#endif
fad0afd7 264
616743a8
PMR
265enum array_descr_ordering
266{
267 array_descr_ordering_default,
268 array_descr_ordering_row_major,
269 array_descr_ordering_column_major
270};
271
fad0afd7
JJ
272struct array_descr_info
273{
274 int ndimensions;
616743a8 275 enum array_descr_ordering ordering;
fad0afd7
JJ
276 tree element_type;
277 tree base_decl;
278 tree data_location;
279 tree allocated;
280 tree associated;
281 struct array_descr_dimen
282 {
616743a8
PMR
283 /* GCC uses sizetype for array indices, so lower_bound and upper_bound
284 will likely be "sizetype" values. However, bounds may have another
285 type in the original source code. */
286 tree bounds_type;
fad0afd7
JJ
287 tree lower_bound;
288 tree upper_bound;
289 tree stride;
290 } dimen[10];
291};
647a1567 292
3edf64aa
DM
293void dwarf2out_c_finalize (void);
294
647a1567 295#endif /* GCC_DWARF2OUT_H */