dwarf2out.h 9.6 KB

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