GCC Middle and Back End API Reference
except.h File Reference
#include "hashtab.h"
Include dependency graph for except.h:
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 (const char *)
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)
void expand_dw2_landing_pad_for_region (eh_region)
struct pointer_map_tduplicate_eh_regions (struct function *, eh_region, int, duplicate_eh_regions_map, void *)
void sjlj_emit_function_exit_after (rtx)
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, int ecf_flags, int lp_nr)
void make_reg_eh_region_note_nothrow_nononlocal (rtx)
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)
struct htab * get_eh_throw_stmt_table (struct function *)
void set_eh_throw_stmt_table (struct function *, struct htab *)
enum eh_personality_kind function_needs_eh_personality (struct function *)
static eh_region ehr_next ()

Macro Definition Documentation

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

Referenced by make_goto_expr_edges().

#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))

Typedef Documentation

typedef tree(* duplicate_eh_regions_map)(tree, void *)
typedef struct eh_catch_d* eh_catch
typedef struct eh_region_d* eh_region

Enumeration Type Documentation

Enumerator:
eh_personality_none 
eh_personality_any 
eh_personality_lang 

The type of an exception region.

Enumerator:
ERT_CLEANUP 

CLEANUP regions implement e.g. destructors run when exiting a block. They can be generated from both GIMPLE_TRY_FINALLY and GIMPLE_TRY_CATCH nodes. It is expected by the runtime that cleanup regions will not resume normal program flow, but will continue propagation of the exception.

ERT_TRY 

TRY regions implement catching an exception. The list of types associated with the attached catch handlers is examined in order by the runtime and control is transferred to the appropriate handler. Note that a NULL type list is a catch-all handler, and that it will catch all exceptions including those originating from a different language.

ERT_ALLOWED_EXCEPTIONS 

ALLOWED_EXCEPTIONS regions implement exception filtering, e.g. the throw(type-list) specification that can be added to C++ functions. The runtime examines the thrown exception vs the type list, and if the exception does not match, transfers control to the handler. The normal handler for C++ calls __cxa_call_unexpected.

ERT_MUST_NOT_THROW 

MUST_NOT_THROW regions prevent all exceptions from propagating. This region type is used in C++ to surround destructors being run inside a CLEANUP region. This differs from an ALLOWED_EXCEPTIONS region with an empty type list in that the runtime is prepared to terminate the program directly. We only generate code for MUST_NOT_THROW regions along control paths that are already handling an exception within the current function.


Function Documentation

void add_type_for_runtime ( tree  )
void assign_filter_values ( void  )

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.

             Whatever type_list is (NULL or true list), we build a list
             of filters for the region.   
                 Get a filter value for each of the types caught and store
                 them in the region's dedicated list.   
                 Get a filter value for the NULL list also since it
                 will need an action record anyway.   
bool current_function_has_exception_handlers ( void  )

Returns true if the current function has exception handling regions.

References duplicate_eh_regions_data::eh_map, gen_eh_region(), pointer_map_insert(), and eh_region_d::type.

void debug_eh_tree ( struct function )
void dump_eh_tree ( FILE *  ,
struct function  
)
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.

Copy all the regions in the subtree.

References duplicate_eh_regions_1(), and eh_region_d::next_peer.

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.

Referenced by move_stmt_op().

static eh_region ehr_next ( )
inlinestatic

Pre-order iteration within the eh_region tree.

rtx expand_builtin_dwarf_sp_column ( void  )
rtx expand_builtin_eh_copy_values ( tree  )
rtx expand_builtin_eh_filter ( tree  )
rtx expand_builtin_eh_pointer ( tree  )
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.

rtx expand_builtin_eh_return_data_regno ( tree  )
rtx expand_builtin_extend_pointer ( tree  )
rtx expand_builtin_extract_return_addr ( tree  )
rtx expand_builtin_frob_return_addr ( tree  )
void expand_builtin_init_dwarf_reg_sizes ( tree  )
void expand_builtin_unwind_init ( void  )

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

Set this so all the registers get saved in our frame; we need to be able to copy the saved values for any registers from frames we unwind.

void expand_dw2_landing_pad_for_region ( eh_region  )
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 add_action_record(), collect_one_action_chain(), eh_region_d::eh_region_u::eh_try, eh_catch_d::filter_list, eh_region_d::eh_region_u::eh_region_u_try::last_catch, eh_region_d::outer, eh_catch_d::prev_catch, TREE_CHAIN, TREE_INT_CST_LOW, TREE_VALUE, eh_catch_d::type_list, and eh_region_d::u.

void finish_eh_generation ( void  )

After initial rtl generation, call back to finish generating exception support code.

 Construct the landing pads.   
     Kludge for Alpha (see alpha_gp_save_rtx).   
 Redirect all EH edges from the post_landing_pad to the landing pad.   
     We should not have generated any new throwing insns during this
     pass, and we should not have lost any EH edges, so we only need
     to handle two cases here:
     (1) reachable handler and an existing edge to post-landing-pad,
     (2) no reachable handler and no edge.   
void for_each_eh_label ( void(*)(rtx callback)

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 add_reg_note(), find_reg_note(), insn_could_throw_p(), INSN_P, last, NEXT_INSN, NULL_RTX, and XEXP.

enum eh_personality_kind function_needs_eh_personality ( struct function )
eh_landing_pad gen_eh_landing_pad ( eh_region  )
eh_region gen_eh_region_allowed ( eh_region  ,
tree   
)
eh_catch gen_eh_region_catch ( eh_region  ,
tree   
)
eh_region gen_eh_region_cleanup ( eh_region  )
eh_region gen_eh_region_must_not_throw ( eh_region  )
eh_region gen_eh_region_try ( eh_region  )
eh_landing_pad get_eh_landing_pad_from_number ( int  )
eh_landing_pad get_eh_landing_pad_from_number_fn ( struct function ,
int   
)
eh_landing_pad get_eh_landing_pad_from_rtx ( const_rtx  )
eh_region get_eh_region_from_lp_number ( int  )
eh_region get_eh_region_from_lp_number_fn ( struct function ,
int   
)
eh_region get_eh_region_from_number ( int  )
eh_region get_eh_region_from_number_fn ( struct function ,
int   
)
eh_region get_eh_region_from_rtx ( const_rtx  )
struct htab* get_eh_throw_stmt_table ( struct function )
read
void init_eh_for_function ( void  )

Make sure zero'th entries are used.

References eh_region_d::inner, eh_region_d::next_peer, eh_region_d::outer, eh_region_d::type, and type().

tree lookup_type_for_runtime ( tree  )
void make_reg_eh_region_note ( rtx  insn,
int  ecf_flags,
int  lp_nr 
)
void make_reg_eh_region_note_nothrow_nononlocal ( rtx  )
void output_function_exception_table ( const char *  )
void remove_eh_handler ( eh_region  )
void remove_eh_landing_pad ( eh_landing_pad  )
void remove_unreachable_eh_regions ( sbitmap  )
void set_eh_throw_stmt_table ( struct function ,
struct htab *   
)
void sjlj_emit_function_exit_after ( rtx  )
void verify_eh_tree ( struct function )