GCC Middle and Back End API Reference
tree-eh.h File Reference

Go to the source code of this file.


typedef struct eh_region_deh_region


void using_eh_for_cleanups (void)
void add_stmt_to_eh_lp (gimple *, int)
bool remove_stmt_from_eh_lp_fn (struct function *, gimple *)
bool remove_stmt_from_eh_lp (gimple *)
int lookup_stmt_eh_lp_fn (struct function *, const gimple *)
int lookup_stmt_eh_lp (const gimple *)
bool make_eh_dispatch_edges (geh_dispatch *)
edge make_eh_edge (gimple *)
edge redirect_eh_edge (edge, basic_block)
void redirect_eh_dispatch_edge (geh_dispatch *, edge, basic_block)
bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool, bool, tree, bool *)
bool operation_could_trap_p (enum tree_code, bool, bool, tree)
bool tree_could_trap_p (tree)
tree rewrite_to_non_trapping_overflow (tree)
bool stmt_could_throw_p (function *, gimple *)
bool stmt_unremovable_because_of_non_call_eh_p (function *, gimple *)
bool tree_could_throw_p (tree)
bool stmt_can_throw_external (function *, gimple *)
bool stmt_can_throw_internal (function *, gimple *)
bool maybe_clean_eh_stmt_fn (struct function *, gimple *)
bool maybe_clean_eh_stmt (gimple *)
bool maybe_clean_or_replace_eh_stmt (gimple *, gimple *)
bool maybe_duplicate_eh_stmt_fn (struct function *, gimple *, struct function *, gimple *, hash_map< void *, void * > *, int)
bool maybe_duplicate_eh_stmt (gimple *, gimple *)
void maybe_remove_unreachable_handlers (void)
void unsplit_eh_edges (void)
bool verify_eh_edges (gimple *)
bool verify_eh_dispatch_edge (geh_dispatch *)

Typedef Documentation

◆ eh_region

Header file for exception handling.
   Copyright (C) 2013-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
 for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see

Function Documentation

◆ add_stmt_to_eh_lp()

◆ lookup_stmt_eh_lp()

◆ lookup_stmt_eh_lp_fn()

int lookup_stmt_eh_lp_fn ( struct function * ifun,
const gimple * t )
Determine if statement T is inside an EH region in function IFUN.
Positive numbers indicate a landing pad index; negative numbers
indicate a MUST_NOT_THROW region index; zero indicates that the
statement is not recorded in the region table.   

References ggc_alloc(), and NULL.

Referenced by ipa_icf_gimple::func_checker::compare_bb(), find_outermost_region_in_block(), lookup_stmt_eh_lp(), maybe_duplicate_eh_stmt_fn(), merge_stmts_p(), output_bb(), stmt_can_throw_external(), and stmt_can_throw_internal().

◆ make_eh_dispatch_edges()

bool make_eh_dispatch_edges ( geh_dispatch * stmt)
Create the multiple edges from an EH_DISPATCH statement to all of
the possible handlers for its EH region.  Return true if there's
no fallthru edge; false if there is.   

References cfun, ERT_ALLOWED_EXCEPTIONS, ERT_TRY, gcc_unreachable, get_eh_region_from_number(), gimple_bb(), gimple_eh_dispatch_region(), eh_catch_d::label, label_to_block(), make_edge(), eh_catch_d::next_catch, NULL, r, and eh_catch_d::type_list.

Referenced by copy_edges_for_bb(), and make_edges_bb().

◆ make_eh_edge()

edge make_eh_edge ( gimple * stmt)
Create the single EH edge from STMT to its nearest landing pad,
if there is such a landing pad within the current function.   

References cfun, gcc_assert, get_eh_landing_pad_from_number(), ggc_alloc(), gimple_bb(), label_to_block(), lookup_stmt_eh_lp(), make_edge(), NULL, and eh_landing_pad_d::post_landing_pad.

Referenced by copy_edges_for_bb(), gsi_insert_finally_seq_after_call(), and make_edges_bb().

◆ maybe_clean_eh_stmt()

◆ maybe_clean_eh_stmt_fn()

bool maybe_clean_eh_stmt_fn ( struct function * ifun,
gimple * stmt )
Given a statement STMT in IFUN, if STMT can no longer throw, then
remove any entry it might have from the EH table.  Return true if
any change was made.   

References ggc_alloc(), remove_stmt_from_eh_lp_fn(), and stmt_could_throw_p().

Referenced by maybe_clean_eh_stmt(), and update_call_expr().

◆ maybe_clean_or_replace_eh_stmt()

bool maybe_clean_or_replace_eh_stmt ( gimple * old_stmt,
gimple * new_stmt )

◆ maybe_duplicate_eh_stmt()

bool maybe_duplicate_eh_stmt ( gimple * new_stmt,
gimple * old_stmt )
Similar, but both OLD_STMT and NEW_STMT are within the current function,
and thus no remapping is required.   

References add_stmt_to_eh_lp(), cfun, ggc_alloc(), lookup_stmt_eh_lp(), and stmt_could_throw_p().

Referenced by gimple_duplicate_bb().

◆ maybe_duplicate_eh_stmt_fn()

bool maybe_duplicate_eh_stmt_fn ( struct function * new_fun,
gimple * new_stmt,
struct function * old_fun,
gimple * old_stmt,
hash_map< void *, void * > * map,
int default_lp_nr )
Given a statement OLD_STMT in OLD_FUN and a duplicate statement NEW_STMT
in NEW_FUN, copy the EH table data from OLD_STMT to NEW_STMT.  The MAP
operand is the return value of duplicate_eh_regions.   

References add_stmt_to_eh_lp_fn(), ggc_alloc(), lookup_stmt_eh_lp_fn(), map, and stmt_could_throw_p().

Referenced by copy_bb(), and move_block_to_fn().

◆ maybe_remove_unreachable_handlers()

void maybe_remove_unreachable_handlers ( void )
Remove unreachable handlers if any landing pads have been removed after
last ehcleanup pass (due to gimple_purge_dead_eh_edges).   

References cfun, FOR_EACH_VEC_SAFE_ELT, i, label_to_block(), NULL, NULL_TREE, eh_landing_pad_d::post_landing_pad, and remove_unreachable_handlers().

Referenced by execute_cleanup_cfg_post_optimizing(), and unsplit_eh_edges().

◆ operation_could_trap_helper_p()

bool operation_could_trap_helper_p ( enum tree_code op,
bool fp_operation,
bool honor_trapv,
bool honor_nans,
bool honor_snans,
tree divisor,
bool * handled )

◆ operation_could_trap_p()

bool operation_could_trap_p ( enum tree_code op,
bool fp_operation,
bool honor_trapv,
tree divisor )
Return true if operation OP may trap.  FP_OPERATION is true if OP is applied
on floating-point values.  HONOR_TRAPV is true if OP is applied on integer
type operands that may trap.  If OP is a division operator, DIVISOR contains
the value of the divisor.   

References gcc_assert, ggc_alloc(), operation_could_trap_helper_p(), tcc_binary, tcc_comparison, tcc_unary, and TREE_CODE_CLASS.

Referenced by expand_omp_for_init_vars(), fold_binary_op_with_conditional_arg(), gimple_could_trap_p_1(), maybe_resimplify_conditional_op(), replace_stmt_with_simplification(), stmt_could_throw_p(), and tree_could_trap_p().

◆ redirect_eh_dispatch_edge()

void redirect_eh_dispatch_edge ( geh_dispatch * stmt,
edge e,
basic_block new_bb )
This is a subroutine of gimple_redirect_edge_and_branch.  Update the
labels for redirecting a non-fallthru EH_DISPATCH edge E to NEW_BB.
The actual edge update will happen in the caller.   

References cfun, ERT_ALLOWED_EXCEPTIONS, ERT_TRY, gcc_assert, gcc_unreachable, get_eh_region_from_number(), ggc_alloc(), gimple_block_label(), gimple_eh_dispatch_region(), eh_catch_d::label, label_to_block(), eh_catch_d::next_catch, and r.

Referenced by gimple_redirect_edge_and_branch().

◆ redirect_eh_edge()

edge redirect_eh_edge ( edge edge_in,
basic_block new_bb )
Redirect EH edge E to NEW_BB.   

References ggc_alloc(), redirect_eh_edge_1(), and ssa_redirect_edge().

Referenced by gimple_redirect_edge_and_branch().

◆ remove_stmt_from_eh_lp()

bool remove_stmt_from_eh_lp ( gimple * t)
Remove statement T in the current function (cfun) from its
EH landing pad.   

References cfun, and remove_stmt_from_eh_lp_fn().

Referenced by cleanup_empty_eh(), gsi_remove(), maybe_clean_or_replace_eh_stmt(), cgraph_edge::redirect_call_stmt_to_callee(), and redirect_eh_edge_1().

◆ remove_stmt_from_eh_lp_fn()

bool remove_stmt_from_eh_lp_fn ( struct function * ifun,
gimple * t )
Remove statement T in function IFUN from its EH landing pad.   

References get_eh_throw_stmt_table(), ggc_alloc(), and hash_map< KeyId, Value, Traits >::remove().

Referenced by maybe_clean_eh_stmt_fn(), move_block_to_fn(), and remove_stmt_from_eh_lp().

◆ rewrite_to_non_trapping_overflow()

tree rewrite_to_non_trapping_overflow ( tree expr)

◆ stmt_can_throw_external()

bool stmt_can_throw_external ( function * fun,
gimple * stmt )
Return true if STMT can throw an exception that is not caught within its
function FUN.  FUN can be NULL but the function is extra conservative

References lookup_stmt_eh_lp_fn(), and stmt_could_throw_p().

Referenced by analyze_function(), check_call(), check_stmt(), cleanup_empty_eh(), compute_avail(), symbol_table::create_edge(), find_tail_calls(), cgraph_edge::set_call_stmt(), stmt_can_terminate_bb_p(), stmt_kills_ref_p(), and stmt_may_terminate_function_p().

◆ stmt_can_throw_internal()

◆ stmt_could_throw_p()

bool stmt_could_throw_p ( function * fun,
gimple * stmt )

◆ stmt_unremovable_because_of_non_call_eh_p()

bool stmt_unremovable_because_of_non_call_eh_p ( function * fun,
gimple * stmt )
Return true if STMT in function FUN must be assumed necessary because of
non-call exceptions.   

References function::can_delete_dead_exceptions, function::can_throw_non_call_exceptions, and stmt_could_throw_p().

Referenced by simple_dce_from_worklist().

◆ tree_could_throw_p()

◆ tree_could_trap_p()

◆ unsplit_eh_edges()

void unsplit_eh_edges ( void )
Wrapper around unsplit_all_eh that makes it usable everywhere.   

References CDI_DOMINATORS, CDI_POST_DOMINATORS, changed, delete_unreachable_blocks(), free_dominance_info(), maybe_remove_unreachable_handlers(), and unsplit_all_eh().

◆ using_eh_for_cleanups()

void using_eh_for_cleanups ( void )
This routine is called from front ends to indicate eh should be used for

References using_eh_for_cleanups_flag.

◆ verify_eh_dispatch_edge()

◆ verify_eh_edges()

bool verify_eh_edges ( gimple * stmt)
Disable warnings about missing quoting in GCC diagnostics for
the verification errors.  Their format strings don't follow GCC
diagnostic conventions but are only used for debugging.   
Verify that BB containing STMT as the last statement, has precisely the
edge that make_eh_edge would create.   

References cfun, error(), FOR_EACH_EDGE, get_eh_landing_pad_from_number(), ggc_alloc(), gimple_bb(), basic_block_def::index, label_to_block(), lookup_stmt_eh_lp(), NULL, eh_landing_pad_d::post_landing_pad, stmt_could_throw_p(), and basic_block_def::succs.

Referenced by gimple_verify_flow_info().