GCC Middle and Back End API Reference
except.c File Reference

Data Structures

struct  call_site_record_d
struct  action_record
struct  action_record_hasher
struct  duplicate_eh_regions_data
struct  ttypes_filter
struct  ttypes_filter_hasher
struct  ehspec_hasher

Typedefs

typedef hash_table
< action_record_hasher
action_hash_type
typedef hash_table
< ttypes_filter_hasher
ttypes_hash_type
typedef hash_table< ehspec_hasherehspec_hash_type

Functions

static bool get_eh_region_and_lp_from_rtx (const_rtx, eh_region *, eh_landing_pad *)
static int t2r_eq (const void *, const void *)
static hashval_t t2r_hash (const void *)
static void dw2_build_landing_pads (void)
static int collect_one_action_chain (action_hash_type, eh_region)
static int add_call_site (rtx, int, int)
static void push_uleb128 (vec< uchar, va_gc > **, unsigned int)
static void push_sleb128 (vec< uchar, va_gc > **, int)
static int dw2_size_of_call_site_table (int)
static int sjlj_size_of_call_site_table (void)
static void dw2_output_call_site_table (int, int)
static void sjlj_output_call_site_table (void)
void init_eh ()
void init_eh_for_function ()
static eh_region gen_eh_region ()
eh_region gen_eh_region_cleanup ()
eh_region gen_eh_region_try ()
eh_catch gen_eh_region_catch ()
eh_region gen_eh_region_allowed ()
eh_region gen_eh_region_must_not_throw ()
eh_landing_pad gen_eh_landing_pad ()
eh_region get_eh_region_from_number_fn ()
eh_region get_eh_region_from_number ()
eh_landing_pad get_eh_landing_pad_from_number_fn ()
eh_landing_pad get_eh_landing_pad_from_number ()
eh_region get_eh_region_from_lp_number_fn ()
eh_region get_eh_region_from_lp_number ()
bool current_function_has_exception_handlers ()
static void duplicate_eh_regions_1 (struct duplicate_eh_regions_data *data, eh_region old_r, eh_region outer)
struct pointer_map_tduplicate_eh_regions (struct function *ifun, eh_region copy_region, int outer_lp, duplicate_eh_regions_map map, void *map_data)
eh_region eh_region_outermost (struct function *ifun, eh_region region_a, eh_region region_b)
static int t2r_eq ()
static hashval_t t2r_hash ()
void add_type_for_runtime ()
tree lookup_type_for_runtime ()
static int add_ttypes_entry ()
static int add_ehspec_entry (ehspec_hash_type ehspec_hash, ttypes_hash_type ttypes_hash, tree list)
void assign_filter_values ()
static basic_block emit_to_new_bb_before ()
void expand_dw2_landing_pad_for_region ()
static int sjlj_assign_call_site_values ()
static void sjlj_mark_call_sites ()
static void sjlj_emit_function_enter ()
void sjlj_emit_function_exit_after ()
static void sjlj_emit_function_exit ()
static void sjlj_emit_dispatch_table ()
static void sjlj_build_landing_pads ()
void finish_eh_generation ()
void remove_eh_landing_pad ()
static void remove_eh_handler_splicer ()
void remove_eh_handler ()
static void remove_unreachable_eh_regions_worker ()
void remove_unreachable_eh_regions ()
void for_each_eh_label (void(*callback)(rtx))
void make_reg_eh_region_note ()
void make_reg_eh_region_note_nothrow_nononlocal ()
bool insn_could_throw_p ()
void copy_reg_eh_region_note_forward ()
void copy_reg_eh_region_note_backward ()
eh_landing_pad get_eh_landing_pad_from_rtx ()
eh_region get_eh_region_from_rtx ()
bool can_throw_internal ()
bool can_throw_external ()
bool insn_nothrow_p ()
bool can_nonlocal_goto ()
static unsigned int set_nothrow_function_flags ()
rtl_opt_passmake_pass_set_nothrow_function_flags ()
static eh_region expand_builtin_eh_common ()
rtx expand_builtin_eh_pointer ()
rtx expand_builtin_eh_filter ()
rtx expand_builtin_eh_copy_values ()
void expand_builtin_unwind_init ()
rtx expand_builtin_eh_return_data_regno ()
rtx expand_builtin_extract_return_addr ()
rtx expand_builtin_frob_return_addr ()
void expand_builtin_eh_return (tree stackadj_tree, tree handler_tree)
void expand_eh_return ()
rtx expand_builtin_extend_pointer ()
static int add_action_record ()
static int collect_one_action_chain ()
static int add_call_site ()
static unsigned int convert_to_eh_region_ranges ()
static bool gate_convert_to_eh_region_ranges ()
rtl_opt_passmake_pass_convert_to_eh_region_ranges ()
static void push_uleb128 ()
static void push_sleb128 ()
static int dw2_size_of_call_site_table ()
static void dw2_output_call_site_table ()
static void switch_to_exception_section (const char *ARG_UNUSED(fnname))
static void output_ttype ()
static void output_one_function_exception_table ()
void output_function_exception_table ()
void set_eh_throw_stmt_table ()
htab_t get_eh_throw_stmt_table ()
enum eh_personality_kind function_needs_eh_personality ()
void dump_eh_tree ()
DEBUG_FUNCTION void debug_eh_tree ()
DEBUG_FUNCTION void verify_eh_tree ()

Variables

static int call_site_base
static htab_t type_to_runtime_map
static tree sjlj_fc_type_node
static int sjlj_fc_call_site_ofs
static int sjlj_fc_data_ofs
static int sjlj_fc_personality_ofs
static int sjlj_fc_lsda_ofs
static int sjlj_fc_jbuf_ofs
static vec< int > sjlj_lp_call_site_index

Typedef Documentation


Function Documentation

static int add_call_site ( rtx  ,
int  ,
int   
)
static
static int add_call_site ( )
static
static int add_ehspec_entry ( ehspec_hash_type  ehspec_hash,
ttypes_hash_type  ttypes_hash,
tree  list 
)
static
Add LIST to cfun->eh->ehspec_data, using EHSPEC_HASH and TYPES_HASH
   to speed up the search.  Return the filter value to be used.   

References add_ttypes_entry(), eh_status::eh_status_u::arm_eabi, cfun, function::eh, eh_status::ehspec_data, ttypes_filter::filter, hash_table< Descriptor, Allocator >::find_slot(), len, eh_status::eh_status_u::other, push_uleb128(), ttypes_filter::t, targetm, vec_safe_length(), and vec_safe_push().

Referenced by assign_filter_values().

static int add_ttypes_entry ( )
static
Add TYPE (which may be NULL) to cfun->eh->ttype_data, using TYPES_HASH
   to speed up the search.  Return the filter value to be used.   

References cfun, function::eh, ttypes_filter::filter, hash_table< Descriptor, Allocator >::find_slot_with_hash(), ttypes_filter::t, eh_status::ttype_data, type(), vec_safe_length(), and vec_safe_push().

Referenced by add_ehspec_entry(), and assign_filter_values().

bool can_nonlocal_goto ( )
Return true if INSN can perform a non-local goto.   
??? This test is here in this file because it (ab)uses REG_EH_REGION.   

References find_reg_note().

Referenced by control_flow_insn_p(), create_trace_edges(), make_edges(), peep2_attempt(), and purge_dead_edges().

bool can_throw_external ( )
Return true if INSN throws and escapes from the current function.   

References ERT_MUST_NOT_THROW, get_eh_region_and_lp_from_rtx(), and eh_region_d::type.

Referenced by set_nothrow_function_flags().

static int collect_one_action_chain ( action_hash_type  ,
eh_region   
)
static
static unsigned int convert_to_eh_region_ranges ( )
static
Turn REG_EH_REGION notes back into NOTE_INSN_EH_REGION notes.
   The new note numbers will not refer to region numbers, but
   instead to call site entries.   

References add_call_site(), call_site_base, collect_one_action_chain(), hash_table< Descriptor, Allocator >::create(), hash_table< Descriptor, Allocator >::dispose(), emit_note_after(), emit_note_before(), get_eh_region_and_lp_from_rtx(), get_insns(), eh_landing_pad_d::landing_pad, pc_rtx, and vec_alloc().

void copy_reg_eh_region_note_backward ( )
Likewise, but iterate backward.   

References add_reg_note(), find_reg_note(), first, and insn_could_throw_p().

Referenced by peep2_attempt(), and try_split().

void copy_reg_eh_region_note_forward ( )
Copy an REG_EH_REGION note to each insn that might throw beginning
   at FIRST and ending at LAST.  NOTE_OR_INSN is either the source insn
   to look for a note, or the note itself.   

References add_reg_note(), find_reg_note(), insn_could_throw_p(), and last.

Referenced by emit_input_reload_insns(), emit_output_reload_insns(), fixup_eh_region_note(), and resolve_simple_move().

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

References cfun, function::eh, and eh_status::region_tree.

Referenced by is_cfg_nonregular(), and suitable_for_tail_call_opt_p().

DEBUG_FUNCTION void debug_eh_tree ( )
Dump the EH tree for FN on stderr.   

References dump_eh_tree().

struct pointer_map_t* duplicate_eh_regions ( struct function ifun,
eh_region  copy_region,
int  outer_lp,
duplicate_eh_regions_map  map,
void *  map_data 
)
read
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(), duplicate_eh_regions_data::eh_map, get_eh_region_from_lp_number(), duplicate_eh_regions_data::label_map, duplicate_eh_regions_data::label_map_data, map, eh_region_d::next_peer, pointer_map_create(), and verify_eh_tree().

Referenced by copy_cfg_body(), and move_sese_region_to_fn().

static void dw2_output_call_site_table ( int  ,
int   
)
static
static int dw2_size_of_call_site_table ( int  )
static
static int dw2_size_of_call_site_table ( )
static
eh_region eh_region_outermost ( struct function ifun,
eh_region  region_a,
eh_region  region_b 
)
Return the region that is outer to both REGION_A and REGION_B in IFUN.   

References bitmap_bit_p(), bitmap_clear(), bitmap_set_bit(), eh_region_d::index, eh_region_d::outer, sbitmap_alloc(), and sbitmap_free().

Referenced by find_outermost_region_in_block().

static basic_block emit_to_new_bb_before ( )
static
Emit SEQ into basic block just before INSN (that is assumed to be
   first instruction of some existing BB and return the newly
   produced block.   

References create_basic_block(), ei_next(), ei_safe_edge(), emit_insn_before(), edge_def::flags, basic_block_def::flags, force_nonfallthru(), last, basic_block_def::prev_bb, and update_bb_for_insn().

Referenced by dw2_build_landing_pads(), and sjlj_emit_dispatch_table().

static eh_region expand_builtin_eh_common ( )
static
Various hooks for unwind library.   
Expand the EH support builtin functions:
   __builtin_eh_pointer and __builtin_eh_filter.   

References cfun, function::eh, host_integerp(), HOST_WIDE_INT, eh_status::region_array, and tree_low_cst().

Referenced by expand_builtin_eh_copy_values(), expand_builtin_eh_filter(), and expand_builtin_eh_pointer().

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

References emit_move_insn(), eh_region_d::exc_ptr_reg, expand_builtin_eh_common(), eh_region_d::filter_reg, gen_reg_rtx(), ptr_mode, and targetm.

Referenced by expand_builtin().

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

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

Referenced by expand_builtin().

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

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

Referenced by expand_builtin().

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

References copy_to_reg(), emit_jump(), emit_move_insn(), expand_expr(), EXPAND_NORMAL, and gen_label_rtx().

Referenced by expand_builtin().

rtx expand_builtin_eh_return_data_regno ( )
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 error(), HOST_WIDE_INT, and tree_low_cst().

Referenced by expand_builtin().

rtx expand_builtin_extend_pointer ( )
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, ptr_mode, and targetm.

Referenced by expand_builtin().

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

References convert_to_mode(), expand_and(), expand_expr(), EXPAND_NORMAL, and plus_constant().

Referenced by expand_builtin().

rtx expand_builtin_frob_return_addr ( )
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 expand_expr(), EXPAND_NORMAL, force_reg(), plus_constant(), and ptr_mode.

Referenced by expand_builtin().

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

Referenced by expand_builtin().

void expand_dw2_landing_pad_for_region ( )
A subroutine of dw2_build_landing_pads, also used for edge splitting
   at the rtl level.  Emit the code required by the target at a landing
   pad for the given region.   

References emit_insn(), emit_move_insn(), eh_region_d::exc_ptr_reg, eh_region_d::filter_reg, gen_rtx_REG(), ptr_mode, and targetm.

Referenced by dw2_build_landing_pads(), and fix_up_crossing_landing_pad().

void expand_eh_return ( void  )
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(), emit_insn(), emit_jump(), emit_label(), emit_move_insn(), error(), and gen_label_rtx().

Referenced by expand_function_end().

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

References cfun, function::eh, eh_landing_pad_d::landing_pad, eh_status::lp_array, and vec_safe_iterate().

Referenced by set_initial_label_offsets().

static bool gate_convert_to_eh_region_ranges ( )
static
static eh_region gen_eh_region ( )
static
eh_region gen_eh_region_cleanup ( )

References ERT_CLEANUP, and gen_eh_region().

Referenced by lower_cleanup(), and lower_try_finally().

eh_region gen_eh_region_must_not_throw ( )
eh_region gen_eh_region_try ( )

References ERT_TRY, and gen_eh_region().

Referenced by lower_catch().

eh_landing_pad get_eh_landing_pad_from_number_fn ( )
eh_landing_pad get_eh_landing_pad_from_rtx ( )
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().

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

static bool get_eh_region_and_lp_from_rtx ( const_rtx  insn,
eh_region pr,
eh_landing_pad plp 
)
static
eh_region get_eh_region_from_lp_number_fn ( )
eh_region get_eh_region_from_number_fn ( )
eh_region get_eh_region_from_rtx ( )
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().

htab_t get_eh_throw_stmt_table ( )
void init_eh ( void  )
bool insn_could_throw_p ( )
Return true if INSN could throw, assuming no REG_EH_REGION note
   to the contrary.   

References function::can_throw_non_call_exceptions, cfun, and may_trap_p().

Referenced by copy_reg_eh_region_note_backward(), copy_reg_eh_region_note_forward(), expand_gimple_stmt(), fixup_eh_region_note(), and get_eh_region_and_lp_from_rtx().

bool insn_nothrow_p ( )
tree lookup_type_for_runtime ( )
rtl_opt_pass* make_pass_convert_to_eh_region_ranges ( )
rtl_opt_pass* make_pass_set_nothrow_function_flags ( )
void make_reg_eh_region_note ( )
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().

Referenced by emit_call_1(), and expand_gimple_stmt().

void make_reg_eh_region_note_nothrow_nononlocal ( )
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(), and find_reg_note().

Referenced by emit_libcall_block_1(), and emit_library_call_value_1().

static void output_ttype ( )
static
Output a reference from an exception table to the type_info object TYPE.
   TT_FORMAT and TT_FORMAT_SIZE describe the DWARF encoding method used for
   the value.   

References assemble_integer(), dw2_asm_output_encoded_addr_rtx(), expand_expr(), EXPAND_INITIALIZER, lookup_type_for_runtime(), and targetm.

Referenced by output_one_function_exception_table().

static void push_sleb128 ( vec< uchar, va_gc > **  ,
int   
)
static

Referenced by add_action_record().

static void push_sleb128 ( )
static

References vec_safe_push().

static void push_uleb128 ( vec< uchar, va_gc > **  ,
unsigned  int 
)
static

Referenced by add_ehspec_entry().

static void push_uleb128 ( )
static

References vec_safe_push().

void remove_eh_handler ( )
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, function::eh, eh_region_d::inner, eh_region_d::next_peer, eh_region_d::outer, eh_status::region_tree, and remove_eh_handler_splicer().

void remove_unreachable_eh_regions ( )
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, function::eh, eh_status::region_tree, and remove_unreachable_eh_regions_worker().

Referenced by remove_unreachable_handlers(), and remove_unreachable_handlers_no_lp().

static void remove_unreachable_eh_regions_worker ( )
static
Worker for remove_unreachable_eh_regions.
   PP is a pointer to the region to start a region tree depth-first
   search from.  R_REACHABLE is the set of regions that have to be
   preserved.   

References bitmap_bit_p(), eh_region_d::index, eh_region_d::inner, eh_region_d::next_peer, and remove_eh_handler_splicer().

Referenced by remove_unreachable_eh_regions().

void set_eh_throw_stmt_table ( )

References table.

Referenced by add_stmt_to_eh_lp_fn(), and gimple_expand_cfg().

static int sjlj_assign_call_site_values ( )
static
static void sjlj_emit_function_exit ( )
static
void sjlj_emit_function_exit_after ( )
Call back from expand_function_end to know where we should put
   the call to unwind_sjlj_unregister_libfunc if needed.   

Referenced by expand_function_end().

static void sjlj_mark_call_sites ( )
static
static int sjlj_size_of_call_site_table ( void  )
static
static void switch_to_exception_section ( const char *  ARG_UNUSEDfnname)
static
Switch to the section that should be used for exception tables.   

References current_function_decl, data_section, exception_section, free(), get_section(), readonly_data_section, strlen(), and switch_to_section().

Referenced by output_function_exception_table().

static int t2r_eq ( const void *  ,
const void *   
)
static

Referenced by init_eh().

static int t2r_eq ( )
static
static hashval_t t2r_hash ( const void *  )
static

Referenced by init_eh().

static hashval_t t2r_hash ( )
static

Variable Documentation

int sjlj_fc_call_site_ofs
static
int sjlj_fc_data_ofs
static
int sjlj_fc_jbuf_ofs
static
int sjlj_fc_lsda_ofs
static
int sjlj_fc_personality_ofs
static
tree sjlj_fc_type_node
static
Describe the SjLj_Function_Context structure.   

Referenced by init_eh(), and sjlj_build_landing_pads().

vec<int> sjlj_lp_call_site_index
static
htab_t type_to_runtime_map
static