GCC Middle and Back End API Reference
except.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  eh_landing_pad_d
 
struct  eh_catch_d
 
struct  eh_region_d
 
union  eh_region_d::eh_region_u
 
struct  eh_region_d::eh_region_u::eh_region_u_try
 
struct  eh_region_d::eh_region_u::eh_region_u_allowed
 
struct  eh_region_d::eh_region_u::eh_region_u_must_not_throw
 
struct  eh_status
 
union  eh_status::eh_status_u
 
struct  throw_stmt_node
 

Macros

#define FOR_ALL_EH_REGION_AT(R, START)    for ((R) = (START); (R) != NULL; (R) = ehr_next (R, START))
 
#define FOR_ALL_EH_REGION_FN(R, FN)    for ((R) = (FN)->eh->region_tree; (R) != NULL; (R) = ehr_next (R, NULL))
 
#define FOR_ALL_EH_REGION(R)   FOR_ALL_EH_REGION_FN (R, cfun)
 

Typedefs

typedef struct eh_landing_pad_deh_landing_pad
 
typedef struct eh_catch_deh_catch
 
typedef struct eh_region_deh_region
 
typedef tree(* duplicate_eh_regions_map) (tree, void *)
 

Enumerations

enum  eh_region_type { ERT_CLEANUP , ERT_TRY , ERT_ALLOWED_EXCEPTIONS , ERT_MUST_NOT_THROW }
 
enum  eh_personality_kind { eh_personality_none , eh_personality_any , eh_personality_lang }
 

Functions

void for_each_eh_label (void(*)(rtx))
 
void init_eh_for_function (void)
 
void remove_eh_landing_pad (eh_landing_pad)
 
void remove_eh_handler (eh_region)
 
void remove_unreachable_eh_regions (sbitmap)
 
bool current_function_has_exception_handlers (void)
 
void output_function_exception_table (int)
 
rtx expand_builtin_eh_pointer (tree)
 
rtx expand_builtin_eh_filter (tree)
 
rtx expand_builtin_eh_copy_values (tree)
 
void expand_builtin_unwind_init (void)
 
rtx expand_builtin_eh_return_data_regno (tree)
 
rtx expand_builtin_extract_return_addr (tree)
 
void expand_builtin_init_dwarf_reg_sizes (tree)
 
rtx expand_builtin_frob_return_addr (tree)
 
rtx expand_builtin_dwarf_sp_column (void)
 
void expand_builtin_eh_return (tree, tree)
 
void expand_eh_return (void)
 
rtx expand_builtin_extend_pointer (tree)
 
hash_map< void *, void * > * duplicate_eh_regions (struct function *, eh_region, int, duplicate_eh_regions_map, void *)
 
void sjlj_emit_function_exit_after (rtx_insn *)
 
void update_sjlj_context (void)
 
eh_region gen_eh_region_cleanup (eh_region)
 
eh_region gen_eh_region_try (eh_region)
 
eh_region gen_eh_region_allowed (eh_region, tree)
 
eh_region gen_eh_region_must_not_throw (eh_region)
 
eh_catch gen_eh_region_catch (eh_region, tree)
 
eh_landing_pad gen_eh_landing_pad (eh_region)
 
eh_region get_eh_region_from_number_fn (struct function *, int)
 
eh_region get_eh_region_from_number (int)
 
eh_landing_pad get_eh_landing_pad_from_number_fn (struct function *, int)
 
eh_landing_pad get_eh_landing_pad_from_number (int)
 
eh_region get_eh_region_from_lp_number_fn (struct function *, int)
 
eh_region get_eh_region_from_lp_number (int)
 
eh_region eh_region_outermost (struct function *, eh_region, eh_region)
 
void make_reg_eh_region_note (rtx_insn *insn, int ecf_flags, int lp_nr)
 
void make_reg_eh_region_note_nothrow_nononlocal (rtx_insn *)
 
void verify_eh_tree (struct function *)
 
void dump_eh_tree (FILE *, struct function *)
 
void debug_eh_tree (struct function *)
 
void add_type_for_runtime (tree)
 
tree lookup_type_for_runtime (tree)
 
void assign_filter_values (void)
 
eh_region get_eh_region_from_rtx (const_rtx)
 
eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx)
 
void finish_eh_generation (void)
 
hash_map< gimple *, int > * get_eh_throw_stmt_table (struct function *)
 
void set_eh_throw_stmt_table (function *, hash_map< gimple *, int > *)
 
enum eh_personality_kind function_needs_eh_personality (struct function *)
 
eh_region ehr_next (eh_region r, eh_region start)
 

Macro Definition Documentation

◆ FOR_ALL_EH_REGION

#define FOR_ALL_EH_REGION ( R)    FOR_ALL_EH_REGION_FN (R, cfun)

Referenced by cleanup_dead_labels_eh().

◆ FOR_ALL_EH_REGION_AT

#define FOR_ALL_EH_REGION_AT ( R,
START )    for ((R) = (START); (R) != NULL; (R) = ehr_next (R, START))

◆ FOR_ALL_EH_REGION_FN

#define FOR_ALL_EH_REGION_FN ( R,
FN )    for ((R) = (FN)->eh->region_tree; (R) != NULL; (R) = ehr_next (R, NULL))

Typedef Documentation

◆ duplicate_eh_regions_map

typedef tree(* duplicate_eh_regions_map) (tree, void *)

◆ eh_catch

◆ eh_landing_pad

◆ eh_region

Enumeration Type Documentation

◆ eh_personality_kind

Enumerator
eh_personality_none 
eh_personality_any 
eh_personality_lang 

◆ eh_region_type

The type of an exception region.   
Enumerator
ERT_CLEANUP 
ERT_TRY 
ERT_ALLOWED_EXCEPTIONS 
ERT_MUST_NOT_THROW 

Function Documentation

◆ add_type_for_runtime()

◆ assign_filter_values()

void assign_filter_values ( void )
extern
Generate the action filter values to be used for CATCH and
ALLOWED_EXCEPTIONS regions.  When using dwarf2 exception regions,
we use lots of landing pads, and so every type or list can share
the same filter value, which saves table space.   

References add_ehspec_entry(), add_ttypes_entry(), build_int_cst(), cfun, ERT_ALLOWED_EXCEPTIONS, ERT_TRY, eh_catch_d::filter_list, ggc_alloc(), i, integer_type_node, eh_catch_d::next_catch, NULL, NULL_TREE, r, targetm, TREE_CHAIN, tree_cons(), TREE_VALUE, eh_catch_d::type_list, vec_alloc(), and vec_safe_iterate().

◆ current_function_has_exception_handlers()

bool current_function_has_exception_handlers ( void )
extern
Returns true if the current function has exception handling regions.   

References cfun, and NULL.

Referenced by suitable_for_tail_call_opt_p().

◆ debug_eh_tree()

void debug_eh_tree ( struct function * fn)
Dump the EH tree for FN on stderr.   

References dump_eh_tree(), and ggc_alloc().

◆ dump_eh_tree()

◆ duplicate_eh_regions()

hash_map< void *, void * > * duplicate_eh_regions ( struct function * ifun,
eh_region copy_region,
int outer_lp,
duplicate_eh_regions_map map,
void * map_data )
extern
Duplicate the EH regions from IFUN rooted at COPY_REGION into
the current function and root the tree below OUTER_REGION.
The special case of COPY_REGION of NULL means all regions.
Remap labels using MAP/MAP_DATA callback.  Return a pointer map
that allows the caller to remap uses of both EH regions and
EH landing pads.   

References cfun, duplicate_eh_regions_1(), get_eh_region_from_lp_number_fn(), ggc_alloc(), map, r, and verify_eh_tree().

Referenced by copy_cfg_body(), and move_sese_region_to_fn().

◆ eh_region_outermost()

eh_region eh_region_outermost ( struct function * ifun,
eh_region region_a,
eh_region region_b )
extern
Return the region that is outer to both REGION_A and REGION_B in IFUN.   

References bitmap_bit_p, bitmap_clear(), bitmap_set_bit, gcc_assert, and ggc_alloc().

Referenced by find_outermost_region_in_block().

◆ ehr_next()

eh_region ehr_next ( eh_region r,
eh_region start )
inline
Pre-order iteration within the eh_region tree.   

References eh_region_d::inner, eh_region_d::next_peer, NULL, eh_region_d::outer, and r.

◆ expand_builtin_dwarf_sp_column()

rtx expand_builtin_dwarf_sp_column ( void )
extern
Hook used by __throw.   

References DWARF2_FRAME_REG_OUT, DWARF_FRAME_REGNUM, GEN_INT, and ggc_alloc().

Referenced by expand_builtin().

◆ expand_builtin_eh_copy_values()

rtx expand_builtin_eh_copy_values ( tree exp)
extern
Copy the exc_ptr and filter values from one landing pad's registers
to another.  This is used to inline the resx statement.   

References CALL_EXPR_ARG, const0_rtx, emit_move_insn(), eh_region_d::exc_ptr_reg, exp(), expand_builtin_eh_common(), eh_region_d::filter_reg, gen_reg_rtx(), ggc_alloc(), NULL, ptr_mode, and targetm.

Referenced by expand_builtin().

◆ expand_builtin_eh_filter()

rtx expand_builtin_eh_filter ( tree exp)
extern
Expand to the filter value from the given eh region.   

References CALL_EXPR_ARG, exp(), expand_builtin_eh_common(), eh_region_d::filter_reg, gen_reg_rtx(), NULL, and targetm.

Referenced by expand_builtin().

◆ expand_builtin_eh_pointer()

rtx expand_builtin_eh_pointer ( tree exp)
extern
Expand to the exc_ptr value from the given eh region.   

References CALL_EXPR_ARG, eh_region_d::exc_ptr_reg, exp(), expand_builtin_eh_common(), gen_reg_rtx(), NULL, and ptr_mode.

Referenced by expand_builtin().

◆ expand_builtin_eh_return()

void expand_builtin_eh_return ( tree stackadj_tree,
tree handler_tree )
extern
Set up the epilogue with the magic bits we'll need to return to the
exception handler.   

References convert_memory_address, copy_addr_to_reg(), crtl, emit_jump(), emit_move_insn(), expand_expr(), EXPAND_NORMAL, gen_label_rtx(), and ggc_alloc().

Referenced by expand_builtin().

◆ expand_builtin_eh_return_data_regno()

rtx expand_builtin_eh_return_data_regno ( tree exp)
extern
Map a non-negative number to an eh return data register number; expands
to -1 if no return data register is associated with the input number.
At least the inputs 0 and 1 must be mapped; the target may provide more.   

References CALL_EXPR_ARG, constm1_rtx, DEBUGGER_REGNO, DWARF_FRAME_REGNUM, EH_RETURN_DATA_REGNO, error(), exp(), GEN_INT, ggc_alloc(), INVALID_REGNUM, TREE_CODE, tree_fits_uhwi_p(), and tree_to_uhwi().

Referenced by expand_builtin().

◆ expand_builtin_extend_pointer()

rtx expand_builtin_extend_pointer ( tree addr_tree)
extern
Convert a ptr_mode address ADDR_TREE to a Pmode address controlled by
POINTERS_EXTEND_UNSIGNED and return it.   

References convert_modes(), expand_expr(), EXPAND_NORMAL, ggc_alloc(), NULL_RTX, ptr_mode, and targetm.

Referenced by expand_builtin().

◆ expand_builtin_extract_return_addr()

rtx expand_builtin_extract_return_addr ( tree addr_tree)
extern
Given a value extracted from the return address register or stack slot,
return the actual address encoded in that value.   

References convert_memory_address, convert_to_mode(), expand_and(), expand_expr(), EXPAND_NORMAL, GET_MODE, ggc_alloc(), MASK_RETURN_ADDR, NULL_RTX, plus_constant(), and RETURN_ADDR_OFFSET.

Referenced by expand_builtin().

◆ expand_builtin_frob_return_addr()

rtx expand_builtin_frob_return_addr ( tree addr_tree)
extern
Given an actual address in addr_tree, do any necessary encoding
and return the value to be stored in the return address register or
stack slot so the epilogue will return to that address.   

References convert_memory_address, expand_expr(), EXPAND_NORMAL, force_reg(), ggc_alloc(), NULL_RTX, plus_constant(), ptr_mode, and RETURN_ADDR_OFFSET.

Referenced by expand_builtin().

◆ expand_builtin_init_dwarf_reg_sizes()

void expand_builtin_init_dwarf_reg_sizes ( tree address)
extern
Generate code to initialize the dwarf register size table located
at the provided ADDRESS.   

References char_type_node, DWARF_FRAME_RETURN_COLUMN, expand_normal(), gen_rtx_MEM(), gen_rtx_REG(), GET_MODE, ggc_alloc(), i, init_one_dwarf_reg_size(), init_return_column_size(), REGNO, SCALAR_INT_TYPE_MODE, si, targetm, XVECEXP, and XVECLEN.

Referenced by expand_builtin().

◆ expand_builtin_unwind_init()

void expand_builtin_unwind_init ( void )
extern
Do any necessary initialization to access arbitrary stack frames.
On the SPARC, this means flushing the register windows.   

References crtl, and SETUP_FRAME_ADDRESSES.

Referenced by expand_builtin().

◆ expand_eh_return()

void expand_eh_return ( void )
extern
Expand __builtin_eh_return.  This exit path from the function loads up
the eh return data registers, adjusts the stack, and branches to a
given PC other than the normal return address.   

References clobber_return_register(), const0_rtx, const1_rtx, crtl, EH_RETURN_HANDLER_RTX, emit_clobber(), emit_insn(), emit_jump(), emit_label(), emit_move_insn(), error(), gen_label_rtx(), ggc_alloc(), REG_P, and targetm.

Referenced by expand_function_end().

◆ finish_eh_generation()

◆ for_each_eh_label()

void for_each_eh_label ( void(*)(rtx) callback)
extern
Invokes CALLBACK for every exception handler label.  Only used by old
loop hackery; should not be used by new code.   
Invokes CALLBACK for every exception handler landing pad label.
Only used by reload hackery; should not be used by new code.   

References cfun, ggc_alloc(), i, LABEL_P, eh_landing_pad_d::landing_pad, and vec_safe_iterate().

Referenced by set_initial_label_offsets().

◆ function_needs_eh_personality()

◆ gen_eh_landing_pad()

◆ gen_eh_region_allowed()

◆ gen_eh_region_catch()

◆ gen_eh_region_cleanup()

eh_region gen_eh_region_cleanup ( eh_region outer)
extern

◆ gen_eh_region_must_not_throw()

eh_region gen_eh_region_must_not_throw ( eh_region outer)
extern

◆ gen_eh_region_try()

eh_region gen_eh_region_try ( eh_region outer)
extern

References ERT_TRY, and gen_eh_region().

Referenced by lower_catch().

◆ get_eh_landing_pad_from_number()

◆ get_eh_landing_pad_from_number_fn()

eh_landing_pad get_eh_landing_pad_from_number_fn ( struct function * ifun,
int i )
extern

References ggc_alloc(), and i.

Referenced by get_eh_landing_pad_from_number().

◆ get_eh_landing_pad_from_rtx()

eh_landing_pad get_eh_landing_pad_from_rtx ( const_rtx insn)
extern
Return the landing pad to which INSN may go, or NULL if it does not
have a reachable landing pad within this function.   

References get_eh_region_and_lp_from_rtx(), and r.

Referenced by can_throw_internal(), create_trace_edges(), finish_eh_generation(), and rtl_make_eh_edge().

◆ get_eh_region_from_lp_number()

eh_region get_eh_region_from_lp_number ( int i)
extern

◆ get_eh_region_from_lp_number_fn()

eh_region get_eh_region_from_lp_number_fn ( struct function * ifun,
int i )
extern

◆ get_eh_region_from_number()

◆ get_eh_region_from_number_fn()

eh_region get_eh_region_from_number_fn ( struct function * ifun,
int i )
extern

References ggc_alloc(), and i.

Referenced by get_eh_region_from_number(), and remap_eh_region_nr().

◆ get_eh_region_from_rtx()

eh_region get_eh_region_from_rtx ( const_rtx insn)
extern
Return the region to which INSN may go, or NULL if it does not
have a reachable region within this function.   

References get_eh_region_and_lp_from_rtx(), and r.

Referenced by process_bb_node_lives().

◆ get_eh_throw_stmt_table()

hash_map< gimple *, int > * get_eh_throw_stmt_table ( struct function * fun)
extern

◆ init_eh_for_function()

void init_eh_for_function ( void )
extern

◆ lookup_type_for_runtime()

tree lookup_type_for_runtime ( tree type)
extern

◆ make_reg_eh_region_note()

void make_reg_eh_region_note ( rtx_insn * insn,
int ecf_flags,
int lp_nr )
extern
Create the REG_EH_REGION note for INSN, given its ECF_FLAGS for a
 call insn.

 At the gimple level, we use LP_NR
     > 0 : The statement transfers to landing pad LP_NR
     = 0 : The statement is outside any EH region
     < 0 : The statement is within MUST_NOT_THROW region -LP_NR.

 At the rtl level, we use LP_NR
     > 0 : The insn transfers to landing pad LP_NR
     = 0 : The insn cannot throw
     < 0 : The insn is within MUST_NOT_THROW region -LP_NR
     = INT_MIN : The insn cannot throw or execute a nonlocal-goto.
     missing note: The insn is outside any EH region.

??? This difference probably ought to be avoided.  We could stand
to record nothrow for arbitrary gimple statements, and so avoid
some moderately complex lookups in stmt_could_throw_p.  Perhaps
NOTHROW should be mapped on both sides to INT_MIN.  Perhaps the
no-nonlocal-goto property should be recorded elsewhere as a bit
on the call_insn directly.  Perhaps we should make more use of
attaching the trees to call_insns (reachable via symbol_ref in
direct call cases) and just pull the data out of the trees.   

References add_reg_note(), const0_rtx, ECF_NOTHROW, GEN_INT, and ggc_alloc().

Referenced by emit_call_1(), and expand_gimple_stmt().

◆ make_reg_eh_region_note_nothrow_nononlocal()

void make_reg_eh_region_note_nothrow_nononlocal ( rtx_insn * insn)
extern
Create a REG_EH_REGION note for a CALL_INSN that cannot throw
nor perform a non-local goto.  Replace the region note if it
already exists.   

References add_reg_note(), find_reg_note(), GEN_INT, ggc_alloc(), INT_MIN, NULL_RTX, and XEXP.

Referenced by emit_libcall_block_1(), and emit_library_call_value_1().

◆ output_function_exception_table()

void output_function_exception_table ( int section)
extern
Output an exception table for the current function according to SECTION,
switching back and forth from the function section appropriately.

If the function has been partitioned into hot and cold parts, value 0 for
SECTION refers to the table associated with the hot part while value 1
refers to the table associated with the cold part.  If the function has
not been partitioned, value 0 refers to the single exception table.   

References asm_out_file, assemble_external_libcall(), crtl, current_function_decl, current_function_section(), get_fnname_from_decl(), get_personality_function(), ggc_alloc(), global_options, output_one_function_exception_table(), switch_to_exception_section(), switch_to_section(), targetm, and UI_NONE.

Referenced by final_scan_insn_1(), and rest_of_handle_final().

◆ remove_eh_handler()

void remove_eh_handler ( eh_region region)
extern
Splice a single EH region REGION from the region tree.

To unlink REGION, we need to find the pointer to it with a relatively
expensive search in REGION's outer region.  If you are going to
remove a number of handlers, using remove_unreachable_eh_regions may
be a better option.   

References cfun, ggc_alloc(), eh_region_d::inner, eh_region_d::next_peer, eh_region_d::outer, and remove_eh_handler_splicer().

◆ remove_eh_landing_pad()

◆ remove_unreachable_eh_regions()

void remove_unreachable_eh_regions ( sbitmap r_reachable)
extern
Splice all EH regions *not* marked in R_REACHABLE from the region tree.
Do this by traversing the EH tree top-down and splice out regions that
are not marked.  By removing regions from the leaves, we avoid costly
searches in the region tree.   

References cfun, ggc_alloc(), and remove_unreachable_eh_regions_worker().

Referenced by remove_unreachable_handlers(), and remove_unreachable_handlers_no_lp().

◆ set_eh_throw_stmt_table()

void set_eh_throw_stmt_table ( function * fun,
hash_map< gimple *, int > * table )
extern

◆ sjlj_emit_function_exit_after()

void sjlj_emit_function_exit_after ( rtx_insn * after)
extern
Call back from expand_function_end to know where we should put
the call to unwind_sjlj_unregister_libfunc if needed.   

References crtl, and ggc_alloc().

Referenced by expand_function_end().

◆ update_sjlj_context()

void update_sjlj_context ( void )
extern
Update the sjlj function context.  This function should be called
whenever we allocate or deallocate dynamic stack space.   

References emit_note(), and ggc_alloc().

Referenced by record_new_stack_level().

◆ verify_eh_tree()