GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "predict.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "ssa.h"
#include "cgraph.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "cfganal.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimplify.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-ssa-sccvn.h"
#include "tree-scalar-evolution.h"
#include "dbgcnt.h"
#include "domwalk.h"
#include "tree-ssa-propagate.h"
#include "tree-ssa-dce.h"
#include "tree-cfgcleanup.h"
#include "alias.h"
#include "gimple-range.h"
Data Structures | |
union | pre_expr_union |
struct | pre_expr_d |
class | bitmap_set |
struct | expr_pred_trans_d |
struct | bb_bitmap_sets |
Macros | |
#define | PRE_EXPR_NAME(e) |
#define | PRE_EXPR_NARY(e) |
#define | PRE_EXPR_REFERENCE(e) |
#define | PRE_EXPR_CONSTANT(e) |
#define | FOR_EACH_EXPR_ID_IN_SET(set, id, bi) |
#define | FOR_EACH_VALUE_ID_IN_SET(set, id, bi) |
#define | EXP_GEN(BB) |
#define | PHI_GEN(BB) |
#define | TMP_GEN(BB) |
#define | AVAIL_OUT(BB) |
#define | ANTIC_IN(BB) |
#define | PA_IN(BB) |
#define | NEW_SETS(BB) |
#define | EXPR_DIES(BB) |
#define | PHI_TRANS_TABLE(BB) |
#define | BB_VISITED(BB) |
#define | BB_MAY_NOTRETURN(BB) |
#define | BB_LIVE_VOP_ON_EXIT(BB) |
Typedefs | |
typedef pre_expr_d * | pre_expr |
typedef class bitmap_set * | bitmap_set_t |
typedef expr_pred_trans_d * | expr_pred_trans_t |
typedef const struct expr_pred_trans_d * | const_expr_pred_trans_t |
typedef struct bb_bitmap_sets * | bb_value_sets_t |
Enumerations | |
enum | pre_expr_kind { NAME , NARY , REFERENCE , CONSTANT } |
Variables | ||
static unsigned int | next_expression_id | |
static vec< pre_expr > | expressions | |
static hash_table< pre_expr_d > * | expression_to_id | |
static vec< unsigned > | name_to_id | |
static obstack | pre_expr_obstack | |
static object_allocator< pre_expr_d > | pre_expr_pool ("pre_expr nodes") | |
static vec< bitmap > | value_expressions | |
static vec< pre_expr > | constant_value_expressions | |
struct { | ||
int insertions | ||
int pa_insert | ||
int hoist_insert | ||
int phis | ||
} | pre_stats | |
static bool | do_partial_partial | |
static object_allocator< bitmap_set > | bitmap_set_pool ("Bitmap sets") | |
static bitmap_obstack | grand_bitmap_obstack | |
static bitmap | inserted_exprs | |
#define ANTIC_IN | ( | BB | ) |
Referenced by compute_antic(), compute_antic_aux(), compute_partial_antic_aux(), debug_bitmap_sets_for(), do_hoist_insertion(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), and insert().
#define AVAIL_OUT | ( | BB | ) |
Referenced by compute_avail(), create_expression_by_pieces(), debug_bitmap_sets_for(), do_hoist_insertion(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), find_or_generate_expression(), init_pre(), insert(), insert_into_preds_of_block(), and phi_translate_1().
#define BB_LIVE_VOP_ON_EXIT | ( | BB | ) |
Referenced by compute_avail(), create_expression_by_pieces(), and translate_vuse_through_block().
#define BB_MAY_NOTRETURN | ( | BB | ) |
Referenced by compute_avail(), and prune_clobbered_mems().
#define BB_VISITED | ( | BB | ) |
Referenced by add_ssa_edge(), compute_antic(), compute_antic_aux(), dfs_broadcast_reachable_1(), oacc_loop_discover_walk(), omp_sese_discover_pars(), omp_sese_find_par(), reorder_basic_blocks_simple(), ssa_propagation_engine::simulate_block(), and sink_clobbers().
#define EXP_GEN | ( | BB | ) |
Referenced by compute_antic_aux(), compute_avail(), debug_bitmap_sets_for(), and init_pre().
#define EXPR_DIES | ( | BB | ) |
Referenced by value_dies_in_block_x().
Referenced by bitmap_set_subtract_expressions(), bitmap_set_subtract_values(), clean(), compute_antic_aux(), compute_partial_antic_aux(), insert(), phi_translate_set(), print_bitmap_set(), and prune_clobbered_mems().
Referenced by sorted_array_from_bitmap_set().
#define NEW_SETS | ( | BB | ) |
Referenced by create_expression_by_pieces(), debug_bitmap_sets_for(), do_pre_regular_insertion(), insert(), and insert_into_preds_of_block().
#define PA_IN | ( | BB | ) |
Referenced by compute_antic(), compute_partial_antic_aux(), debug_bitmap_sets_for(), do_pre_partial_partial_insertion(), and insert().
#define PHI_GEN | ( | BB | ) |
Referenced by compute_avail(), compute_partial_antic_aux(), debug_bitmap_sets_for(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), init_pre(), and insert_into_preds_of_block().
#define PHI_TRANS_TABLE | ( | BB | ) |
Referenced by fini_pre(), init_pre(), phi_trans_add(), phi_translate(), and phi_translate_set().
#define PRE_EXPR_CONSTANT | ( | e | ) |
Referenced by create_expression_by_pieces(), do_pre_regular_insertion(), pre_expr_d::equal(), find_or_generate_expression(), get_expr_type(), get_or_alloc_expr_for_constant(), get_representative_for(), pre_expr_d::hash(), insert_into_preds_of_block(), print_pre_expr(), and vn_valnum_from_value_id().
#define PRE_EXPR_NAME | ( | e | ) |
Referenced by alloc_expression_id(), create_expression_by_pieces(), do_pre_regular_insertion(), pre_expr_d::equal(), find_or_generate_expression(), get_expr_type(), get_or_alloc_expr_for_name(), get_representative_for(), pre_expr_d::hash(), insert_into_preds_of_block(), lookup_expression_id(), phi_translate_1(), print_pre_expr(), and vn_valnum_from_value_id().
#define PRE_EXPR_NARY | ( | e | ) |
Referenced by create_expression_by_pieces(), pre_expr_d::equal(), fully_constant_expression(), get_expr_type(), get_or_alloc_expr_for_nary(), pre_expr_d::hash(), phi_translate_1(), pre_expr_DFS(), print_pre_expr(), prune_clobbered_mems(), and valid_in_sets().
#define PRE_EXPR_REFERENCE | ( | e | ) |
Referenced by create_expression_by_pieces(), do_hoist_insertion(), pre_expr_d::equal(), fully_constant_expression(), get_expr_type(), get_or_alloc_expr_for_reference(), pre_expr_d::hash(), phi_translate_1(), pre_expr_DFS(), print_pre_expr(), prune_clobbered_mems(), valid_in_sets(), and value_dies_in_block_x().
#define TMP_GEN | ( | BB | ) |
Referenced by compute_antic_aux(), compute_avail(), compute_partial_antic_aux(), debug_bitmap_sets_for(), and init_pre().
typedef struct bb_bitmap_sets * bb_value_sets_t |
Sets that we need to keep track of.
typedef class bitmap_set * bitmap_set_t |
An unordered bitmap set. One bitmap tracks values, the other, expressions.
typedef const struct expr_pred_trans_d* const_expr_pred_trans_t |
typedef expr_pred_trans_d * expr_pred_trans_t |
A three tuple {e, pred, v} used to cache phi translations in the phi_translate_table.
typedef pre_expr_d * pre_expr |
enum pre_expr_kind |
Full and partial redundancy elimination and code hoisting on SSA GIMPLE. Copyright (C) 2001-2024 Free Software Foundation, Inc. Contributed by Daniel Berlin <dan@dberlin.org> and Steven Bosscher <stevenb@suse.de> 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/>.
Even though this file is called tree-ssa-pre.cc, we actually implement a bit more than just PRE here. All of them piggy-back on GVN which is implemented in tree-ssa-sccvn.cc. 1. Full Redundancy Elimination (FRE) This is the elimination phase of GVN. 2. Partial Redundancy Elimination (PRE) This is adds computation of AVAIL_OUT and ANTIC_IN and doing expression insertion to form GVN-PRE. 3. Code hoisting This optimization uses the ANTIC_IN sets computed for PRE to move expressions further up than PRE would do, to make multiple computations of the same value fully redundant. This pass is explained below (after the explanation of the basic algorithm for PRE).
TODO: 1. Avail sets can be shared by making an avail_find_leader that walks up the dominator tree and looks in those avail sets. This might affect code optimality, it's unclear right now. Currently the AVAIL_OUT sets are the remaining quadraticness in memory of GVN-PRE. 2. Strength reduction can be performed by anticipating expressions we can repair later on. 3. We can do back-substitution or smarter value numbering to catch commutative expressions split up over multiple statements.
For ease of terminology, "expression node" in the below refers to every expression node but GIMPLE_ASSIGN, because GIMPLE_ASSIGNs represent the actual statement containing the expressions we care about, and we cache the value number by putting it in the expression.
Basic algorithm for Partial Redundancy Elimination: First we walk the statements to generate the AVAIL sets, the EXP_GEN sets, and the tmp_gen sets. EXP_GEN sets represent the generation of values/expressions by a given block. We use them when computing the ANTIC sets. The AVAIL sets consist of SSA_NAME's that represent values, so we know what values are available in what blocks. AVAIL is a forward dataflow problem. In SSA, values are never killed, so we don't need a kill set, or a fixpoint iteration, in order to calculate the AVAIL sets. In traditional parlance, AVAIL sets tell us the downsafety of the expressions/values. Next, we generate the ANTIC sets. These sets represent the anticipatable expressions. ANTIC is a backwards dataflow problem. An expression is anticipatable in a given block if it could be generated in that block. This means that if we had to perform an insertion in that block, of the value of that expression, we could. Calculating the ANTIC sets requires phi translation of expressions, because the flow goes backwards through phis. We must iterate to a fixpoint of the ANTIC sets, because we have a kill set. Even in SSA form, values are not live over the entire function, only from their definition point onwards. So we have to remove values from the ANTIC set once we go past the definition point of the leaders that make them up. compute_antic/compute_antic_aux performs this computation. Third, we perform insertions to make partially redundant expressions fully redundant. An expression is partially redundant (excluding partial anticipation) if: 1. It is AVAIL in some, but not all, of the predecessors of a given block. 2. It is ANTIC in all the predecessors. In order to make it fully redundant, we insert the expression into the predecessors where it is not available, but is ANTIC. When optimizing for size, we only eliminate the partial redundancy if we need to insert in only one predecessor. This avoids almost completely the code size increase that PRE usually causes. For the partial anticipation case, we only perform insertion if it is partially anticipated in some block, and fully available in all of the predecessors. do_pre_regular_insertion/do_pre_partial_partial_insertion performs these steps, driven by insert/insert_aux. Fourth, we eliminate fully redundant expressions. This is a simple statement walk that replaces redundant calculations with the now available values.
Basic algorithm for Code Hoisting: Code hoisting is: Moving value computations up in the control flow graph to make multiple copies redundant. Typically this is a size optimization, but there are cases where it also is helpful for speed. A simple code hoisting algorithm is implemented that piggy-backs on the PRE infrastructure. For code hoisting, we have to know ANTIC_OUT which is effectively ANTIC_IN - AVAIL_OUT. The latter two have to be computed for PRE, and we can use them to perform a limited version of code hoisting, too. For the purpose of this implementation, a value is hoistable to a basic block B if the following properties are met: 1. The value is in ANTIC_IN(B) -- the value will be computed on all paths from B to function exit and it can be computed in B); 2. The value is not in AVAIL_OUT(B) -- there would be no need to compute the value again and make it available twice; 3. All successors of B are dominated by B -- makes sure that inserting a computation of the value in B will make the remaining computations fully redundant; 4. At least one successor has the value in AVAIL_OUT -- to avoid hoisting values up too far; 5. There are at least two successors of B -- hoisting in straight line code is pointless. The third condition is not strictly necessary, but it would complicate the hoisting pass a lot. In fact, I don't know of any code hoisting algorithm that does not have this requirement. Fortunately, experiments have show that most candidate hoistable values are in regions that meet this condition (e.g. diamond-shape regions). The forth condition is necessary to avoid hoisting things up too far away from the uses of the value. Nothing else limits the algorithm from hoisting everything up as far as ANTIC_IN allows. Experiments with SPEC and CSiBE have shown that hoisting up too far results in more spilling, less benefits for code size, and worse benchmark scores. Fortunately, in practice most of the interesting hoisting opportunities are caught despite this limitation. For hoistable values that meet all conditions, expressions are inserted to make the calculation of the hoistable value fully redundant. We perform code hoisting insertions after each round of PRE insertions, because code hoisting never exposes new PRE opportunities, but PRE can create new code hoisting opportunities. The code hoisting algorithm is implemented in do_hoist_insert, driven by insert/insert_aux.
Representations of value numbers: Value numbers are represented by a representative SSA_NAME. We will create fake SSA_NAME's in situations where we need a representative but do not have one (because it is a complex expression). In order to facilitate storing the value numbers in bitmaps, and keep the number of wasted SSA_NAME's down, we also associate a value_id with each value number, and create full blown ssa_name's only where we actually need them (IE in operands of existing expressions). Theoretically you could replace all the value_id's with SSA_NAME_VERSION, but this would allocate a large number of SSA_NAME's (which are each > 30 bytes) just to get a 4 byte number. It would also require an additional indirection at each point we use the value id.
Representation of expressions on value numbers: Expressions consisting of value numbers are represented the same way as our VN internally represents them, with an additional "pre_expr" wrapping around them in order to facilitate storing all of the expressions in the same sets.
Representation of sets: The dataflow sets do not need to be sorted in any particular order for the majority of their lifetime, are simply represented as two bitmaps, one that keeps track of values present in the set, and one that keeps track of expressions present in the set. When we need them in topological order, we produce it on demand by transforming the bitmap into an array and sorting it into topo order.
Type of expression, used to know which member of the PRE_EXPR union is valid.
Enumerator | |
---|---|
NAME | |
NARY | |
REFERENCE | |
CONSTANT |
|
static |
Add expression E to the expression set of value id V.
References BITMAP_ALLOC, bitmap_set_bit, CONSTANT, constant_value_expressions, gcc_checking_assert, get_expr_value_id(), get_expression_id(), grand_bitmap_obstack, pre_expr_d::kind, value_expressions, and value_id_constant_p().
Referenced by compute_avail(), create_expression_by_pieces(), do_pre_regular_insertion(), get_or_alloc_expr_for_constant(), get_representative_for(), insert_into_preds_of_block(), and phi_translate_1().
|
inlinestatic |
Allocate an expression id for EXPR.
References expr, expression_to_id, expressions, gcc_assert, NAME, name_to_id, next_expression_id, num_ssa_names, PRE_EXPR_NAME, and SSA_NAME_VERSION.
Referenced by get_or_alloc_expr_for_constant(), get_or_alloc_expr_for_name(), get_or_alloc_expr_for_nary(), and get_or_alloc_expr_for_reference().
|
static |
Find the leader for a value (i.e., the name representing that value) in a given set, and return it. Return NULL if no leader is found.
References bitmap_bit_p, bitmap_set_contains_value(), constant_value_expressions, EXECUTE_IF_AND_IN_BITMAP, EXECUTE_IF_SET_IN_BITMAP, expression_for_id(), i, NULL, value_expressions, and value_id_constant_p().
Referenced by clean(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), find_leader_in_sets(), and find_or_generate_expression().
|
static |
Insert an expression EXPR into a bitmapped set.
References bitmap_set_bit, get_expr_value_id(), get_expression_id(), and value_id_constant_p().
Referenced by bitmap_value_replace_in_set(), compute_avail(), do_pre_regular_insertion(), insert_into_preds_of_block(), and phi_translate_set().
|
static |
Return true if bitmapped set SET contains the value VALUE_ID.
References bitmap_bit_p, and value_id_constant_p().
Referenced by bitmap_find_leader(), bitmap_value_replace_in_set(), do_hoist_insertion(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), and op_valid_in_sets().
|
static |
Copy a bitmapped set ORIG, into bitmapped set DEST.
References bitmap_copy().
Referenced by compute_avail(), and phi_translate_set().
|
static |
Return true if two bitmap sets are equal.
References a, b, and bitmap_equal_p().
Referenced by compute_antic_aux().
|
static |
Free memory used up by SET.
References bitmap_clear().
Referenced by compute_antic_aux(), compute_partial_antic_aux(), do_hoist_insertion(), and insert().
|
static |
Create a new bitmap set and return it.
References bitmap_initialize(), bitmap_set_pool, and grand_bitmap_obstack.
Referenced by bitmap_set_subtract_expressions(), compute_antic(), compute_antic_aux(), compute_partial_antic_aux(), do_hoist_insertion(), init_pre(), and insert().
|
static |
Subtract all expressions contained in ORIG from DEST.
References bitmap_and_compl(), bitmap_set_bit, bitmap_set_new(), expression_for_id(), FOR_EACH_EXPR_ID_IN_SET, get_expr_value_id(), and i.
Referenced by compute_antic_aux(), and compute_partial_antic_aux().
|
static |
Subtract all values in bitmap set B from bitmap set A.
References a, b, bitmap_and_compl_into(), bitmap_bit_p, bitmap_clear_bit(), expression_for_id(), FOR_EACH_EXPR_ID_IN_SET, get_expr_value_id(), and i.
Referenced by compute_partial_antic_aux().
|
static |
Insert EXPR into SET if EXPR's value is not already present in SET.
References bitmap_set_bit, gcc_checking_assert, get_expr_value_id(), get_expression_id(), and value_id_constant_p().
Referenced by compute_avail(), and compute_partial_antic_aux().
|
static |
Replace an instance of EXPR's VALUE with EXPR in SET if it exists, and add it otherwise. Return true if any changes were made.
References bitmap_clear_bit(), bitmap_insert_into_set(), bitmap_set_bit, bitmap_set_contains_value(), EXECUTE_IF_SET_IN_BITMAP, gcc_unreachable, get_expr_value_id(), get_expression_id(), i, value_expressions, and value_id_constant_p().
Referenced by create_expression_by_pieces(), do_pre_regular_insertion(), insert(), and insert_into_preds_of_block().
|
static |
Clean the set of expressions SET1 that are no longer valid in SET1 or SET2. This means expressions that are made up of values we have no leaders for in SET1 or SET2.
References bitmap_clear_bit(), bitmap_find_leader(), expr, expression_for_id(), exprs, FOR_EACH_EXPR_ID_IN_SET, FOR_EACH_VEC_ELT, gcc_assert, get_expr_value_id(), get_expression_id(), i, sorted_array_from_bitmap_set(), and valid_in_sets().
Referenced by compute_antic(), and compute_partial_antic_aux().
|
static |
Compute ANTIC and partial ANTIC sets.
References ANTIC_IN, BASIC_BLOCK_FOR_FN, BB_VISITED, bitmap_bit_p, bitmap_clear(), bitmap_clear_bit(), bitmap_set_bit, bitmap_set_new(), cfun, changed, clean(), compute_antic_aux(), compute_partial_antic_aux(), do_partial_partial, dump_file, dump_flags, EXIT_BLOCK_PTR_FOR_FN, FOR_ALL_BB_FN, FOR_EACH_BB_FN, FOR_EACH_EDGE, free(), gcc_checking_assert, i, basic_block_def::index, inverted_rev_post_order_compute(), last_basic_block_for_fn, n_basic_blocks_for_fn, PA_IN, basic_block_def::preds, statistics_histogram_event(), TDF_DETAILS, and worklist.
|
static |
Compute the ANTIC set for BLOCK. If succs(BLOCK) > 1 then ANTIC_OUT[BLOCK] = intersection of ANTIC_IN[b] for all succ(BLOCK) else if succs(BLOCK) == 1 then ANTIC_OUT[BLOCK] = phi_translate (ANTIC_IN[succ(BLOCK)]) ANTIC_IN[BLOCK] = clean(ANTIC_OUT[BLOCK] U EXP_GEN[BLOCK] - TMP_GEN[BLOCK]) Note that clean() is deferred until after the iteration.
References ANTIC_IN, BB_VISITED, bitmap_and_into(), bitmap_bit_p, bitmap_clear_bit(), bitmap_ior_into(), bitmap_set_equal(), bitmap_set_free(), bitmap_set_new(), bitmap_set_subtract_expressions(), changed, dump_file, dump_flags, EDGE_COUNT, EXP_GEN, expression_for_id(), expressions, FOR_EACH_EDGE, FOR_EACH_EXPR_ID_IN_SET, FOR_EACH_VEC_ELT, gcc_assert, get_expr_value_id(), gimple_seq_empty_p(), i, basic_block_def::index, NULL, phi_nodes(), phi_translate_set(), print_bitmap_set(), prune_clobbered_mems(), S, single_succ_edge(), single_succ_p(), basic_block_def::succs, TDF_DETAILS, TMP_GEN, pre_expr_d::value_id, and worklist.
Referenced by compute_antic().
|
static |
Compute the AVAIL set for all basic blocks. This function performs value numbering of the statements in each basic block. The AVAIL sets are built from information we glean while doing this value numbering, since the AVAIL sets contain only one entry per value. AVAIL_IN[BLOCK] = AVAIL_OUT[dom(BLOCK)]. AVAIL_OUT[BLOCK] = AVAIL_IN[BLOCK] U PHI_GEN[BLOCK] U TMP_GEN[BLOCK].
References add_to_value(), alias_set_subset_of(), ao_ref_alias_set(), ao_ref_base_alias_set(), ao_ref_init(), as_a(), AVAIL_OUT, vn_reference_s::base_set, BB_LIVE_VOP_ON_EXIT, BB_MAY_NOTRETURN, bitmap_insert_into_set(), bitmap_set_copy(), bitmap_value_insert_into_set(), build_aligned_type(), CDI_DOMINATORS, dump_file, dump_flags, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_PURE, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN, EXP_GEN, first_dom_son(), FOR_EACH_SSA_NAME, FOR_EACH_SSA_TREE_OPERAND, free(), get_expr_value_id(), get_immediate_dominator(), get_or_alloc_expr_for_name(), get_or_alloc_expr_for_nary(), get_or_alloc_expr_for_reference(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_bb(), gimple_call_flags(), gimple_has_side_effects(), gimple_location(), gimple_nop_p(), gimple_phi_result(), gimple_vdef(), gimple_vop(), gimple_vuse(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), has_zero_uses(), i, basic_block_def::index, init_vn_nary_op_from_stmt(), is_gimple_call(), is_gimple_debug(), n_basic_blocks_for_fn, next_dom_son(), NULL, vn_reference_op_struct::op0, vn_reference_op_struct::op2, vn_reference_op_struct::opcode, operand_equal_p(), vn_reference_s::operands, PHI_GEN, vn_nary_op_s::predicated_values, print_bitmap_set(), ptr_type_node, reference_alias_ptr_type(), vn_reference_s::result, vn_reference_s::set, sizeof_vn_nary_op(), ssa_default_def(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_OP_DEF, SSA_OP_USE, ssa_undefined_value_p(), stmt_can_throw_external(), stmt_could_throw_p(), stmt_ends_bb_p(), stmt_may_clobber_ref_p(), TDF_DETAILS, TMP_GEN, wi::to_wide(), TREE_TYPE, vn_reference_op_struct::type, TYPE_ALIGN, TYPE_SIZE, pre_expr_d::value_id, vn_nary_op_s::value_id, value_id_constant_p(), virtual_operand_p(), vn_context_bb, vn_get_stmt_kind(), VN_NARY, vn_nary_length_from_stmt(), vn_nary_may_trap(), vn_nary_op_lookup_stmt(), VN_REFERENCE, vn_reference_lookup_call(), vn_reference_lookup_pieces(), vn_reference_may_trap(), vn_reference_operands_for_lookup(), VN_WALK, wide_int_to_tree(), and worklist.
|
static |
Compute PARTIAL_ANTIC for BLOCK. If succs(BLOCK) > 1 then PA_OUT[BLOCK] = value wise union of PA_IN[b] + all ANTIC_IN not in ANTIC_OUT for all succ(BLOCK) else if succs(BLOCK) == 1 then PA_OUT[BLOCK] = phi_translate (PA_IN[succ(BLOCK)]) PA_IN[BLOCK] = clean(PA_OUT[BLOCK] - TMP_GEN[BLOCK] - ANTIC_IN[BLOCK])
References ANTIC_IN, bitmap_count_bits(), bitmap_ior_into(), bitmap_set_free(), bitmap_set_new(), bitmap_set_subtract_expressions(), bitmap_set_subtract_values(), bitmap_value_insert_into_set(), clean(), dump_file, dump_flags, EDGE_COUNT, expression_for_id(), expressions, FOR_EACH_EDGE, FOR_EACH_EXPR_ID_IN_SET, FOR_EACH_VEC_ELT, gimple_seq_empty_p(), i, basic_block_def::index, NULL, PA_IN, PHI_GEN, phi_nodes(), phi_translate_set(), print_bitmap_set(), prune_clobbered_mems(), single_succ(), single_succ_edge(), single_succ_p(), basic_block_def::succs, TDF_DETAILS, TMP_GEN, and worklist.
Referenced by compute_antic().
|
static |
For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the COMPONENT_REF or MEM_REF or ARRAY_REF portion, because we'd end up with trying to rename aggregates into ssa form directly, which is a no no. Thus, this routine doesn't create temporaries, it just builds a single access expression for the array, calling find_or_generate_expression to build the innermost pieces. This function is a subroutine of create_expression_by_pieces, and should not be called on it's own unless you really know what you are doing.
References create_component_ref_by_pieces_1().
Referenced by create_expression_by_pieces().
|
static |
The actual worker for create_component_ref_by_pieces.
References vn_reference_op_struct::base, build2(), build3(), build4(), build5(), build_fold_addr_expr, build_int_cst(), vn_reference_op_struct::clique, create_component_ref_by_pieces_1(), wi::eq_p(), find_or_generate_expression(), fold(), fold_build1, fold_build2, fold_build3, gcc_assert, gcc_unreachable, get_addr_base_and_unit_offset(), handled_component_p(), int_const_binop(), integer_zerop(), is_gimple_min_invariant(), MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, NULL_TREE, offset, vn_reference_op_struct::op0, vn_reference_op_struct::op1, vn_reference_op_struct::op2, vn_reference_op_struct::opcode, operand_equal_p(), vn_reference_s::operands, REF_REVERSE_STORAGE_ORDER, vn_reference_op_struct::reverse, wi::to_offset(), TREE_CODE, TREE_OPERAND, TREE_TYPE, vn_reference_op_struct::type, TYPE_DOMAIN, TYPE_MIN_VALUE, TYPE_SIZE_UNIT, and vn_ref_op_align_unit().
Referenced by create_component_ref_by_pieces(), create_component_ref_by_pieces_1(), and create_expression_by_pieces().
|
static |
Create an expression in pieces, so that we can handle very complex expressions that may be ANTIC, but not necessary GIMPLE. BLOCK is the basic block the expression will be inserted into, EXPR is the expression to insert (in value form) STMTS is a statement list to append the necessary insertions into. This function will die if we hit some value that shouldn't be ANTIC but is (IE there is no leader for it, or its components). The function returns NULL_TREE in case a different antic expression has to be inserted first. This function may also generate expressions that are themselves partially or fully redundant. Those that are will be either made fully redundant during the next iteration of insert (for partially redundant ones), or eliminated by eliminate (for fully redundant ones).
References add_to_value(), AVAIL_OUT, BB_LIVE_VOP_ON_EXIT, bitmap_set_bit, bitmap_value_replace_in_set(), build_constructor(), vn_reference_op_struct::clique, CONSTANT, CONSTRUCTOR_APPEND_ELT, create_component_ref_by_pieces(), create_component_ref_by_pieces_1(), dump_file, dump_flags, find_or_generate_expression(), fold_convert, fold_stmt_inplace(), gcc_assert, gcc_unreachable, get_expr_type(), get_expr_value_id(), get_next_value_id(), get_or_alloc_expr_for_name(), get_ptr_info(), gimple_build(), gimple_build_assign(), gimple_build_call_internal_vec(), gimple_build_call_vec(), gimple_call_builtin_p(), gimple_call_set_chain(), gimple_call_set_fntype(), gimple_call_set_lhs(), gimple_convert(), gimple_get_lhs(), gimple_seq_add_seq(), gimple_seq_add_stmt_without_update(), gimple_seq_discard(), gimple_seq_empty_p(), gimple_set_location(), gimple_set_vuse(), gsi_end_p(), gsi_last(), gsi_next(), gsi_prev(), gsi_start(), gsi_stmt(), i, basic_block_def::index, inserted_exprs, is_gimple_min_invariant(), vn_nary_op_s::length, make_ssa_name(), make_temp_ssa_name(), NAME, NARY, NEW_SETS, NULL, NULL_TREE, vn_nary_op_s::op, vn_reference_op_struct::op0, vn_reference_op_struct::op1, vn_nary_op_s::opcode, vn_reference_s::operands, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, pre_stats, print_gimple_stmt(), REFERENCE, sc, set_ptr_info_alignment(), sizetype, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, SSA_NAME_VERSION, TDF_DETAILS, TREE_CODE, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, type(), vn_nary_op_s::type, vn_reference_op_struct::type, vn_reference_s::type, update_stmt(), useless_type_conversion_p(), vn_ssa_aux::valnum, pre_expr_d::value_id, vn_ssa_aux::value_id, VN_INFO(), and vn_valnum_from_value_id().
Referenced by do_hoist_insertion(), find_or_generate_expression(), and insert_into_preds_of_block().
DEBUG_FUNCTION void debug_bitmap_set | ( | bitmap_set_t | set | ) |
References print_bitmap_set().
DEBUG_FUNCTION void debug_bitmap_sets_for | ( | basic_block | bb | ) |
References ANTIC_IN, AVAIL_OUT, do_partial_partial, EXP_GEN, basic_block_def::index, NEW_SETS, PA_IN, PHI_GEN, print_bitmap_set(), and TMP_GEN.
DEBUG_FUNCTION void debug_pre_expr | ( | pre_expr | e | ) |
Like print_pre_expr but always prints to stderr.
References print_pre_expr().
DEBUG_FUNCTION void debug_value_expressions | ( | unsigned int | val | ) |
References print_value_expressions().
|
static |
Insert expressions in BLOCK to compute hoistable values up. Return TRUE if something was inserted, otherwise return FALSE. The caller has to make sure that BLOCK has at least two successors.
References ANTIC_IN, AVAIL_OUT, bitmap_and_compl(), bitmap_and_into(), bitmap_clear(), bitmap_empty_p(), bitmap_initialize(), bitmap_ior_and_into(), bitmap_ior_into(), bitmap_move(), bitmap_set_contains_value(), bitmap_set_free(), bitmap_set_new(), create_expression_by_pieces(), dump_file, dump_flags, EDGE_COUNT, expr, bitmap_set::expressions, exprs, FLOAT_TYPE_P, FOR_EACH_EDGE, FOR_EACH_VEC_ELT, gcc_assert, get_expr_type(), get_expr_value_id(), gimple_seq_empty_p(), grand_bitmap_obstack, gsi_end_p(), gsi_insert_seq_after(), gsi_insert_seq_before(), gsi_last_bb(), GSI_NEW_STMT, GSI_SAME_STMT, gsi_stmt(), i, basic_block_def::index, is_ctrl_stmt(), last, loop_exit_edge_p(), basic_block_def::loop_father, NULL, NULL_TREE, phi_nodes(), phi_translate_set(), PRE_EXPR_REFERENCE, pre_stats, print_pre_expr(), REFERENCE, single_pred_p(), sorted_array_from_bitmap_set(), stmt_ends_bb_p(), basic_block_def::succs, TDF_DETAILS, valid_in_sets(), pre_expr_d::value_id, and bitmap_set::values.
Referenced by insert().
|
static |
Perform insertion for partially anticipatable expressions. There is only one case we will perform insertion for these. This case is if the expression is partially anticipatable, and fully available. In this case, we know that putting it earlier will enable us to remove the later computation.
References ANTIC_IN, AVAIL_OUT, bitmap_find_leader(), bitmap_set_contains_value(), dbg_cnt(), dump_file, dump_flags, EDGE_COUNT, expr, exprs, FOR_EACH_EDGE, FOR_EACH_VEC_ELT, gcc_assert, get_expr_value_id(), get_expression_id(), i, insert_into_preds_of_block(), NARY, NULL, optimize_edge_for_speed_p(), PA_IN, PHI_GEN, phi_translate(), pre_stats, basic_block_def::preds, print_pre_expr(), REFERENCE, basic_block_def::succs, and TDF_DETAILS.
Referenced by insert().
|
static |
Perform insertion of partially redundant or hoistable values. For BLOCK, do the following: 1. Propagate the NEW_SETS of the dominator into the current block. If the block has multiple predecessors, 2a. Iterate over the ANTIC expressions for the block to see if any of them are partially redundant. 2b. If so, insert them into the necessary predecessors to make the expression fully redundant. 2c. Insert a new PHI merging the values of the predecessors. 2d. Insert the new PHI, and the new expressions, into the NEW_SETS set. If the block has multiple successors, 3a. Iterate over the ANTIC values for the block to see if any of them are good candidates for hoisting. 3b. If so, insert expressions computing the values in BLOCK, and add the new expressions into the NEW_SETS set. 4. Recursively call ourselves on the dominator children of BLOCK. Steps 1, 2a, and 4 are done by insert_aux. 2b, 2c and 2d are done by do_pre_regular_insertion and do_partial_insertion. 3a and 3b are done in do_hoist_insertion.
References add_to_value(), ANTIC_IN, AVAIL_OUT, bitmap_find_leader(), bitmap_insert_into_set(), bitmap_set_bit, bitmap_set_contains_value(), bitmap_value_replace_in_set(), CONSTANT, dbg_cnt(), dump_file, dump_flags, EDGE_COUNT, pre_expr_d::equal(), expr, exprs, FOR_EACH_EDGE, FOR_EACH_VEC_ELT, gcc_assert, get_expr_type(), get_expr_value_id(), get_expression_id(), get_or_alloc_expr_for_name(), gimple_build_assign(), gsi_after_labels(), gsi_insert_before(), GSI_NEW_STMT, i, insert_into_preds_of_block(), inserted_exprs, pre_expr_d::kind, make_temp_ssa_name(), NAME, NARY, NEW_SETS, NULL, NULL_TREE, optimize_edge_for_speed_p(), PHI_GEN, phi_translate(), PRE_EXPR_CONSTANT, PRE_EXPR_NAME, basic_block_def::preds, print_pre_expr(), REFERENCE, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, SSA_NAME_VERSION, TDF_DETAILS, vn_ssa_aux::valnum, vn_ssa_aux::value_id, VN_INFO(), and vn_valnum_from_value_id().
Referenced by insert().
|
inlinestatic |
Return the expression that has expression id ID
References expressions, and pre_expr_d::id.
Referenced by bitmap_find_leader(), bitmap_set_subtract_expressions(), bitmap_set_subtract_values(), clean(), compute_antic_aux(), compute_partial_antic_aux(), find_or_generate_expression(), get_or_alloc_expr_for_constant(), get_or_alloc_expr_for_name(), get_or_alloc_expr_for_nary(), get_or_alloc_expr_for_reference(), get_representative_for(), insert(), insert_into_preds_of_block(), phi_translate(), phi_translate_set(), pre_expr_DFS(), print_bitmap_set(), prune_clobbered_mems(), and vn_valnum_from_value_id().
|
inlinestatic |
Like bitmap_find_leader, but checks for the value existing in SET1 *or* SET2 *or* SET3. This is used to avoid making a set consisting of the union of PA_IN and ANTIC_IN during insert and phi-translation.
References bitmap_find_leader(), and NULL.
Referenced by phi_translate_1().
|
static |
Find a simple leader for an expression, or generate one using create_expression_by_pieces from a NARY expression for the value. BLOCK is the basic_block we are looking for leaders in. OP is the tree expression to find a leader for or generate. Returns the leader or NULL_TREE on failure.
References AVAIL_OUT, bitmap_find_leader(), CONSTANT, create_expression_by_pieces(), EXECUTE_IF_SET_IN_BITMAP, expression_for_id(), gcc_assert, i, is_gimple_min_invariant(), pre_expr_d::kind, NAME, NARY, NULL_TREE, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, TREE_CODE, TREE_TYPE, vn_ssa_aux::valnum, value_expressions, vn_ssa_aux::value_id, value_id_constant_p(), and VN_INFO().
Referenced by create_component_ref_by_pieces_1(), and create_expression_by_pieces().
|
static |
Deallocate data structures used by PRE.
References basic_block_def::aux, bitmap_obstack_release(), bitmap_set_pool, cfun, constant_value_expressions, expression_to_id, expressions, FOR_ALL_BB_FN, free_aux_for_blocks(), grand_bitmap_obstack, name_to_id, NULL, PHI_TRANS_TABLE, pre_expr_obstack, pre_expr_pool, and value_expressions.
Return the folded version of T if T, when folded, is a gimple min_invariant or an SSA name. Otherwise, return T.
References CONSTANT, fully_constant_vn_reference_p(), get_or_alloc_expr_for_constant(), get_or_alloc_expr_for_name(), is_gimple_min_invariant(), pre_expr_d::kind, NARY, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, REFERENCE, TREE_CODE, and vn_nary_simplify().
Referenced by phi_translate_1().
Get the tree type for our PRE expression e.
References CONSTANT, gcc_unreachable, pre_expr_d::kind, NAME, NARY, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, REFERENCE, and TREE_TYPE.
Referenced by create_expression_by_pieces(), do_hoist_insertion(), do_pre_regular_insertion(), get_representative_for(), and insert_into_preds_of_block().
|
static |
Return the value id for a PRE expression EXPR.
Referenced by add_to_value(), bitmap_insert_into_set(), bitmap_set_subtract_expressions(), bitmap_set_subtract_values(), bitmap_value_insert_into_set(), bitmap_value_replace_in_set(), clean(), compute_antic_aux(), compute_avail(), create_expression_by_pieces(), do_hoist_insertion(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), get_representative_for(), insert_into_preds_of_block(), phi_translate(), phi_translate_1(), print_bitmap_set(), and prune_clobbered_mems().
|
inlinestatic |
Return the expression id for tree EXPR.
Referenced by add_to_value(), bitmap_insert_into_set(), bitmap_value_insert_into_set(), bitmap_value_replace_in_set(), clean(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), phi_trans_add(), phi_translate(), and value_dies_in_block_x().
Given a CONSTANT, allocate a new CONSTANT type PRE_EXPR to represent it.
References add_to_value(), alloc_expression_id(), CONSTANT, expression_for_id(), get_or_alloc_constant_value_id(), lookup_expression_id(), PRE_EXPR_CONSTANT, pre_expr_pool, and UNKNOWN_LOCATION.
Referenced by fully_constant_expression(), insert_into_preds_of_block(), and phi_translate_1().
Given an SSA_NAME NAME, get or create a pre_expr to represent it.
References alloc_expression_id(), expression_for_id(), lookup_expression_id(), NAME, PRE_EXPR_NAME, pre_expr_pool, UNKNOWN_LOCATION, vn_ssa_aux::value_id, and VN_INFO().
Referenced by compute_avail(), create_expression_by_pieces(), do_pre_regular_insertion(), fully_constant_expression(), get_representative_for(), insert_into_preds_of_block(), and phi_translate_1().
|
static |
Given an NARY, get or create a pre_expr to represent it. Assign VALUE_ID to it or allocate a new value-id if it is zero. Record LOC as the original location of the expression.
References alloc_expression_id(), alloc_vn_nary_op_noinit(), expression_for_id(), gcc_assert, get_next_value_id(), vn_nary_op_s::hashcode, vn_nary_op_s::length, pre_expr_d::loc, lookup_expression_id(), NARY, PRE_EXPR_NARY, pre_expr_obstack, pre_expr_pool, sizeof_vn_nary_op(), pre_expr_d::value_id, value_id_constant_p(), and vn_nary_op_compute_hash().
Referenced by compute_avail(), and phi_translate_1().
|
static |
Given an REFERENCE, get or create a pre_expr to represent it.
References alloc_expression_id(), expression_for_id(), pre_expr_d::loc, lookup_expression_id(), pre_expr_pool, PRE_EXPR_REFERENCE, REFERENCE, and vn_reference_s::value_id.
Referenced by compute_avail(), and phi_translate_1().
|
static |
Get a representative SSA_NAME for a given expression that is available in B. Since all of our sub-expressions are treated as values, we require them to be SSA_NAME's for simplicity. Prior versions of GVNPRE used to use "value handles" here, so that an expression would be VH.11 + VH.10 instead of d_3 + e_6. In either case, the operands are really values (IE we do not expect them to be usable without finding leaders).
References add_to_value(), b, CDI_DOMINATORS, CONSTANT, dominated_by_p(), dump_file, dump_flags, EXECUTE_IF_SET_IN_BITMAP, expression_for_id(), exprs, get_expr_type(), get_expr_value_id(), get_or_alloc_expr_for_name(), gimple_bb(), gimple_build_nop(), gimple_nop_p(), i, pre_expr_d::kind, make_temp_ssa_name(), NAME, NARY, vn_ssa_aux::needs_insertion, NULL_TREE, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, print_generic_expr(), print_pre_expr(), REFERENCE, SSA_NAME_DEF_STMT, TDF_DETAILS, vn_ssa_aux::valnum, value_expressions, pre_expr_d::value_id, vn_ssa_aux::value_id, vn_ssa_aux::visited, and VN_INFO().
Referenced by phi_translate_1().
|
static |
Initialize data structures used by PRE.
References alloc_aux_for_blocks(), AVAIL_OUT, BITMAP_ALLOC, bitmap_obstack_initialize(), bitmap_set_new(), calculate_dominance_info(), CDI_DOMINATORS, cfun, connect_infinite_loops_to_exit(), constant_value_expressions, EXP_GEN, expression_to_id, expressions, FOR_ALL_BB_FN, gcc_obstack_init, get_max_constant_value_id(), get_max_value_id(), grand_bitmap_obstack, inserted_exprs, name_to_id, next_expression_id, NULL, num_ssa_names, PHI_GEN, PHI_TRANS_TABLE, pre_expr_obstack, pre_stats, TMP_GEN, and value_expressions.
|
static |
Perform insertion of partially redundant and hoistable values.
References ANTIC_IN, AVAIL_OUT, BASIC_BLOCK_FOR_FN, bitmap_set_free(), bitmap_set_new(), bitmap_set_pool, bitmap_value_replace_in_set(), CDI_DOMINATORS, cfun, changed, do_hoist_insertion(), do_partial_partial, do_pre_partial_partial_insertion(), do_pre_regular_insertion(), dump_file, dump_flags, EDGE_COUNT, EXIT_BLOCK, expression_for_id(), exprs, FOR_ALL_BB_FN, FOR_EACH_EDGE, FOR_EACH_EXPR_ID_IN_SET, free(), get_immediate_dominator(), i, last_basic_block_for_fn, n_basic_blocks_for_fn, NEW_SETS, NULL, PA_IN, pre_and_rev_post_order_compute(), single_pred_p(), sorted_array_from_bitmap_set(), statistics_histogram_event(), basic_block_def::succs, and TDF_DETAILS.
Referenced by compute_insert_delete(), compute_rev_insert_delete(), cse_insn(), cselib_find_slot(), discover_iteration_bound_by_body_walk(), eliminate_redundant_computations(), find_AT_string(), find_AT_string_in_table(), hash_table< Descriptor, Lazy, Allocator >::find_slot(), hash_table< Descriptor, Lazy, Allocator >::find_slot_with_hash(), get_named_event_id(), get_odr_type(), modref_access_node::insert(), modref_tree< T >::insert(), insert_const_anchor(), insert_with_costs(), avail_exprs_stack::lookup_avail_expr(), lookup_descr_for_decl(), lookup_element_for_decl(), lookup_field_for_decl(), fwd_jt_path_registry::lookup_redirection_data(), lookup_tramp_for_decl(), modref_tree< T >::merge(), merge_equiv_classes(), pre_edge_insert(), pre_edge_lcm(), pre_edge_lcm_avs(), pre_edge_rev_lcm(), record_jump_cond(), fibonacci_heap< K, V >::replace_key_data(), variable_from_dropped(), and vn_nary_build_or_lookup_1().
|
static |
Insert the to-be-made-available values of expression EXPRNUM for each predecessor, stored in AVAIL, into the predecessors of BLOCK, and merge the result with a phi node, given the same value number as NODE. Return true if we have inserted new stuff.
References add_phi_arg(), add_to_value(), AVAIL_OUT, bb_loop_depth(), bitmap_insert_into_set(), bitmap_set_bit, bitmap_value_replace_in_set(), CDI_DOMINATORS, cfun, CONSTANT, CONVERT_EXPR_CODE_P, create_expression_by_pieces(), create_phi_node(), dominated_by_p(), dump_file, dump_flags, EDGE_COUNT, EDGE_PRED, expression_for_id(), flow_bb_inside_loop_p(), FOR_EACH_EDGE, gcc_assert, get_expr_type(), get_expr_value_id(), get_or_alloc_expr_for_constant(), get_or_alloc_expr_for_name(), get_range_query(), gimple_bb(), gimple_seq_empty_p(), gsi_insert_seq_on_edge_immediate(), basic_block_def::index, inserted_exprs, insertions, INTEGRAL_TYPE_P, is_gimple_min_invariant(), pre_expr_d::kind, basic_block_def::loop_father, make_temp_ssa_name(), NARY, wi::neg_p(), NEW_SETS, NULL, NULL_TREE, PHI_GEN, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, pre_stats, basic_block_def::preds, print_gimple_stmt(), r, range_cast(), REFERENCE, set_range_info(), SIGNED, SSA_NAME_DEF_STMT, SSA_NAME_RANGE_INFO, SSA_NAME_VERSION, TDF_DETAILS, TREE_CODE, TREE_TYPE, TYPE_PRECISION, UNKNOWN_LOCATION, unshare_expr(), useless_type_conversion_p(), vn_ssa_aux::valnum, vn_ssa_aux::value_id, VN_INFO(), and vn_valnum_from_value_id().
Referenced by do_pre_partial_partial_insertion(), and do_pre_regular_insertion().
|
inlinestatic |
References expression_to_id, NAME, name_to_id, PRE_EXPR_NAME, and SSA_NAME_VERSION.
Referenced by get_or_alloc_expr_for_constant(), get_or_alloc_expr_for_name(), get_or_alloc_expr_for_nary(), and get_or_alloc_expr_for_reference().
gimple_opt_pass * make_pass_pre | ( | gcc::context * | ctxt | ) |
|
static |
Determine if OP is valid in SET1 U SET2, which it is when the union contains its value-id.
References bitmap_set_contains_value(), TREE_CODE, pre_expr_d::value_id, vn_ssa_aux::value_id, and VN_INFO().
Referenced by valid_in_sets().
|
inlinestatic |
Add the tuple mapping from {expression E, basic block PRED} to the phi translation table and return whether it pre-existed.
References expr_pred_trans_d::e, get_expression_id(), and PHI_TRANS_TABLE.
Referenced by phi_translate().
|
static |
Wrapper around phi_translate_1 providing caching functionality.
References CONSTANT, expr, expression_for_id(), get_expr_value_id(), get_expression_id(), NAME, NULL, phi_trans_add(), PHI_TRANS_TABLE, phi_translate_1(), value_id_constant_p(), and vn_context_bb.
Referenced by do_pre_partial_partial_insertion(), do_pre_regular_insertion(), phi_translate_1(), and phi_translate_set().
|
static |
Translate EXPR using phis in PHIBLOCK, so that it has the values of the phis in PRED. Return NULL if we can't find a leader for each part of the translated expression.
References add_to_value(), AVAIL_OUT, vn_reference_op_struct::base, vn_reference_s::base_set, changed, vn_reference_op_struct::clique, CONSTANT, dump_file, dump_flags, expr, find_leader_in_sets(), fold_unary, fully_constant_expression(), gcc_checking_assert, gcc_unreachable, get_expr_value_id(), get_next_value_id(), get_or_alloc_expr_for_constant(), get_or_alloc_expr_for_name(), get_or_alloc_expr_for_nary(), get_or_alloc_expr_for_reference(), get_representative_for(), gimple_bb(), i, basic_block_def::index, is_gimple_min_invariant(), pre_expr_d::kind, vn_nary_op_s::length, vn_reference_s::max_size, NAME, NARY, NULL, NULL_TREE, vn_reference_s::offset, vn_nary_op_s::op, vn_reference_op_struct::op0, vn_reference_op_struct::op1, vn_reference_op_struct::op2, vn_nary_op_s::opcode, vn_reference_op_struct::opcode, vn_reference_s::operands, PHI_ARG_DEF, phi_translate(), PRE_EXPR_NAME, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, vn_nary_op_s::predicated_values, print_pre_expr(), REFERENCE, vn_reference_s::set, sizeof_vn_nary_op(), SSA_NAME_DEF_STMT, TDF_DETAILS, translate_vuse_through_block(), TREE_CODE, TREE_TYPE, operand::type, type(), vn_nary_op_s::type, vn_reference_op_struct::type, vn_reference_s::type, useless_type_conversion_p(), pre_expr_d::value_id, vn_nary_op_s::value_id, vn_reference_s::value_id, vn_ssa_aux::value_id, VN_INFO(), vn_nary_op_lookup_pieces(), vn_reference_insert_pieces(), vn_reference_lookup_pieces(), VN_WALK, vNULL, and vn_reference_s::vuse.
Referenced by phi_translate().
|
static |
For each expression in SET, translate the values through phi nodes in PHIBLOCK using edge PHIBLOCK->PRED, and store the resulting expressions in DEST.
References bitmap_count_bits(), bitmap_insert_into_set(), bitmap_set_copy(), expression_for_id(), FOR_EACH_EXPR_ID_IN_SET, gimple_seq_empty_p(), i, NULL, phi_nodes(), PHI_TRANS_TABLE, and phi_translate().
Referenced by compute_antic_aux(), compute_partial_antic_aux(), and do_hoist_insertion().
|
static |
DFS walk EXPR to its operands with leaders in SET, collecting expressions in SET in postorder into POST.
References bitmap_bit_p, bitmap_set_bit, i, vn_nary_op_s::length, NARY, vn_nary_op_s::op, vn_reference_s::operands, pre_expr_DFS(), PRE_EXPR_NARY, PRE_EXPR_REFERENCE, REFERENCE, TREE_CODE, vn_ssa_aux::value_id, and VN_INFO().
Referenced by pre_expr_DFS(), pre_expr_DFS(), and sorted_array_from_bitmap_set().
|
static |
DFS walk leaders of VAL to their operands with leaders in SET, collecting expressions in SET in postorder into POST.
References bitmap_bit_p, EXECUTE_IF_AND_IN_BITMAP, EXECUTE_IF_SET_IN_BITMAP, expression_for_id(), i, pre_expr_DFS(), and value_expressions.
|
static |
Print out SET to OUTFILE.
References expression_for_id(), FOR_EACH_EXPR_ID_IN_SET, get_expr_value_id(), i, and print_pre_expr().
Referenced by compute_antic_aux(), compute_avail(), compute_partial_antic_aux(), debug_bitmap_set(), debug_bitmap_sets_for(), and print_value_expressions().
|
static |
Print out EXPR to outfile.
References CONSTANT, get_tree_code_name(), i, vn_nary_op_s::length, NAME, NARY, vn_nary_op_s::op, vn_nary_op_s::opcode, vn_reference_s::operands, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, print_generic_expr(), print_vn_reference_ops(), REFERENCE, and vn_reference_s::vuse.
Referenced by debug_pre_expr(), do_hoist_insertion(), do_pre_partial_partial_insertion(), do_pre_regular_insertion(), get_representative_for(), phi_translate_1(), and print_bitmap_set().
|
static |
Print out the expressions that have VAL to OUTFILE.
References bitmap_set::expressions, print_bitmap_set(), and value_expressions.
Referenced by debug_value_expressions().
|
static |
Clean the set of expressions that are no longer valid in SET because they are clobbered in BLOCK or because they trap and may not be executed. When CLEAN_TRAPS is true remove all possibly trapping expressions.
References BB_MAY_NOTRETURN, bitmap_clear(), bitmap_clear_bit(), bitmap_set_bit, CDI_DOMINATORS, dominated_by_p(), expression_for_id(), FOR_EACH_EXPR_ID_IN_SET, get_expr_value_id(), gimple_bb(), gimple_nop_p(), i, NARY, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, REFERENCE, SSA_NAME_DEF_STMT, value_dies_in_block_x(), pre_expr_d::value_id, vn_nary_may_trap(), vn_reference_may_trap(), and vn_reference_s::vuse.
Referenced by compute_antic_aux(), and compute_partial_antic_aux().
|
static |
Generate an topological-ordered array of bitmap set SET.
References bitmap_count_bits(), bitmap_set_bit, bitmap_tree_view(), FOR_EACH_VALUE_ID_IN_SET, grand_bitmap_obstack, i, and pre_expr_DFS().
Referenced by clean(), do_hoist_insertion(), and insert().
|
static |
Translate the VUSE backwards through phi nodes in E->dest, so that it has the value it would have in E->src. Set *SAME_VALID to true in case the new vuse doesn't change the value id of the OPERANDS.
References ao_ref_init_from_vn_reference(), BB_LIVE_VOP_ON_EXIT, BITMAP_FREE, CDI_DOMINATORS, dominated_by_p(), get_continuation_for_phi(), get_immediate_dominator(), get_virtual_phi(), gimple_bb(), gimple_nop_p(), NULL, NULL_TREE, PHI_ARG_DEF, SSA_NAME_DEF_STMT, and visited.
Referenced by phi_translate_1().
|
static |
Determine if the expression EXPR is valid in SET1 U SET2. ONLY SET2 CAN BE NULL. This means that we have a leader for each part of the expression (if it consists of values), or the expression is an SSA_NAME. For loads/calls, we also see if the vuse is killed in this block.
References FOR_EACH_VEC_ELT, gcc_unreachable, i, vn_nary_op_s::length, NAME, NARY, vn_nary_op_s::op, vn_reference_op_struct::op0, vn_reference_op_struct::op1, vn_reference_op_struct::op2, op_valid_in_sets(), vn_reference_s::operands, PRE_EXPR_NARY, PRE_EXPR_REFERENCE, and REFERENCE.
Referenced by clean(), and do_hoist_insertion().
|
static |
Determine if EXPR, a memory expression, is ANTIC_IN at the top of BLOCK by seeing if it is not killed in the block. Note that we are only determining whether there is a store that kills it. Because of the order in which clean iterates over values, we are guaranteed that altered operands will have caused us to be eliminated from the ANTIC_IN set already.
References ao_ref_init_from_vn_reference(), ao_ref::base, vn_reference_s::base_set, BITMAP_ALLOC, bitmap_bit_p, bitmap_set_bit, EXPR_DIES, get_expression_id(), gimple_vdef(), gimple_vuse(), grand_bitmap_obstack, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), NULL_TREE, vn_reference_s::operands, PRE_EXPR_REFERENCE, vn_reference_s::set, stmt_may_clobber_ref_p_1(), and vn_reference_s::type.
Referenced by prune_clobbered_mems().
|
static |
Return a VN valnum (SSA name or constant) for the PRE value-id VAL.
References constant_value_expressions, EXECUTE_IF_SET_IN_BITMAP, expression_for_id(), i, pre_expr_d::kind, NAME, NULL_TREE, PRE_EXPR_CONSTANT, PRE_EXPR_NAME, vn_ssa_aux::valnum, value_expressions, value_id_constant_p(), and VN_INFO().
Referenced by create_expression_by_pieces(), do_pre_regular_insertion(), and insert_into_preds_of_block().
|
static |
We can add and remove elements and entries to and from sets and hash tables, so we use alloc pools for them.
Referenced by bitmap_set_new(), fini_pre(), and insert().
We just record a single expression for each constant value, one of kind CONSTANT.
Referenced by add_to_value(), bitmap_find_leader(), fini_pre(), init_pre(), and vn_valnum_from_value_id().
|
static |
Referenced by compute_antic(), debug_bitmap_sets_for(), and insert().
|
static |
Referenced by alloc_expression_id(), fini_pre(), init_pre(), and lookup_expression_id().
Mapping from expression to id number we can use in bitmap sets.
Referenced by alloc_expression_id(), compute_antic_aux(), compute_partial_antic_aux(), expression_for_id(), fini_pre(), and init_pre().
|
static |
Referenced by add_to_value(), bitmap_set_new(), do_hoist_insertion(), fini_pre(), init_pre(), sorted_array_from_bitmap_set(), and value_dies_in_block_x().
int hoist_insert |
|
static |
Inserted expressions are placed onto this worklist, which is used for performing quick dead code elimination of insertions we made that didn't turn out to be necessary.
Referenced by create_expression_by_pieces(), do_pre_regular_insertion(), eliminate_with_rpo_vn(), init_pre(), insert_into_preds_of_block(), and move_stmt().
int insertions |
Referenced by insert_into_preds_of_block(), and prune_insertions_deletions().
|
static |
Referenced by alloc_expression_id(), fini_pre(), init_pre(), and lookup_expression_id().
|
static |
Next global expression id number.
Referenced by alloc_expression_id(), and init_pre().
int pa_insert |
int phis |
|
static |
Referenced by fini_pre(), get_or_alloc_expr_for_nary(), and init_pre().
|
static |
struct { ... } pre_stats |
This structure is used to keep track of statistics on what optimization PRE was able to perform.
Referenced by create_expression_by_pieces(), do_hoist_insertion(), do_pre_partial_partial_insertion(), init_pre(), and insert_into_preds_of_block().
Mapping from value id to expressions with that value_id.
Referenced by add_to_value(), bitmap_find_leader(), bitmap_value_replace_in_set(), find_or_generate_expression(), fini_pre(), get_representative_for(), init_pre(), pre_expr_DFS(), print_value_expressions(), and vn_valnum_from_value_id().