GCC Middle and Back End API Reference
|
Go to the source code of this file.
Typedefs | |
typedef struct eh_region_d * | eh_region |
typedef struct eh_region_d* 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 version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 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 <http://www.gnu.org/licenses/>.
|
extern |
Add statement T in the current function (cfun) to EH landing pad NUM.
References add_stmt_to_eh_lp_fn(), and cfun.
Referenced by cleanup_empty_eh(), gimple_ic(), gsi_insert_finally_seq_after_call(), input_bb(), maybe_clean_or_replace_eh_stmt(), maybe_duplicate_eh_stmt(), cgraph_edge::redirect_call_stmt_to_callee(), redirect_eh_edge_1(), and vect_finish_stmt_generation_1().
|
extern |
Likewise, but always use the current function.
References cfun, and lookup_stmt_eh_lp_fn().
Referenced by check_call(), cleanup_empty_eh(), copy_reference_ops_from_call(), expand_call_inline(), expand_gimple_stmt(), gimple_ic(), gsi_insert_finally_seq_after_call(), hashable_expr_equal_p(), lower_resx(), make_eh_edge(), mark_reachable_handlers(), maybe_clean_or_replace_eh_stmt(), maybe_duplicate_eh_stmt(), pp_gimple_stmt_1(), cgraph_edge::redirect_call_stmt_to_callee(), redirect_eh_edge_1(), vect_finish_stmt_generation_1(), verify_eh_edges(), and verify_gimple_in_cfg().
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 function::eh, hash_map< KeyId, Value, Traits >::get(), NULL, and eh_status::throw_stmt_table.
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().
|
extern |
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().
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(), 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().
Likewise, but always use the current function.
References cfun, and maybe_clean_eh_stmt_fn().
Referenced by ipcp_modif_dom_walker::before_dom_children(), execute_fixup_cfg(), expand_complex_comparison(), expand_vector_operations(), instrument_builtin_call(), ipa_simd_modify_function_body(), ipa_param_body_adjustments::modify_cfun_body(), redirect_all_calls(), and sra_modify_function_body().
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 remove_stmt_from_eh_lp_fn(), and stmt_could_throw_p().
Referenced by maybe_clean_eh_stmt(), and update_call_expr().
Given a statement OLD_STMT and a new statement NEW_STMT that has replaced OLD_STMT in the function, remove OLD_STMT from the EH table and put NEW_STMT in the table if it should be in there. Return TRUE if a replacement was done that my require an EH edge purge.
References add_stmt_to_eh_lp(), cfun, lookup_stmt_eh_lp(), remove_stmt_from_eh_lp(), and stmt_could_throw_p().
Referenced by substitute_and_fold_dom_walker::before_dom_children(), convert_mult_to_fma_1(), eliminate_dom_walker::eliminate_cleanup(), eliminate_dom_walker::eliminate_stmt(), eliminate_unnecessary_stmts(), expand_call_inline(), fold_marked_statements(), gsi_replace(), strlen_pass::handle_integral_assign(), instrument_builtin_call(), optimize_atomic_bit_test_and(), optimize_atomic_op_fetch_cmp_0(), dom_opt_dom_walker::optimize_stmt(), replace_uses_by(), tidy_after_forward_propagate_addr(), and update_complex_assignment().
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, lookup_stmt_eh_lp(), and stmt_could_throw_p().
Referenced by gimple_duplicate_bb().
|
extern |
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(), function::eh, eh_landing_pad_d::index, eh_region_d::index, lookup_stmt_eh_lp_fn(), eh_status::lp_array, map, eh_status::region_array, and stmt_could_throw_p().
Referenced by copy_bb(), and move_block_to_fn().
|
extern |
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().
|
extern |
Helper function for operation_could_trap_p and stmt_could_throw_p.
References fixed_zerop(), i, integer_zerop(), TREE_CODE, TREE_CONSTANT, TREE_TYPE, TYPE_VECTOR_SUBPARTS(), vector_cst_elt(), vector_cst_encoded_nelts(), and VECTOR_CST_STEPPED_P.
Referenced by operation_could_trap_p(), stmt_could_throw_1_p(), and vn_nary_may_trap().
|
extern |
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, 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().
|
extern |
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(), 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().
|
extern |
Redirect EH edge E to NEW_BB.
References redirect_eh_edge_1(), and ssa_redirect_edge().
Referenced by gimple_redirect_edge_and_branch().
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 statement T in function IFUN from its EH landing pad.
References get_eh_throw_stmt_table(), and hash_map< KeyId, Value, Traits >::remove().
Referenced by maybe_clean_eh_stmt_fn(), move_block_to_fn(), and remove_stmt_from_eh_lp().
If any subexpression of EXPR can trap due to -ftrapv, rewrite it using unsigned arithmetics to avoid traps in it.
References hash_set< KeyId, Lazy, Traits >::empty(), expr, find_trapping_overflow(), replace_trapping_overflow(), unshare_expr(), and walk_tree.
Referenced by add_iv_candidate_for_doloop(), create_waw_or_war_checks(), generate_memcpy_builtin(), generate_memset_builtin(), get_segment_min_max(), and vect_get_loop_niters().
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 then.
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().
Return true if STMT can throw an exception that is caught within its function FUN.
References gcc_checking_assert, lookup_stmt_eh_lp_fn(), and stmt_could_throw_p().
Referenced by add_autoinc_candidates(), convert_mult_to_fma_1(), convert_to_divmod(), copy_edges_for_bb(), expand_call_tm(), expand_complex_libcall(), expand_complex_multiplication(), fold_builtin_atomic_compare_exchange(), gimple_purge_dead_eh_edges(), gimple_regimplify_operands(), handle_builtin_alloca(), predicate::init_from_control_deps(), is_ctrl_altering_stmt(), is_division_by(), is_division_by_square(), mark_aliased_reaching_defs_necessary_1(), maybe_move_debug_stmts_to_successors(), optimize_atomic_bit_test_and(), optimize_atomic_op_fetch_cmp_0(), propagate_with_phi(), sink_common_stores_to_bb(), stmt_kills_ref_p(), vect_build_slp_tree_1(), vect_find_stmt_data_reference(), vectorizable_call(), and vectorizable_simd_clone_call().
Return true if statement STMT within FUN could throw an exception.
References as_a(), function::can_throw_non_call_exceptions, FLOAT_TYPE_P, gimple_asm_volatile_p(), gimple_call_nothrow_p(), gimple_clobber_p(), gimple_cond_code(), gimple_cond_lhs(), NULL_TREE, operation_could_trap_p(), stmt_could_throw_1_p(), and TREE_TYPE.
Referenced by strlen_pass::adjust_last_stmt(), find_candidates_dom_walker::before_dom_children(), substitute_and_fold_dom_walker::before_dom_children(), check_call(), check_stmt(), compute_avail(), convert_mult_to_fma_1(), copy_reference_ops_from_call(), dse_optimize_call(), dse_optimize_stmt(), expand_call_stmt(), expand_complex_libcall(), find_givs_in_stmt_scev(), find_tail_calls(), gimple_ic(), gimple_stringop_fixed_value(), strlen_pass::handle_store(), hashable_expr_equal_p(), ifcvt_can_hoist(), initialize_ao_ref_for_dse(), linearize_expr_tree(), lower_eh_constructs_2(), mark_stmt_if_obviously_necessary(), maybe_clean_eh_stmt_fn(), maybe_clean_or_replace_eh_stmt(), maybe_duplicate_eh_stmt(), maybe_duplicate_eh_stmt_fn(), maybe_optimize_range_tests(), movement_possibility_1(), oacc_entry_exit_ok_1(), reassociate_bb(), simple_dce_from_worklist(), sink_code_in_bb(), ssa_is_replaceable_p(), stmt_can_throw_external(), stmt_can_throw_internal(), stmt_unremovable_because_of_non_call_eh_p(), suitable_cond_bb(), vect_finish_stmt_generation_1(), verify_eh_edges(), and verify_gimple_in_cfg().
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().
Return true if expression T could throw an exception.
References call_expr_flags(), cfun, ECF_NOTHROW, TREE_CODE, tree_could_trap_p(), and TREE_OPERAND.
Referenced by can_sm_ref_p(), check_call(), expand_call(), gimple_cond_get_ops_from_tree(), is_gimple_condexpr_1(), lower_eh_constructs_2(), and suitable_reference_p().
Return true if EXPR can trap, as in dereferencing an invalid pointer location or floating point arithmetic. C.f. the rtl version, may_trap_p. This routine expects only GIMPLE lhs or rhs input.
References CALL_EXPR_FN, COMPARISON_CLASS_P, DECL_COMDAT, DECL_EXTERNAL, DECL_P, DECL_SIZE_UNIT, DECL_WEAK, FLOAT_TYPE_P, cgraph_node::function_symbol(), cgraph_node::get(), varpool_node::get(), get_callee_fndecl(), in_array_bounds_p(), symtab_node::in_other_partition, INTEGRAL_TYPE_P, mem_ref_offset(), NULL_TREE, operation_could_trap_p(), poly_int_tree_p(), range_in_array_bounds_p(), tcc_binary, TMR_INDEX, TMR_INDEX2, wi::to_poly_offset(), TREE_CODE, TREE_CODE_CLASS, tree_could_trap_p(), TREE_OPERAND, TREE_STRING_LENGTH, TREE_THIS_NOTRAP, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_OVERFLOW_TRAPS, and varpool_node::ultimate_alias_target().
Referenced by can_sm_ref_p(), cond_store_replacement(), generic_expr_could_trap_p(), gimple_could_trap_p_1(), pcom_worker::prepare_initializers_chain(), set_mem_attributes_minus_bitpos(), stmt_could_throw_1_p(), tree_could_throw_p(), tree_could_trap_p(), vn_nary_may_trap(), and vn_reference_may_trap().
|
extern |
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().
|
extern |
This routine is called from front ends to indicate eh should be used for cleanups.
References using_eh_for_cleanups_flag.
|
extern |
Similarly, but handle GIMPLE_EH_DISPATCH specifically.
References cfun, error(), ERT_ALLOWED_EXCEPTIONS, ERT_TRY, find_edge(), FOR_EACH_EDGE, gcc_assert, gcc_unreachable, get_eh_region_from_number(), gimple_bb(), gimple_eh_dispatch_region(), basic_block_def::index, eh_catch_d::label, label_to_block(), eh_catch_d::next_catch, NULL, r, basic_block_def::succs, and eh_catch_d::type_list.
Referenced by gimple_verify_flow_info().
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(), 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().