GCC Middle and Back End API Reference
|
Data Structures | |
struct | dref_d |
struct | chain |
struct | component |
struct | epcc_data |
Typedefs | |
typedef struct dref_d * | dref |
typedef struct chain * | chain_p |
Enumerations | |
enum | chain_type { CT_INVARIANT, CT_LOAD, CT_STORE_LOAD, CT_COMBINATION } |
enum | ref_step_type { RS_INVARIANT, RS_NONZERO, RS_ANY } |
Variables | |
static bitmap | looparound_phis |
static struct pointer_map_t * | name_expansions |
Data references (or phi nodes that carry data reference values across loop iterations).
enum chain_type |
enum ref_step_type |
|
static |
For references in CHAIN that are copied around the LOOP (created previously by PRE, or by user), add the results of such copies to the chain. This enables us to remove the copies by unrolling, and may need less registers (also, it may allow us to combine chains together).
References bitmap_set_bit(), find_looparound_phi(), get_chain_root(), insert_looparound_copy(), data_reference::ref, and chain::refs.
Referenced by determine_roots_comp().
|
static |
Adds REF to the chain CHAIN.
References chain::all_always_accessed, dref_d::always_accessed, dref_d::distance, free(), double_int::from_uhwi(), get_chain_root(), chain::has_max_use_after, chain::length, dref_d::offset, dref_d::pos, chain::refs, double_int::sle(), and double_int::ule().
Referenced by determine_roots_comp().
|
static |
Stores DR_OFFSET (DR) + DR_INIT (DR) to OFFSET.
References aff_combination_add(), aff_combination_const(), DR_INIT, DR_OFFSET, tree_to_aff_combination_expand(), and tree_to_double_int().
Referenced by determine_offset(), and valid_initializer_p().
|
static |
Base NAME and all the names in the chain of phi nodes that use it on variable VAR. The phi nodes are recognized by being in the copies of the header of the LOOP.
References flow_bb_inside_loop_p(), and replace_ssa_name_symbol().
Referenced by eliminate_temp_copies().
|
static |
Returns true if CHAIN is suitable to be combined.
References chain::combined, CT_COMBINATION, CT_LOAD, and chain::type.
Referenced by try_combine_chains().
|
static |
Checks whether R1 and R2 are combined together using CODE, with the result in RSLT_TYPE, in order R1 CODE R2 if SWAP is false and in order R2 CODE R1 if it is true. If CODE is ERROR_MARK, set these values instead.
References commutative_tree_code(), find_common_use_stmt(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), and name_for_ref().
Referenced by combine_chains().
|
static |
Tries to combine chains CH1 and CH2 together. If this succeeds, the description of the new chain is returned, otherwise we return NULL.
References chain::ch1, chain::ch2, combinable_refs_p(), chain::combined, CT_COMBINATION, dref_d::distance, get_chain_root(), chain::has_max_use_after, chain::length, chain::op, chain::refs, chain::rslt_type, dref_d::stmt, stmt_combining_refs(), stmt_dominates_stmt_p(), swap(), and chain::type.
Referenced by try_combine_chains().
|
static |
Finds a root of tree given by FATHERS containing A, and performs path shortening.
Referenced by merge_comps(), and split_data_refs_to_components().
|
static |
Determines number of iterations of the innermost enclosing loop before B refers to exactly the same location as A and stores it to OFF. If A and B do not have the same step, they never meet, or anything else fails, returns false, otherwise returns true. Both A and B are assumed to satisfy suitable_reference_p.
References aff_combination_add(), aff_combination_constant_multiple_p(), aff_combination_dr_offset(), aff_combination_scale(), DR_BASE_ADDRESS, DR_INIT, DR_OFFSET, DR_REF, DR_STEP, integer_zerop(), operand_equal_p(), tree_to_aff_combination_expand(), and useless_type_conversion_p().
Referenced by split_data_refs_to_components(), and suitable_component_p().
|
static |
Find roots of the values and determine distances in components COMPS, and separates the references to CHAINS. LOOP is the current loop.
References comp, determine_roots_comp(), and component::next.
Referenced by tree_predictive_commoning_loop().
|
static |
Find roots of the values and determine distances in the component COMP. The references are redistributed into CHAINS. LOOP is the current loop.
References add_looparound_copies(), add_ref_to_chain(), component::comp_step, DR_IS_WRITE, double_int::from_uhwi(), make_invariant_chain(), make_rooted_chain(), nontrivial_chain_p(), dref_d::offset, order_drefs(), dref_d::ref, component::refs, release_chain(), RS_INVARIANT, and double_int::ule().
Referenced by determine_roots().
|
static |
Determines the unroll factor necessary to remove as many temporary variable copies as possible. CHAINS is the list of chains that will be optimized.
References chain::combined, CT_INVARIANT, gcd(), chain::has_max_use_after, chain::length, and chain::type.
Referenced by tree_predictive_commoning_loop().
void dump_chain | ( | FILE * | , |
chain_p | |||
) |
Dumps CHAIN to FILE.
Referenced by dump_chains().
void dump_chain | ( | ) |
Dumps CHAINS to FILE.
Referenced by tree_predictive_commoning_loop().
void dump_chains | ( | ) |
References dump_chain().
void dump_component | ( | FILE * | , |
struct component * | |||
) |
Dumps COMP to FILE.
Referenced by dump_components().
void dump_component | ( | ) |
References component::comp_step, dump_dref(), component::refs, and RS_INVARIANT.
void dump_components | ( | FILE * | , |
struct component * | |||
) |
Dumps COMPS to FILE.
Referenced by tree_predictive_commoning_loop().
void dump_components | ( | ) |
References comp, dump_component(), and component::next.
void dump_dref | ( | FILE * | , |
dref | |||
) |
Dumps data reference REF to FILE.
Referenced by dump_chain(), and dump_component().
void dump_dref | ( | ) |
References dref_d::distance, DR_IS_READ, DR_REF, dump_double_int(), dref_d::offset, dref_d::pos, print_generic_expr(), print_gimple_stmt(), dref_d::ref, and dref_d::stmt.
|
static |
Given an unrolled LOOP after predictive commoning, remove the register copies arising from phi nodes by changing the base variables of SSA names. TMP_VARS is the set of the temporary variables for those we want to perform this.
References base_names_in_chain_on(), bitmap_bit_p(), gsi_end_p(), gsi_next(), gsi_start_phis(), gsi_stmt(), loop::header, loop_latch_edge(), and single_pred_p().
Referenced by tree_predictive_commoning_loop().
|
static |
Execute load motion for references in chain CHAIN. Uids of the newly created temporary variables are marked in TMP_VARS.
References chain::combined, CT_INVARIANT, DR_IS_READ, DR_IS_WRITE, get_chain_root(), initialize_root_vars_lm(), chain::inits, make_ssa_name(), dref_d::ref, chain::refs, replace_ref_with(), dref_d::stmt, and chain::type.
Referenced by execute_pred_commoning().
|
static |
Perform the predictive commoning optimization for CHAINS. Uids of the newly created temporary variables are marked in TMP_VARS.
References CT_INVARIANT, execute_load_motion(), execute_pred_commoning_chain(), chain::type, and update_ssa().
Referenced by execute_pred_commoning_cbck(), and tree_predictive_commoning_loop().
|
static |
References epcc_data::chains, execute_pred_commoning(), replace_names_by_phis(), and epcc_data::tmp_vars.
Referenced by tree_predictive_commoning_loop().
|
static |
Perform the predictive commoning optimization for a chain CHAIN. Uids of the newly created temporary variables are marked in TMP_VARS.
References chain::combined, dref_d::distance, initialize_root(), chain::length, chain::refs, remove_stmt(), replace_ref_with(), dref_d::stmt, and chain::vars.
Referenced by execute_pred_commoning().
|
staticread |
Check the conditions on references inside each of components COMPS, and remove the unsuitable components from the list. The new list of components is returned. The conditions are described in 2) at the beginning of this file. LOOP is the current loop.
References comp, free(), component::next, component::refs, release_component(), and suitable_component_p().
Referenced by tree_predictive_commoning_loop().
|
static |
If the operation used in STMT is associative and commutative, go through the tree of the same operations and returns its root. Distance to the root is stored in DISTANCE.
References find_use_stmt(), gimple_assign_lhs(), gimple_assign_rhs_code(), and may_reassociate_p().
Referenced by find_common_use_stmt(), and reassociate_to_the_same_stmt().
|
static |
Returns the common statement in that NAME1 and NAME2 have a use. If there is no such statement, returns NULL_TREE. In case the operation used on NAME1 and NAME2 is associative and commutative, returns the root of the tree formed by this operation instead of the statement that uses NAME1 or NAME2.
References find_associative_operation_root(), and find_use_stmt().
Referenced by combinable_refs_p().
|
static |
Finds looparound phi node of LOOP that copies the value of REF, and if its initial value is correct (equal to initial value of REF shifted by one iteration), returns the phi node. Otherwise, NULL_TREE is returned. ROOT is the root of the current chain.
References dref_d::distance, dr_analyze_innermost(), DR_IS_READ, DR_REF, DR_STMT, gimple_assign_lhs(), gimple_assign_rhs1(), gsi_end_p(), gsi_next(), gsi_start_phis(), gsi_stmt(), loop::header, is_gimple_assign(), loop_latch_edge(), loop_preheader_edge(), memset(), dref_d::ref, dref_d::stmt, and valid_initializer_p().
Referenced by add_looparound_copies().
|
static |
Returns the modify statement that uses NAME. Skips over assignment statements, NAME is replaced with the actual name used in the returned statement.
References get_gimple_rhs_class(), gimple_assign_copy_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, and single_nonlooparound_use().
Referenced by find_associative_operation_root(), find_common_use_stmt(), reassociate_to_the_same_stmt(), and stmt_combining_refs().
|
inlinestatic |
Returns root of the CHAIN.
References chain::refs.
Referenced by add_looparound_copies(), add_ref_to_chain(), combine_chains(), execute_load_motion(), initialize_root(), initialize_root_vars(), and prepare_initializers_chain().
|
static |
Get the initialization expression for the INDEX-th temporary variable of CHAIN.
References chain::ch1, chain::ch2, CT_COMBINATION, chain::inits, chain::op, chain::rslt_type, and chain::type.
Referenced by initialize_root_vars().
|
static |
Create the variables and initialization statement for root of chain CHAIN. Uids of the newly created temporary variables are marked in TMP_VARS.
References CT_COMBINATION, CT_STORE_LOAD, get_chain_root(), initialize_root_vars(), chain::length, replace_ref_with(), dref_d::stmt, chain::type, and chain::vars.
Referenced by execute_pred_commoning_chain().
|
static |
Creates the variables for CHAIN, as well as phi nodes for them and initialization on entry to LOOP. Uids of the newly created temporary variables are marked in TMP_VARS.
References add_phi_arg(), create_phi_node(), CT_COMBINATION, DR_REF, force_gimple_operand(), get_chain_root(), get_init_expr(), gimple_assign_lhs(), gsi_insert_seq_on_edge_immediate(), chain::has_max_use_after, loop::header, chain::length, loop_latch_edge(), loop_preheader_edge(), make_ssa_name(), component::next, predcom_tmp_var(), dref_d::ref, dref_d::stmt, chain::type, and chain::vars.
Referenced by initialize_root().
|
static |
Initializes a variable for load motion for ROOT and prepares phi nodes and initialization on entry to LOOP if necessary. The ssa name for the variable is stored in VARS. If WRITTEN is true, also a phi node to copy its value around the loop is created. Uid of the newly created temporary variable is marked in TMP_VARS. INITS is the list containing the (single) initializer.
References add_phi_arg(), create_phi_node(), DR_REF, force_gimple_operand(), gsi_insert_on_edge_immediate(), gsi_insert_seq_on_edge_immediate(), loop::header, loop_latch_edge(), loop_preheader_edge(), make_ssa_name(), component::next, predcom_tmp_var(), and dref_d::ref.
Referenced by execute_load_motion().
|
static |
Adds a reference for the looparound copy of REF in PHI to CHAIN.
References dref_d::always_accessed, dref_d::distance, chain::has_max_use_after, chain::length, chain::refs, and dref_d::stmt.
Referenced by add_looparound_copies().
|
static |
Returns the last basic block in LOOP for that we are sure that it is executed whenever the loop is entered.
References CDI_DOMINATORS, get_loop_exit_edges(), last, loop::latch, nearest_common_dominator(), and edge_def::src.
Referenced by split_data_refs_to_components().
|
static |
Returns the chain for invariant component COMP.
References chain::all_always_accessed, dref_d::always_accessed, CT_INVARIANT, chain::refs, component::refs, and chain::type.
Referenced by determine_roots_comp().
|
static |
Make a new chain rooted at REF.
References chain::all_always_accessed, dref_d::always_accessed, CT_LOAD, CT_STORE_LOAD, dref_d::distance, DR_IS_READ, dref_d::ref, chain::refs, and chain::type.
Referenced by determine_roots_comp().
|
static |
Returns true if we may perform reassociation for operation CODE in TYPE.
References associative_tree_code(), and commutative_tree_code().
Referenced by find_associative_operation_root().
|
static |
Join operation for DFU. FATHERS gives the tree, SIZES are sizes of the components, A and B are components to merge.
References component_of().
Referenced by split_data_refs_to_components().
|
static |
Returns the ssa name that contains the value of REF, or NULL_TREE if there is no such name.
References DR_IS_READ, gimple_assign_lhs(), gimple_assign_rhs1(), is_gimple_assign(), dref_d::ref, and dref_d::stmt.
Referenced by combinable_refs_p(), and stmt_combining_refs().
|
static |
|
static |
Compares two drefs A and B by their offset and position. Callback for qsort.
References dref_d::offset, and double_int::scmp().
Referenced by determine_roots_comp().
|
static |
Returns a new temporary variable used for the I-th variable carrying value of REF. The variable's uid is marked in TMP_VARS.
References bitmap_set_bit(), create_tmp_reg(), and get_lsm_tmp_name().
Referenced by initialize_root_vars(), and initialize_root_vars_lm().
|
static |
Prepare initializers for CHAINS in LOOP, and free chains that cannot be used because the initializers might trap.
References prepare_initializers_chain(), and release_chain().
Referenced by tree_predictive_commoning_loop().
|
static |
Prepare initializers for CHAIN in LOOP. Returns false if this is impossible because one of these initializers may trap, true otherwise.
References chain::all_always_accessed, CT_INVARIANT, dref_d::distance, DR_REF, force_gimple_operand(), get_chain_root(), gsi_insert_seq_on_edge_immediate(), chain::inits, chain::length, loop_preheader_edge(), dref_d::ref, ref_at_iteration(), chain::refs, dref_d::stmt, tree_could_trap_p(), and chain::type.
Referenced by prepare_initializers().
|
static |
Reassociates the expression in that NAME1 and NAME2 are used so that they are combined in a single statement, and returns this statement.
References create_tmp_reg(), find_associative_operation_root(), find_use_stmt(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_set_rhs_with_ops(), gimple_build_assign_with_ops(), gsi_for_stmt(), gsi_insert_before(), GSI_SAME_STMT, gsi_stmt(), make_ssa_name(), remove_name_from_operation(), and update_stmt().
Referenced by stmt_combining_refs().
|
static |
Returns the reference to the address of REF in the ITER-th iteration of LOOP, or NULL if we fail to determine it (ITER may be negative). We try to preserve the original shape of the reference (not rewrite it as an indirect ref to the address), to make tree_could_trap_p in prepare_initializers_chain return false more often.
References affine_iv::base, build_int_cst_type(), expand_simple_operations(), expr_invariant_in_loop_p(), handled_component_p(), integer_zerop(), simple_iv(), affine_iv::step, type(), and unshare_expr().
Referenced by prepare_initializers_chain().
|
static |
Frees a chain CHAIN.
References free(), chain::inits, chain::refs, and chain::vars.
Referenced by determine_roots_comp(), prepare_initializers(), and release_chains().
|
static |
|
static |
Frees a component COMP.
References free(), and component::refs.
Referenced by filter_suitable_components(), and release_components().
|
static |
Frees list of components COMPS.
References component::next, and release_component().
Referenced by tree_predictive_commoning_loop().
|
static |
Remove OP from the operation on rhs of STMT, and replace STMT with an assignment of the remaining operand.
References gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_set_rhs_from_tree(), gsi_for_stmt(), gsi_stmt(), is_gimple_assign(), si, and update_stmt().
Referenced by reassociate_to_the_same_stmt().
|
static |
Remove statement STMT, as well as the chain of assignments in that it is used.
References gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_ssa_name_copy_p(), gsi_for_stmt(), gsi_remove(), component::next, release_defs(), remove_phi_node(), reset_debug_uses(), single_nonlooparound_use(), and unlink_stmt_vdef().
Referenced by execute_pred_commoning_chain().
|
static |
For each reference in CHAINS, if name_defined_by_phi is not NULL, use it to set the stmt field.
References dref_d::name_defined_by_phi, chain::refs, and dref_d::stmt.
Referenced by execute_pred_commoning_cbck().
|
static |
For each reference in CHAINS, if its defining statement is phi node, record the ssa name that is defined by it.
References dref_d::name_defined_by_phi, chain::refs, and dref_d::stmt.
Referenced by tree_predictive_commoning_loop().
|
static |
Replace the reference in statement STMT with temporary variable NEW_TREE. If SET is true, NEW_TREE is instead initialized to the value of the reference in the statement. IN_LHS is true if the reference is in the lhs of STMT, false if it is in rhs.
References cfun, get_or_create_ssa_default_def(), gimple_assign_copy_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_set_rhs_from_tree(), gimple_assign_single_p(), gsi_after_labels(), gsi_for_stmt(), gsi_insert_after(), gsi_insert_before(), GSI_NEW_STMT, gsi_stmt(), is_gimple_assign(), remove_phi_node(), unshare_expr(), and update_stmt().
Referenced by execute_load_motion(), execute_pred_commoning_chain(), and initialize_root().
|
static |
Returns the single statement in that NAME is used, excepting the looparound phi nodes contained in one of the chains. If there is no such statement, or more statements, NULL is returned.
References bitmap_bit_p(), and is_gimple_debug().
Referenced by find_use_stmt(), and remove_stmt().
|
staticread |
Splits dependence graph on DATAREFS described by DEPENDS to components.
References dref_d::always_accessed, data_reference::aux, CDI_DOMINATORS, chrec_known, comp, component_of(), DDR_A, DDR_ARE_DEPENDENT, DDR_B, determine_offset(), dref_d::distance, dominated_by_p(), DR_IS_READ, DR_REF, DR_STMT, free(), last_always_executed_block(), merge_comps(), component::next, dref_d::offset, dref_d::pos, dref_d::ref, dref_d::stmt, and suitable_reference_p().
Referenced by tree_predictive_commoning_loop().
|
static |
Returns the statement that combines references R1 and R2. In case R1 and R2 are not used in the same statement, but they are used with an associative and commutative operation in the same expression, reassociate the expression so that they are used in the same statement.
References find_use_stmt(), name_for_ref(), and reassociate_to_the_same_stmt().
Referenced by combine_chains().
|
static |
Returns true if the component COMP satisfies the conditions described in 2) at the beginning of this file. LOOP is the current loop.
References CDI_DOMINATORS, component::comp_step, determine_offset(), dominated_by_p(), DR_IS_WRITE, first, gimple_bb(), loop::header, just_once_each_iteration_p(), dref_d::offset, dref_d::ref, component::refs, RS_ANY, dref_d::stmt, and suitable_reference_p().
Referenced by filter_suitable_components().
|
static |
Returns true if A is a reference that is suitable for predictive commoning in the innermost loop that contains it. REF_STEP is set according to the step of the reference A.
References DR_REF, DR_STEP, integer_nonzerop(), integer_zerop(), is_gimple_reg_type(), RS_ANY, RS_INVARIANT, RS_NONZERO, and tree_could_throw_p().
Referenced by split_data_refs_to_components(), and suitable_component_p().
unsigned tree_predictive_commoning | ( | void | ) |
Runs predictive commoning.
References free_original_copy_tables(), initialize_original_copy_tables(), LI_ONLY_INNERMOST, optimize_loop_for_speed_p(), scev_reset(), and tree_predictive_commoning_loop().
Referenced by run_tree_predictive_commoning().
|
static |
Performs predictive commoning for LOOP. Returns true if LOOP was unrolled.
References can_unroll_loop_p(), epcc_data::chains, compute_data_dependences_for_loop(), determine_roots(), determine_unroll_factor(), dump_chains(), dump_components(), dump_data_dependence_relations(), dump_file, dump_flags, eliminate_temp_copies(), execute_pred_commoning(), execute_pred_commoning_cbck(), filter_suitable_components(), free_affine_expand_cache(), free_data_refs(), free_dependence_relations(), loop::num, prepare_initializers(), release_chains(), release_components(), replace_phis_by_defined_names(), scev_reset(), single_dom_exit(), split_data_refs_to_components(), epcc_data::tmp_vars, tree_transform_and_unroll_loop(), try_combine_chains(), update_ssa(), and vNULL.
Referenced by tree_predictive_commoning().
|
static |
Try to combine the CHAINS.
References chain_can_be_combined_p(), combine_chains(), vNULL, and worklist.
Referenced by tree_predictive_commoning_loop().
|
static |
Returns true if REF is a valid initializer for ROOT with given DISTANCE (in iterations of the innermost enclosing loop).
References aff_combination_add(), aff_combination_constant_multiple_p(), aff_combination_dr_offset(), aff_combination_scale(), DR_BASE_ADDRESS, DR_INIT, DR_OFFSET, DR_STEP, double_int::from_uhwi(), integer_zerop(), operand_equal_p(), and tree_to_aff_combination_expand().
Referenced by find_looparound_phi().
|
static |
Bitmap of ssa names defined by looparound phi nodes covered by chains.
|
static |
Cache used by tree_to_aff_combination_expand.