comparison gcc/except.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Exception Handling interface routines. 1 /* Exception Handling interface routines.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2 Copyright (C) 1996-2017 Free Software Foundation, Inc.
3 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Mike Stump <mrs@cygnus.com>. 3 Contributed by Mike Stump <mrs@cygnus.com>.
5 4
6 This file is part of GCC. 5 This file is part of GCC.
7 6
8 GCC is free software; you can redistribute it and/or modify it under 7 GCC is free software; you can redistribute it and/or modify it under
21 20
22 /* No include guards here, but define an include file marker anyway, so 21 /* No include guards here, but define an include file marker anyway, so
23 that the compiler can keep track of where this file is included. This 22 that the compiler can keep track of where this file is included. This
24 is e.g. used to avoid including this file in front-end specific files. */ 23 is e.g. used to avoid including this file in front-end specific files. */
25 #ifndef GCC_EXCEPT_H 24 #ifndef GCC_EXCEPT_H
26 # define GCC_EXCEPT_H 25 #define GCC_EXCEPT_H
27 #endif 26
28
29 #include "hashtab.h"
30 #include "vecprim.h"
31 #include "vecir.h"
32 27
33 struct function; 28 struct function;
34 struct eh_region_d; 29 struct eh_region_d;
35 struct pointer_map_t;
36 30
37 /* The type of an exception region. */ 31 /* The type of an exception region. */
38 enum eh_region_type 32 enum eh_region_type
39 { 33 {
40 /* CLEANUP regions implement e.g. destructors run when exiting a block. 34 /* CLEANUP regions implement e.g. destructors run when exiting a block.
44 exception. */ 38 exception. */
45 ERT_CLEANUP, 39 ERT_CLEANUP,
46 40
47 /* TRY regions implement catching an exception. The list of types associated 41 /* TRY regions implement catching an exception. The list of types associated
48 with the attached catch handlers is examined in order by the runtime and 42 with the attached catch handlers is examined in order by the runtime and
49 control is transfered to the appropriate handler. Note that a NULL type 43 control is transferred to the appropriate handler. Note that a NULL type
50 list is a catch-all handler, and that it will catch *all* exceptions 44 list is a catch-all handler, and that it will catch *all* exceptions
51 including those originating from a different language. */ 45 including those originating from a different language. */
52 ERT_TRY, 46 ERT_TRY,
53 47
54 /* ALLOWED_EXCEPTIONS regions implement exception filtering, e.g. the 48 /* ALLOWED_EXCEPTIONS regions implement exception filtering, e.g. the
78 struct eh_landing_pad_d *next_lp; 72 struct eh_landing_pad_d *next_lp;
79 73
80 /* The region with which this landing pad is associated. */ 74 /* The region with which this landing pad is associated. */
81 struct eh_region_d *region; 75 struct eh_region_d *region;
82 76
83 /* At the gimple level, the location to which control will be transfered 77 /* At the gimple level, the location to which control will be transferred
84 for this landing pad. There can be both EH and normal edges into the 78 for this landing pad. There can be both EH and normal edges into the
85 block containing the post-landing-pad label. */ 79 block containing the post-landing-pad label. */
86 tree post_landing_pad; 80 tree post_landing_pad;
87 81
88 /* At the rtl level, the location to which the runtime will transfer 82 /* At the rtl level, the location to which the runtime will transfer
89 control. This differs from the post-landing-pad in that the target's 83 control. This differs from the post-landing-pad in that the target's
90 EXCEPTION_RECEIVER pattern will be expanded here, as well as other 84 EXCEPTION_RECEIVER pattern will be expanded here, as well as other
91 bookkeeping specific to exceptions. There must not be normal edges 85 bookkeeping specific to exceptions. There must not be normal edges
92 into the block containing the landing-pad label. */ 86 into the block containing the landing-pad label. */
93 rtx landing_pad; 87 rtx_code_label *landing_pad;
94 88
95 /* The index of this landing pad within fun->eh->lp_array. */ 89 /* The index of this landing pad within fun->eh->lp_array. */
96 int index; 90 int index;
97 }; 91 };
98 92
187 181
188 typedef struct eh_landing_pad_d *eh_landing_pad; 182 typedef struct eh_landing_pad_d *eh_landing_pad;
189 typedef struct eh_catch_d *eh_catch; 183 typedef struct eh_catch_d *eh_catch;
190 typedef struct eh_region_d *eh_region; 184 typedef struct eh_region_d *eh_region;
191 185
192 DEF_VEC_P(eh_region); 186
193 DEF_VEC_ALLOC_P(eh_region, gc);
194 DEF_VEC_ALLOC_P(eh_region, heap);
195
196 DEF_VEC_P(eh_landing_pad);
197 DEF_VEC_ALLOC_P(eh_landing_pad, gc);
198 187
199 188
200 /* The exception status for each function. */ 189 /* The exception status for each function. */
201 190
202 struct GTY(()) eh_status 191 struct GTY(()) eh_status
203 { 192 {
204 /* The tree of all regions for this function. */ 193 /* The tree of all regions for this function. */
205 eh_region region_tree; 194 eh_region region_tree;
206 195
207 /* The same information as an indexable array. */ 196 /* The same information as an indexable array. */
208 VEC(eh_region,gc) *region_array; 197 vec<eh_region, va_gc> *region_array;
209 198
210 /* The landing pads as an indexable array. */ 199 /* The landing pads as an indexable array. */
211 VEC(eh_landing_pad,gc) *lp_array; 200 vec<eh_landing_pad, va_gc> *lp_array;
212 201
213 /* At the gimple level, a mapping from gimple statement to landing pad 202 /* At the gimple level, a mapping from gimple statement to landing pad
214 or must-not-throw region. See record_stmt_eh_region. */ 203 or must-not-throw region. See record_stmt_eh_region. */
215 htab_t GTY((param_is (struct throw_stmt_node))) throw_stmt_table; 204 hash_map<gimple *, int> *GTY(()) throw_stmt_table;
216 205
217 /* All of the runtime type data used by the function. These objects 206 /* All of the runtime type data used by the function. These objects
218 are emitted to the lang-specific-data-area for the function. */ 207 are emitted to the lang-specific-data-area for the function. */
219 VEC(tree,gc) *ttype_data; 208 vec<tree, va_gc> *ttype_data;
220 209
221 /* The table of all action chains. These encode the eh_region tree in 210 /* The table of all action chains. These encode the eh_region tree in
222 a compact form for use by the runtime, and is also emitted to the 211 a compact form for use by the runtime, and is also emitted to the
223 lang-specific-data-area. Note that the ARM EABI uses a different 212 lang-specific-data-area. Note that the ARM EABI uses a different
224 format for the encoding than all other ports. */ 213 format for the encoding than all other ports. */
225 union eh_status_u { 214 union eh_status_u {
226 VEC(tree,gc) * GTY((tag ("1"))) arm_eabi; 215 vec<tree, va_gc> *GTY((tag ("1"))) arm_eabi;
227 VEC(uchar,gc) * GTY((tag ("0"))) other; 216 vec<uchar, va_gc> *GTY((tag ("0"))) other;
228 } GTY ((desc ("targetm.arm_eabi_unwinder"))) ehspec_data; 217 } GTY ((desc ("targetm.arm_eabi_unwinder"))) ehspec_data;
229 }; 218 };
230 219
231 220
232 /* Invokes CALLBACK for every exception handler label. Only used by old 221 /* Invokes CALLBACK for every exception handler label. Only used by old
235 224
236 extern void init_eh_for_function (void); 225 extern void init_eh_for_function (void);
237 226
238 extern void remove_eh_landing_pad (eh_landing_pad); 227 extern void remove_eh_landing_pad (eh_landing_pad);
239 extern void remove_eh_handler (eh_region); 228 extern void remove_eh_handler (eh_region);
229 extern void remove_unreachable_eh_regions (sbitmap);
240 230
241 extern bool current_function_has_exception_handlers (void); 231 extern bool current_function_has_exception_handlers (void);
242 extern void output_function_exception_table (const char *); 232 extern void output_function_exception_table (const char *);
243 233
244 extern rtx expand_builtin_eh_pointer (tree); 234 extern rtx expand_builtin_eh_pointer (tree);
251 extern rtx expand_builtin_frob_return_addr (tree); 241 extern rtx expand_builtin_frob_return_addr (tree);
252 extern rtx expand_builtin_dwarf_sp_column (void); 242 extern rtx expand_builtin_dwarf_sp_column (void);
253 extern void expand_builtin_eh_return (tree, tree); 243 extern void expand_builtin_eh_return (tree, tree);
254 extern void expand_eh_return (void); 244 extern void expand_eh_return (void);
255 extern rtx expand_builtin_extend_pointer (tree); 245 extern rtx expand_builtin_extend_pointer (tree);
246 extern void expand_dw2_landing_pad_for_region (eh_region);
256 247
257 typedef tree (*duplicate_eh_regions_map) (tree, void *); 248 typedef tree (*duplicate_eh_regions_map) (tree, void *);
258 extern struct pointer_map_t *duplicate_eh_regions 249 extern hash_map<void *, void *> *duplicate_eh_regions
259 (struct function *, eh_region, int, duplicate_eh_regions_map, void *); 250 (struct function *, eh_region, int, duplicate_eh_regions_map, void *);
260 251
261 extern void sjlj_emit_function_exit_after (rtx); 252 extern void sjlj_emit_function_exit_after (rtx_insn *);
253 extern void update_sjlj_context (void);
262 254
263 extern eh_region gen_eh_region_cleanup (eh_region); 255 extern eh_region gen_eh_region_cleanup (eh_region);
264 extern eh_region gen_eh_region_try (eh_region); 256 extern eh_region gen_eh_region_try (eh_region);
265 extern eh_region gen_eh_region_allowed (eh_region, tree); 257 extern eh_region gen_eh_region_allowed (eh_region, tree);
266 extern eh_region gen_eh_region_must_not_throw (eh_region); 258 extern eh_region gen_eh_region_must_not_throw (eh_region);
275 extern eh_region get_eh_region_from_lp_number_fn (struct function *, int); 267 extern eh_region get_eh_region_from_lp_number_fn (struct function *, int);
276 extern eh_region get_eh_region_from_lp_number (int); 268 extern eh_region get_eh_region_from_lp_number (int);
277 269
278 extern eh_region eh_region_outermost (struct function *, eh_region, eh_region); 270 extern eh_region eh_region_outermost (struct function *, eh_region, eh_region);
279 271
280 extern void make_reg_eh_region_note (rtx insn, int ecf_flags, int lp_nr); 272 extern void make_reg_eh_region_note (rtx_insn *insn, int ecf_flags, int lp_nr);
281 extern void make_reg_eh_region_note_nothrow_nononlocal (rtx); 273 extern void make_reg_eh_region_note_nothrow_nononlocal (rtx_insn *);
282 274
283 extern void verify_eh_tree (struct function *); 275 extern void verify_eh_tree (struct function *);
284 extern void dump_eh_tree (FILE *, struct function *); 276 extern void dump_eh_tree (FILE *, struct function *);
285 void debug_eh_tree (struct function *); 277 void debug_eh_tree (struct function *);
286 extern void add_type_for_runtime (tree); 278 extern void add_type_for_runtime (tree);
288 extern void assign_filter_values (void); 280 extern void assign_filter_values (void);
289 281
290 extern eh_region get_eh_region_from_rtx (const_rtx); 282 extern eh_region get_eh_region_from_rtx (const_rtx);
291 extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx); 283 extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx);
292 284
285 extern void finish_eh_generation (void);
286
293 struct GTY(()) throw_stmt_node { 287 struct GTY(()) throw_stmt_node {
294 gimple stmt; 288 gimple *stmt;
295 int lp_nr; 289 int lp_nr;
296 }; 290 };
297 291
298 extern struct htab *get_eh_throw_stmt_table (struct function *); 292 extern hash_map<gimple *, int> *get_eh_throw_stmt_table (struct function *);
299 extern void set_eh_throw_stmt_table (struct function *, struct htab *); 293 extern void set_eh_throw_stmt_table (function *, hash_map<gimple *, int> *);
300 294
301 enum eh_personality_kind { 295 enum eh_personality_kind {
302 eh_personality_none, 296 eh_personality_none,
303 eh_personality_any, 297 eh_personality_any,
304 eh_personality_lang 298 eh_personality_lang
335 329
336 #define FOR_ALL_EH_REGION_FN(R, FN) \ 330 #define FOR_ALL_EH_REGION_FN(R, FN) \
337 for ((R) = (FN)->eh->region_tree; (R) != NULL; (R) = ehr_next (R, NULL)) 331 for ((R) = (FN)->eh->region_tree; (R) != NULL; (R) = ehr_next (R, NULL))
338 332
339 #define FOR_ALL_EH_REGION(R) FOR_ALL_EH_REGION_FN (R, cfun) 333 #define FOR_ALL_EH_REGION(R) FOR_ALL_EH_REGION_FN (R, cfun)
334
335 #endif