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