|
GCC Middle and Back End API Reference
|
#include "config.h"#include "system.h"#include "coretypes.h"#include "backend.h"#include "tree.h"#include "gimple.h"#include "tree-pass.h"#include "ssa.h"#include "gimple-pretty-print.h"#include "fold-const.h"#include "cfganal.h"#include "cfgloop.h"#include "gimple-iterator.h"#include "gimple-fold.h"#include "tree-eh.h"#include "tree-inline.h"#include "tree-cfg.h"#include "tree-into-ssa.h"#include "domwalk.h"#include "tree-ssa-propagate.h"#include "tree-ssa-threadupdate.h"#include "tree-ssa-scopedtables.h"#include "tree-ssa-threadedge.h"#include "tree-ssa-dom.h"#include "tree-cfgcleanup.h"#include "dbgcnt.h"#include "alloc-pool.h"#include "tree-vrp.h"#include "vr-values.h"#include "gimple-range.h"#include "gimple-range-path.h"#include "alias.h"
Data Structures | |
| class | edge_info |
| struct | opt_stats_d |
| class | dom_jt_state |
| class | dom_jt_simplifier |
| class | dom_opt_dom_walker |
Variables | |
| static bool | cfg_altered |
| static bitmap | need_eh_cleanup |
| static vec< gimple * > | need_noreturn_fixup |
| static struct opt_stats_d | opt_stats |
Return true if all uses of NAME are dominated by STMT or feed STMT via a chain of single immediate uses.
References all_uses_feed_or_dominated_by_stmt(), CDI_DOMINATORS, dominated_by_p(), FOR_EACH_IMM_USE_FAST, gimple_assign_lhs(), gimple_bb(), is_gimple_assign(), is_gimple_debug(), single_imm_use(), TREE_CODE, and USE_STMT.
Referenced by all_uses_feed_or_dominated_by_stmt(), and dom_opt_dom_walker::set_global_ranges_from_unreachable_edges().
|
static |
We have just found an equivalence for LHS on an edge E. Look backwards to other uses of LHS and see if we can derive additional equivalences that are valid on edge E.
References back_propagate_equivalences(), bitmap_bit_p, CDI_DOMINATORS, dom_info_state(), DOM_OK, dom_valueize(), dominated_by_p(), FOR_EACH_IMM_USE_FAST, gimple_bb(), gimple_fold_stmt_to_constant_1(), gimple_get_lhs(), is_gimple_min_invariant(), no_follow_ssa_edges(), record_equality(), TREE_CODE, and USE_STMT.
Referenced by back_propagate_equivalences(), and record_temporary_equivalences().
|
static |
CONST_AND_COPIES is a table which maps an SSA_NAME to the current known value for that SSA_NAME (or NULL if no value is known). Propagate values from CONST_AND_COPIES into the uses, vuses and vdef_ops of STMT.
References cprop_into_stmt(), cprop_operand(), FOR_EACH_SSA_USE_OPERAND, NULL, SSA_OP_USE, TREE_CODE, and USE_FROM_PTR.
Referenced by cprop_into_stmt(), and dom_opt_dom_walker::optimize_stmt().
|
static |
Propagate know values from SSA_NAME_VALUE into the PHI nodes of the successors of BB.
References cprop_into_successor_phis(), FOR_EACH_EDGE, get_use_from_ptr(), gimple_phi_arg_imm_use_ptr(), gsi_end_p(), gsi_next(), gsi_start_phis(), i, may_propagate_copy(), gphi_iterator::phi(), const_and_copies::pop_to_marker(), propagate_value(), const_and_copies::push_marker(), const_and_copies::record_const_or_copy(), edge_info::simple_equivalences, SSA_NAME_VALUE, basic_block_def::succs, and TREE_CODE.
Referenced by dom_opt_dom_walker::before_dom_children(), and cprop_into_successor_phis().
|
static |
Replace *OP_P in STMT with any known equivalent value for *OP_P from CONST_AND_COPIES.
References cprop_operand(), dump_file, dump_flags, gimple_bb(), gimple_set_modified(), may_propagate_copy(), opt_stats_d::num_const_prop, opt_stats_d::num_copy_prop, opt_stats, print_generic_expr(), propagate_value(), r, range_query::range_of_expr(), SSA_NAME_DEF_STMT, SSA_NAME_VALUE, TDF_DETAILS, TREE_CODE, TREE_TYPE, and USE_FROM_PTR.
Referenced by cprop_into_stmt(), and cprop_operand().
Valueize hook for gimple_fold_stmt_to_constant_1.
References dom_valueize(), SSA_NAME_VALUE, and TREE_CODE.
Referenced by back_propagate_equivalences(), dom_valueize(), dom_opt_dom_walker::optimize_stmt(), record_equivalences_from_phis(), and record_equivalences_from_stmt().
|
static |
Dump SSA statistics on FILE.
References dump_dominator_optimization_stats(), htab_statistics(), opt_stats_d::num_exprs_considered, opt_stats_d::num_stmts, and opt_stats.
Referenced by dump_dominator_optimization_stats().
|
static |
Search for redundant computations in STMT. If any are found, then replace them with the variable holding the result of the computation. If safe, record this expression into AVAIL_EXPRS_STACK and CONST_AND_COPIES.
References boolean_type_node, dump_file, dump_flags, dyn_cast(), eliminate_redundant_computations(), fold_convert, gcc_assert, gcc_checking_assert, gcc_unreachable, gimple_assign_lhs(), gimple_call_lhs(), gimple_get_lhs(), gimple_phi_result(), gimple_set_modified(), gimple_switch_index(), gimple_vdef(), gsi_stmt(), insert(), is_gimple_assign(), is_gimple_call(), is_gimple_min_invariant(), avail_exprs_stack::lookup_avail_expr(), may_propagate_copy_into_stmt(), opt_stats_d::num_exprs_considered, opt_stats_d::num_re, opt_stats, print_generic_expr(), print_gimple_expr(), propagate_tree_value_into_stmt(), const_and_copies::record_const_or_copy(), simple_iv_increment_p(), SSA_NAME_OCCURS_IN_ABNORMAL_PHI, TDF_DETAILS, TREE_CODE, TREE_TYPE, and useless_type_conversion_p().
Referenced by dom_opt_dom_walker::before_dom_children(), eliminate_redundant_computations(), and dom_opt_dom_walker::optimize_stmt().
|
static |
Free all EDGE_INFO structures associated with edges in the CFG. If a particular edge can be threaded, copy the redirection target from the EDGE_INFO structure into the edge's AUX field as required by code to update the CFG and SSA graph for jump threading.
References cfun, FOR_EACH_BB_FN, FOR_EACH_EDGE, free_all_edge_infos(), free_dom_edge_info(), and basic_block_def::preds.
Referenced by free_all_edge_infos().
| void free_dom_edge_info | ( | edge | e | ) |
Free the edge_info data attached to E, if it exists and clear e->aux.
References free_dom_edge_info(), and NULL.
Referenced by edge_info::edge_info(), free_all_edge_infos(), free_dom_edge_info(), record_edge_info(), and remove_ctrl_stmt_and_useless_edges().
|
static |
Dump statistics for the hash table HTAB.
References hash_table< Descriptor, Lazy, Allocator >::collisions(), hash_table< Descriptor, Lazy, Allocator >::elements(), fmt_size_t, HOST_SIZE_T_PRINT_DEC, htab_statistics(), and hash_table< Descriptor, Lazy, Allocator >::size().
| gimple_opt_pass * make_pass_dominator | ( | gcc::context * | ctxt | ) |
References make_pass_dominator().
Referenced by make_pass_dominator(), and make_pass_empty_loop().
Handle _4 = x_3 & 31; if (_4 != 0) goto <bb 6>; else goto <bb 7>; <bb 6>: __builtin_unreachable (); <bb 7>: If x_3 has no other immediate uses (checked by caller), var is the x_3 var, we can clear low 5 bits from the non-zero bitmask.
References ptr_info_def::align, wi::bit_and_not(), wi::bit_not(), CONVERT_EXPR_CODE_P, wi::ctz(), get_nonzero_bits(), get_ptr_info(), gimple_assign_cast_p(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gsi_last_bb(), HOST_BITS_PER_INT, integer_zerop(), is_gimple_assign(), maybe_set_nonzero_bits(), ptr_info_def::misalign, NULL, POINTER_TYPE_P, safe_dyn_cast(), set_nonzero_bits(), set_ptr_info_alignment(), SSA_NAME_DEF_STMT, SSA_NAME_PTR_INFO, wi::to_wide(), TREE_CODE, TREE_TYPE, and TYPE_PRECISION.
Referenced by maybe_set_nonzero_bits(), and dom_opt_dom_walker::set_global_ranges_from_unreachable_edges().
|
static |
We have finished optimizing BB, record any information implied by taking a specific outgoing edge from BB.
References as_a(), boolean_type_node, build2(), CASE_HIGH, CASE_LABEL, CASE_LOW, cfun, edge_info::cond_equivalences, constant_boolean_node(), DECIMAL_FLOAT_MODE_P, EDGE_PRED, EDGE_SUCC, element_mode(), error_mark_node, extract_true_false_edges_from_block(), fold_convert_loc(), FOR_EACH_EDGE, free(), free_dom_edge_info(), gimple_bb(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_location(), gimple_switch_index(), gimple_switch_label(), gimple_switch_num_labels(), gsi_end_p(), gsi_last_bb(), gsi_next(), gsi_start_phis(), gsi_stmt(), HONOR_SIGNED_ZEROS(), i, basic_block_def::index, integer_onep(), integer_zerop(), invert_truthvalue_loc(), is_gimple_min_invariant(), label_to_block(), last_basic_block_for_fn, NULL, gphi_iterator::phi(), PHI_ARG_DEF, PHI_RESULT, real_maybe_zerop(), record_conditions(), record_edge_info(), edge_info::record_simple_equiv(), single_block_loop_p(), SSA_NAME_DEF_STMT, ssa_name_has_boolean_range(), basic_block_def::succs, TREE_CODE, and TREE_TYPE.
Referenced by dom_opt_dom_walker::before_dom_children(), and record_edge_info().
|
static |
Local functions.
Similarly, but assume that X and Y are the two operands of an EQ_EXPR. This constrains the cases in which we may treat this as assignment.
References dconst0, has_single_use(), HONOR_SIGNED_ZEROS(), is_gimple_min_invariant(), NULL, real_equal(), const_and_copies::record_const_or_copy(), record_equality(), SSA_NAME_VALUE, TREE_CODE, TREE_REAL_CST, tree_swap_operands_p(), and y.
Referenced by back_propagate_equivalences(), record_equality(), and record_temporary_equivalences().
|
static |
Record any equivalences created by the incoming edge to BB into CONST_AND_COPIES and AVAIL_EXPRS_STACK. If BB has more than one incoming edge, then no equivalence is created.
References CDI_DOMINATORS, get_immediate_dominator(), record_equivalences_from_incoming_edge(), record_temporary_equivalences(), and single_pred_edge_ignoring_loop_edges().
Referenced by dom_opt_dom_walker::before_dom_children(), and record_equivalences_from_incoming_edge().
|
static |
PHI nodes can create equivalences too. Ignoring any alternatives which are the same as the result, if all the alternatives are equal, then the PHI node creates an equivalence.
References dom_valueize(), FOR_EACH_IMM_USE_ON_STMT, FOR_EACH_IMM_USE_STMT, gimple_phi_arg_def(), gimple_phi_arg_edge(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_for_stmt(), gsi_next(), gsi_start_phis(), i, may_propagate_copy(), NULL, operand_equal_for_phi_arg_p(), gphi_iterator::phi(), record_equivalences_from_phis(), remove_phi_node(), set_ssa_name_value(), SET_USE, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, TREE_CODE, and virtual_operand_p().
Referenced by dom_opt_dom_walker::before_dom_children(), and record_equivalences_from_phis().
|
static |
STMT, a GIMPLE_ASSIGN, may create certain equivalences, in either the available expressions table or the const_and_copies table. Detect and record those equivalences into AVAIL_EXPRS_STACK. We handle only very simple copy equivalences here. The heavy lifing is done by eliminate_redundant_computations.
References build1(), dom_valueize(), dump_file, dump_flags, fold_build2, fold_convert, gcc_assert, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_build_assign(), gimple_has_volatile_ops(), gimple_references_memory_p(), gimple_set_vuse(), gimple_vdef(), is_gimple_assign(), is_gimple_min_invariant(), is_gimple_reg(), avail_exprs_stack::lookup_avail_expr(), print_generic_expr(), ptr_type_node, record_equivalences_from_stmt(), set_ssa_name_value(), SSA_NAME_DEF_STMT, TDF_DETAILS, TREE_CODE, TREE_TYPE, and unshare_expr().
Referenced by dom_opt_dom_walker::optimize_stmt(), and record_equivalences_from_stmt().
|
static |
Record into CONST_AND_COPIES and AVAIL_EXPRS_STACK any equivalences implied by traversing edge E (which are cached in E->aux). Callers are responsible for managing the unwinding markers.
References back_propagate_equivalences(), edge_info::cond_equivalences, eni_size_weights, estimate_num_insns(), i, avail_exprs_stack::record_cond(), record_equality(), record_temporary_equivalences(), edge_info::simple_equivalences, SSA_NAME_DEF_STMT, and TREE_CODE.
Referenced by record_equivalences_from_incoming_edge(), record_temporary_equivalences(), and dom_jt_state::register_equivs_edge().
|
static |
If STMT is a comparison of two uniform vectors reduce it to a comparison of scalar objects, otherwise leave STMT unchanged.
References as_a(), dump_file, dump_flags, gimple_assign_rhs1(), gimple_assign_single_p(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_set_modified(), NULL_TREE, print_gimple_stmt(), reduce_vector_comparison_to_scalar_comparison(), SSA_NAME_DEF_STMT, TDF_DETAILS, TREE_CODE, TREE_TYPE, uniform_vector_p(), and VECTOR_TYPE_P.
Referenced by dom_opt_dom_walker::optimize_stmt(), and reduce_vector_comparison_to_scalar_comparison().
Returns true when STMT is a simple iv increment. It detects the
following situation:
i_1 = phi (..., i_k)
[...]
i_j = i_{j-1} for each j : 2 <= j <= k-1
[...]
i_k = i_{k-1} +/- ... Header file for SSA dominator optimizations. Copyright (C) 2013-2026 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/>.
References gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_ssa_name_copy_p(), gimple_phi_arg_def(), gimple_phi_num_args(), i, simple_iv_increment_p(), SSA_NAME_DEF_STMT, and TREE_CODE.
Referenced by eliminate_redundant_computations(), and simple_iv_increment_p().
|
static |
Return TRUE if BB has precisely two preds, one of which is a backedge from a forwarder block where the forwarder block is a direct successor of BB. Being a forwarder block, it has no side effects other than transfer of control. Otherwise return FALSE.
References as_a(), DECL_NONLOCAL, EDGE_COUNT, EDGE_PRED, EDGE_SUCC, gimple_label_label(), gimple_seq_empty_p(), gsi_end_p(), gsi_last_bb(), gsi_prev(), gsi_stmt(), NULL, phi_nodes(), basic_block_def::preds, single_block_loop_p(), and basic_block_def::succs.
Referenced by record_edge_info(), and single_block_loop_p().
|
static |
Track whether or not we have changed the control flow graph.
Referenced by dom_opt_dom_walker::optimize_stmt().
|
static |
Bitmap of blocks that have had EH statements cleaned. We should remove their dead edges eventually.
Referenced by dom_opt_dom_walker::optimize_stmt().
Referenced by dom_opt_dom_walker::optimize_stmt().
|
static |