GCC Middle and Back End API Reference
|
Data Structures | |
struct | access |
struct | assign_link |
struct | uid_decl_hasher |
Typedefs | |
typedef struct access * | access_p |
Enumerations | |
enum | sra_mode { SRA_MODE_EARLY_IPA, SRA_MODE_EARLY_INTRA, SRA_MODE_INTRA } |
enum | unscalarized_data_handling { SRA_UDH_NONE, SRA_UDH_RIGHT, SRA_UDH_LEFT } |
enum | assignment_mod_result { SRA_AM_NONE, SRA_AM_MODIFIED, SRA_AM_REMOVED } |
enum | ipa_splicing_result { NO_GOOD_ACCESS, UNUSED_PARAMS, BY_VAL_ACCESSES, MODIF_BY_REF_ACCESSES, UNMODIF_BY_REF_ACCESSES } |
Variables | |
static enum sra_mode | sra_mode |
static alloc_pool | access_pool |
static alloc_pool | link_pool |
static struct pointer_map_t * | base_access_vec |
static bitmap | candidate_bitmap |
static hash_table < uid_decl_hasher > | candidates |
static bitmap | should_scalarize_away_bitmap |
static bitmap | cannot_scalarize_away_bitmap |
static struct obstack | name_obstack |
static struct access * | work_queue_head |
static int | func_param_count |
static bool | encountered_apply_args |
static bool | encountered_recursive_call |
static bool | encountered_unchangable_recursive_call |
static HOST_WIDE_INT * | bb_dereferences |
static bitmap | final_bbs |
static struct access | no_accesses_representant |
struct { | |
int replacements | |
int exprs | |
int subtree_copies | |
int subreplacements | |
int deleted | |
int separate_lhs_rhs_handling | |
int deleted_unused_parameters | |
int scalar_by_ref_to_by_val | |
int aggregate_params_reduced | |
int param_reductions_created | |
} | sra_stats |
enum ipa_splicing_result |
enum sra_mode |
@verbatim Scalar Replacement of Aggregates (SRA) converts some structure
references into scalar references, exposing them to the scalar optimizers. Copyright (C) 2008-2013 Free Software Foundation, Inc. Contributed by Martin Jambor mjamb or@s use.c z
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/.
This file implements Scalar Reduction of Aggregates (SRA). SRA is run twice, once in the early stages of compilation (early SRA) and once in the late stages (late SRA). The aim of both is to turn references to scalar parts of aggregates into uses of independent scalar variables. The two passes are nearly identical, the only difference is that early SRA does not scalarize unions which are used as the result in a GIMPLE_RETURN statement because together with inlining this can lead to weird type conversions. Both passes operate in four stages: 1. The declarations that have properties which make them candidates for scalarization are identified in function find_var_candidates(). The candidates are stored in candidate_bitmap. 2. The function body is scanned. In the process, declarations which are used in a manner that prevent their scalarization are removed from the candidate bitmap. More importantly, for every access into an aggregate, an access structure (struct access) is created by create_access() and stored in a vector associated with the aggregate. Among other information, the aggregate declaration, the offset and size of the access and its type are stored in the structure. On a related note, assign_link structures are created for every assign statement between candidate aggregates and attached to the related accesses. 3. The vectors of accesses are analyzed. They are first sorted according to their offset and size and then scanned for partially overlapping accesses (i.e. those which overlap but one is not entirely within another). Such an access disqualifies the whole aggregate from being scalarized. If there is no such inhibiting overlap, a representative access structure is chosen for every unique combination of offset and size. Afterwards, the pass builds a set of trees from these structures, in which children of an access are within their parent (in terms of offset and size). Then accesses are propagated whenever possible (i.e. in cases when it does not create a partially overlapping access) across assign_links from the right hand side to the left hand side. Then the set of trees for each declaration is traversed again and those accesses which should be replaced by a scalar are identified. 4. The function is traversed again, and for every reference into an aggregate that has some component which is about to be scalarized, statements are amended and new statements are created as necessary. Finally, if a parameter got scalarized, the scalar replacements are initialized with values from respective parameter aggregates.
Enumeration of all aggregate reductions we can do.
|
inlinestatic |
Return true iff ACC is non-NULL and has subaccesses.
References access::first_child.
Referenced by sra_modify_assign(), and sra_modify_constructor_assign().
|
static |
Return true iff ACC is (partly) covered by at least one replacement.
References access::first_child, access::grp_to_be_replaced, and access::next_sibling.
Referenced by sra_modify_assign().
|
static |
Return true iff this ACCESS precludes IPA-SRA of the parameter it is associated with. REQ_ALIGN is the minimum required alignment.
References access::expr, get_object_alignment(), is_gimple_call(), access::stmt, and access::write.
Referenced by splice_param_accesses().
|
static |
Add ACCESS to the work queue (which is actually a stack).
References access::grp_queued, access::next_queued, and work_queue_head.
Referenced by propagate_all_subaccesses(), and sort_and_splice_var_accesses().
|
static |
Add LINK to the linked list of assign links of RACC.
References access::first_link, access::last_link, assign_link::next, and assign_link::racc.
Referenced by build_accesses_from_assign().
|
static |
@verbatim Analyze the subtree of accesses rooted in ROOT, scheduling replacements when
both seeming beneficial and when ALLOW_REPLACEMENTS allows it. Also set all sorts of access flags appropriately along the way, notably always set grp_read and grp_assign_read according to MARK_READ and grp_write when MARK_WRITE is true.
Creating a replacement for a scalar access is considered beneficial if its grp_hint is set (this means we are either attempting total scalarization or there is more than one direct read access) or according to the following table:
Access written to through a scalar type (once or more times) | | Written to in an assignment statement | | | | Access read as scalar once | | | | | | Read in an assignment statement | | | |
0 0 0 0 No access for the scalar 0 0 0 1 No access for the scalar 0 0 1 0 No Single read - won't help 0 0 1 1 No The same case 0 1 0 0 No access for the scalar 0 1 0 1 No access for the scalar 0 1 1 0 Yes s = *g; return s.i; 0 1 1 1 Yes The same case as above 1 0 0 0 No Won't help 1 0 0 1 Yes s.i = 1; *g = s; 1 0 1 0 Yes s.i = 5; g = s.i; 1 0 1 1 Yes The same case as above 1 1 0 0 No Won't help. 1 1 0 1 Yes s.i = 1; *g = s; 1 1 1 0 Yes s = *g; return s.i; 1 1 1 1 Yes Any of the above yeses
References access::base, bitmap_bit_p(), build_nonstandard_integer_type(), build_ref_for_offset(), create_access_replacement(), dump_file, dump_flags, access::expr, expr_with_var_bounded_array_refs_p(), access::first_child, access::grp_assignment_read, access::grp_assignment_write, access::grp_covered, access::grp_hint, access::grp_read, access::grp_scalar_read, access::grp_scalar_write, access::grp_to_be_debug_replaced, access::grp_to_be_replaced, access::grp_total_scalarization, access::grp_unscalarizable_region, access::grp_unscalarized_data, access::grp_write, HOST_WIDE_INT, is_gimple_reg_type(), limit, access::next_sibling, access::offset, print_generic_expr(), access::replacement_decl, access::size, and access::type.
Referenced by analyze_access_trees().
|
static |
Analyze all access trees linked by next_grp by the means of analyze_access_subtree.
References analyze_access_subtree(), and access::next_grp.
Referenced by analyze_all_variable_accesses().
|
static |
Analyze the collected accesses and produce a plan what to do with the parameters in the form of adjustments, NULL meaning nothing.
References analyze_caller_dereference_legality(), analyze_modified_params(), decide_one_param_reduction(), dump_file, func_param_count, access::grp_maybe_modified, access::grp_not_necessarilly_dereferenced, access::grp_scalar_ptr, no_accesses_p(), NO_GOOD_ACCESS, splice_all_param_accesses(), sra_stats, turn_representatives_into_adjustments(), and UNMODIF_BY_REF_ACCESSES.
Referenced by ipa_early_sra().
|
static |
Go through all accesses collected throughout the (intraprocedural) analysis stage, exclude overlapping ones, identify representatives and build trees out of them, making decisions about scalarization on the way. Return true iff there are any to-be-scalarized variables after this stage.
References analyze_access_trees(), bitmap_bit_p(), bitmap_copy(), build_access_trees(), candidate(), cfun, completely_scalarize_var(), disqualify_candidate(), dump_access_tree(), dump_file, dump_flags, get_first_repr_for_decl(), optimize_function_for_speed_p(), print_generic_expr(), propagate_all_subaccesses(), sort_and_splice_var_accesses(), statistics_counter_event(), tree_low_cst(), and type_consists_of_records_p().
Referenced by perform_intra_sra().
|
static |
Determine what (parts of) parameters passed by reference that are not assigned to are not certainly dereferenced in this function and thus the dereferencing cannot be safely moved to the caller without potentially introducing a segfault. Mark such REPRESENTATIVES as grp_not_necessarilly_dereferenced. The dereferenced maximum "distance," i.e. the offset + size of the accessed part is calculated rather than simple booleans are calculated for each pointer parameter to handle cases when only a fraction of the whole aggregate is allocated (see testsuite/gcc.c-torture/execute/ipa-sra-2.c for an example). The maximum dereference distances for each pointer parameter and BB are already stored in bb_dereference. This routine simply propagates these values upwards by propagate_dereference_distances and then compares the distances of individual parameters in the ENTRY BB to the equivalent distances of each representative of a (fraction of a) parameter.
References bb_dereferences, dump_dereferences_table(), dump_file, dump_flags, func_param_count, access::grp_not_necessarilly_dereferenced, access::next_grp, no_accesses_p(), access::offset, propagate_dereference_distances(), and access::size.
Referenced by analyze_all_param_acesses().
|
static |
Analyze what representatives (in linked lists accessible from REPRESENTATIVES) can be modified by side effects of statements in the current function.
References ao_ref_init(), access::base, access::expr, func_param_count, gimple_vuse(), access::grp_maybe_modified, mark_maybe_modified(), access::next_grp, access::next_sibling, no_accesses_p(), access::stmt, visited, and walk_aliased_vdefs().
Referenced by analyze_all_param_acesses().
Callback of walk_stmt_load_store_addr_ops visit_addr used to determine GIMPLE_ASM operands with memory constrains which cannot be scalarized.
References disqualify_candidate(), and get_base_address().
Referenced by scan_function().
|
static |
Scan expression EXPR and create access structures for all accesses to candidates for scalarization. Return true if any access has been inserted. STMT must be the statement from which the expression is taken, WRITE must be true if the expression is a store and false otherwise.
References access::base, bitmap_set_bit(), and build_access_from_expr_1().
Referenced by scan_function().
|
staticread |
Scan expression EXPR and create access structures for all accesses to candidates for scalarization. Return the created access or NULL if none is created.
References contains_view_convert_expr_p(), create_access(), disqualify_base_of_expr(), access::grp_partial_lhs, and SRA_MODE_EARLY_IPA.
Referenced by build_access_from_expr(), and build_accesses_from_assign().
|
static |
Build a subtree of accesses rooted in *ACCESS, and move the pointer in the linked list along the way. Stop when *ACCESS is NULL or the access pointed to it is not "within" the root. Return false iff some accesses partially overlap.
References access::first_child, HOST_WIDE_INT, limit, access::next_grp, access::next_sibling, access::offset, and access::size.
Referenced by build_access_trees().
|
static |
Build a tree of access representatives, ACCESS is the pointer to the first one, others are linked in a list by the next_grp field. Return false iff some accesses partially overlap.
References build_access_subtree(), and access::next_grp.
Referenced by analyze_all_variable_accesses().
|
static |
Scan expressions occurring in STMT, create access structures for all accesses to candidates for scalarization and remove those candidates which occur in statements or expressions that prevent them from being split apart. Return true if any access has been inserted.
References add_link_to_rhs(), access::base, bitmap_set_bit(), build_access_from_expr_1(), disqualify_ops_if_throwing_stmt(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_clobber_p(), gimple_has_volatile_ops(), access::grp_assignment_read, access::grp_assignment_write, access::grp_unscalarizable_region, is_gimple_reg_type(), assign_link::lacc, memset(), pool_alloc(), assign_link::racc, access::size, SRA_MODE_EARLY_INTRA, SRA_MODE_INTRA, access::type, and useless_type_conversion_p().
Referenced by scan_function().
|
static |
Attempt to build a memory reference that we could but into a gimple debug_bind statement. Similar to build_ref_for_model but punts if it has to create statements and return s NULL instead. This function also ignores alignment issues and so its results should never end up in non-debug statements.
References build_int_cst(), access::expr, get_addr_base_and_unit_offset(), HOST_WIDE_INT, int_const_binop(), reference_alias_ptr_type(), access::type, and unshare_expr().
Referenced by generate_subtree_copies(), load_assign_lhs_subreplacements(), and sra_modify_assign().
|
static |
Construct a memory reference to a part of an aggregate BASE at the given OFFSET and of the same type as MODEL. In case this is a reference to a bit-field, the function will replicate the last component_ref of model's expr to access it. GSI and INSERT_AFTER have the same meaning as in build_ref_for_offset.
References build_ref_for_offset(), access::expr, int_bit_position(), and access::type.
Referenced by create_artificial_child_access(), generate_subtree_copies(), load_assign_lhs_subreplacements(), propagate_subaccesses_across_link(), sra_modify_assign(), and sra_modify_expr().
tree build_ref_for_offset | ( | location_t | loc, |
tree | base, | ||
HOST_WIDE_INT | offset, | ||
tree | exp_type, | ||
gimple_stmt_iterator * | gsi, | ||
bool | insert_after | ||
) |
Construct a MEM_REF that would reference a part of aggregate BASE of type EXP_TYPE at the given OFFSET. If BASE is something for which get_addr_base_and_unit_offset returns NULL, gsi must be non-NULL and is used to insert new statements either before or below the current one as specified by INSERT_AFTER. This function is not capable of handling bitfields. BASE must be either a declaration or a memory reference that has correct alignment ifformation embeded in it (e.g. a pre-existing one in SRA).
References build_aligned_type(), build_int_cst(), build_pointer_type(), get_addr_base_and_unit_offset(), get_object_alignment_1(), gimple_set_location(), gsi_insert_after(), gsi_insert_before(), GSI_NEW_STMT, GSI_SAME_STMT, HOST_WIDE_INT, int_const_binop(), make_ssa_name(), offset, reference_alias_ptr_type(), and unshare_expr().
Referenced by analyze_access_subtree(), build_ref_for_model(), and ipa_get_jf_ancestor_result().
|
static |
Construct a memory reference consisting of component_refs and array_refs to a part of an aggregate *RES (which is of type TYPE). The requested part should have type EXP_TYPE at be the given OFFSET. This function might not succeed, it returns true when it does and only then *RES points to something meaningful. This function should be used only to build expressions that we might need to present to user (e.g. in warnings). In all other situations, build_ref_for_model or build_ref_for_offset should be used instead.
References bit_position(), build_int_cst(), host_integerp(), HOST_WIDE_INT, int_const_binop(), integer_zerop(), tree_low_cst(), and types_compatible_p().
Referenced by create_artificial_child_access(), and propagate_subaccesses_across_link().
|
inlinestatic |
Return true iff callsite CALL has at least as many actual arguments as there are formal parameters of the function currently processed by IPA-SRA.
References func_param_count, and gimple_call_num_args().
Referenced by not_all_callers_have_enough_arguments_p(), and scan_function().
For a candidate UID return the candidates decl.
References hash_table< Descriptor, Allocator >::find_with_hash().
Referenced by analyze_all_variable_accesses(), pointer_hash< Type >::equal(), get_name_for_bit_test(), and redundant_insn().
|
static |
Return true iff a potential new child of LACC at offset OFFSET and with size SIZE would conflict with an already existing one. If exactly such a child already exists in LACC, store a pointer to it in EXACT_MATCH.
References access::first_child, access::next_sibling, access::offset, and access::size.
Referenced by propagate_subaccesses_across_link().
|
static |
Helper of QSORT function. There are pointers to accesses in the array. An access is considered smaller than another if it has smaller offset or if the offsets are the same but is size is bigger.
References f1, f2, is_gimple_reg_type(), access::offset, access::size, and access::type.
Referenced by sort_and_splice_var_accesses(), and splice_param_accesses().
|
static |
Create total_scalarization accesses for all scalar type fields in DECL that must be of a RECORD_TYPE conforming to type_consists_of_records_p. BASE must be the top-most VAR_DECL representing the variable, OFFSET must be the offset of DECL within BASE. REF must be the memory reference expression for the given decl.
References create_access_1(), access::expr, access::grp_total_scalarization, HOST_WIDE_INT, int_bit_position(), is_gimple_reg_type(), access::size, tree_low_cst(), and access::type.
Referenced by completely_scalarize_var().
|
static |
Create total_scalarization accesses for all scalar type fields in VAR and for VAR a a whole. VAR must be of a RECORD_TYPE conforming to type_consists_of_records_p.
References completely_scalarize_record(), create_access_1(), access::expr, access::grp_total_scalarization, HOST_WIDE_INT, access::size, tree_low_cst(), and access::type.
Referenced by analyze_all_variable_accesses().
|
inlinestatic |
Return true if REF has an VIEW_CONVERT_EXPR or a COMPONENT_REF with a bit-field field declaration somewhere in it.
References handled_component_p().
Referenced by sra_modify_assign().
|
static |
Convert all callers of NODE to pass parameters as given in ADJUSTMENTS.
References cgraph_for_node_and_aliases(), convert_callers_for_node(), symtab_node_base::decl, dump_file, encountered_recursive_call, gimple_call_fndecl(), gimple_call_set_fndecl(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), ipa_modify_call_arguments(), and cgraph_node::symbol.
Referenced by modify_function().
|
static |
Convert all callers of NODE.
References bitmap_set_bit(), cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_edge::caller, cgraph_node::callers, cgraph_node_name(), compute_inline_parameters(), symtab_node_base::decl, dump_file, gimple_in_ssa_p(), ipa_modify_call_arguments(), cgraph_edge::next_caller, symtab_node_base::order, pop_cfun(), push_cfun(), cgraph_node::symbol, and cgraph_node::uid.
Referenced by convert_callers().
|
staticread |
Create and insert access for EXPR. Return created access, or NULL if it is not possible.
References access::base, bitmap_bit_p(), create_access_1(), disqualify_candidate(), access::expr, get_ref_base_and_extent(), get_ssa_base_param(), access::grp_unscalarizable_region, HOST_WIDE_INT, mark_parm_dereference(), access::non_addressable, offset, access::size, SRA_MODE_EARLY_IPA, access::stmt, access::type, and access::write.
Referenced by build_access_from_expr_1().
|
staticread |
Allocate an access structure for BASE, OFFSET and SIZE, clear it, fill in the three fields. Also add it to the vector of accesses corresponding to the base. Finally, return the new access.
References access::base, memset(), access::offset, offset, pointer_map_contains(), pointer_map_insert(), pool_alloc(), access::size, and vec_alloc().
Referenced by completely_scalarize_record(), completely_scalarize_var(), and create_access().
|
static |
Create a variable for the given ACCESS which determines the type, name and a few other properties. Return the variable declaration and store it also to ACCESS->replacement.
References access::base, create_tmp_var(), create_tmp_var_raw(), current_function_decl, debug_expr(), dump_file, access::expr, get_identifier(), access::grp_no_warning, access::grp_partial_lhs, access::grp_to_be_debug_replaced, handled_component_p(), is_gimple_reg_type(), make_fancy_name(), name_obstack, access::offset, print_generic_expr(), access::size, sra_stats, access::type, and unshare_expr_without_location().
Referenced by analyze_access_subtree(), and get_repl_default_def_ssa_name().
|
staticread |
Create a new child access of PARENT, with all properties just like MODEL except for its offset and with its grp_write false and grp_read true. Return the new access or NULL if it cannot be created. Note that this access is created long after all splicing and sorting, it's not located in any access vector and is automatically a representative of its group.
References access::base, build_ref_for_model(), build_user_friendly_ref_for_offset(), access::expr, access::first_child, access::grp_no_warning, access::grp_read, access::grp_unscalarizable_region, access::grp_write, memset(), access::next_sibling, access::offset, pool_alloc(), access::size, and access::type.
Referenced by propagate_subaccesses_across_link().
|
static |
Decide whether parameters with representative accesses given by REPR should be reduced into components.
References access::base, cfun, dump_access(), dump_file, access::grp_maybe_modified, access::grp_not_necessarilly_dereferenced, access::next_grp, access::non_addressable, optimize_function_for_size_p(), print_generic_expr(), access::size, tree_low_cst(), and access::type.
Referenced by analyze_all_param_acesses().
|
static |
Hook fed to pointer_map_traverse, deallocate stored vectors.
References vec_free().
Referenced by sra_deinitialize().
|
static |
Search the given tree for a declaration by skipping handled components and exclude it from the candidates.
References disqualify_candidate(), get_base_address(), get_ssa_base_param(), and SRA_MODE_EARLY_IPA.
Referenced by build_access_from_expr_1(), and disqualify_ops_if_throwing_stmt().
|
static |
Remove DECL from candidates for SRA and write REASON to the dump file if there is one.
References bitmap_clear_bit(), hash_table< Descriptor, Allocator >::clear_slot(), dump_file, dump_flags, hash_table< Descriptor, Allocator >::find_slot_with_hash(), and print_generic_expr().
Referenced by analyze_all_variable_accesses(), asm_visit_addr(), create_access(), and disqualify_base_of_expr().
|
static |
Disqualify LHS and RHS for scalarization if STMT must end its basic block in modes in which it matters, return true iff they have been disqualified. RHS may be NULL, in that case ignore it. If we scalarize an aggregate in intra-SRA we may need to add statements after each statement. This is not possible if a statement unconditionally has to end the basic block.
References disqualify_base_of_expr(), SRA_MODE_EARLY_INTRA, SRA_MODE_INTRA, stmt_can_throw_internal(), and stmt_ends_bb_p().
Referenced by build_accesses_from_assign(), and scan_function().
|
static |
References access::base, access::expr, access::grp_assignment_read, access::grp_assignment_write, access::grp_covered, access::grp_hint, access::grp_maybe_modified, access::grp_not_necessarilly_dereferenced, access::grp_partial_lhs, access::grp_read, access::grp_scalar_read, access::grp_scalar_write, access::grp_to_be_debug_replaced, access::grp_to_be_replaced, access::grp_total_scalarization, access::grp_unscalarizable_region, access::grp_unscalarized_data, access::grp_write, HOST_WIDE_INT_PRINT_DEC, access::offset, print_generic_expr(), access::size, access::type, and access::write.
Referenced by decide_one_param_reduction(), and dump_access_tree_1().
|
static |
Dump all access trees for a variable, given the pointer to the first root in ACCESS.
References dump_access_tree_1(), and access::next_grp.
Referenced by analyze_all_variable_accesses().
|
static |
Dump a subtree rooted in ACCESS to file F, indent by LEVEL.
References dump_access(), dump_file, access::first_child, and access::next_sibling.
Referenced by dump_access_tree().
|
static |
Dump a dereferences TABLE with heading STR to file F.
References bitmap_bit_p(), dump_file, func_param_count, HOST_WIDE_INT_PRINT, and basic_block_def::index.
Referenced by analyze_caller_dereference_legality().
|
static |
Perform early intraprocedural SRA.
References perform_intra_sra(), and SRA_MODE_EARLY_INTRA.
|
static |
Return true if expr contains some ARRAY_REFs into a variable bounded array.
References array_ref_low_bound(), handled_component_p(), and host_integerp().
Referenced by analyze_access_subtree().
|
staticread |
Find an access with required OFFSET and SIZE in a subtree of accesses rooted in ACCESS. Return NULL if it cannot be found.
References access::first_child, access::next_sibling, access::offset, and access::size.
Referenced by get_var_base_offset_size_access(), and load_assign_lhs_subreplacements().
|
static |
Identify candidates for reduction for IPA-SRA based on their type and mark them in candidate_bitmap. Note that these do not necessarily include parameter which are unused and thus can be removed. Return true iff any such candidate has been found.
References bitmap_set_bit(), count, current_function_decl, dump_file, dump_flags, hash_table< Descriptor, Allocator >::find_slot_with_hash(), func_param_count, host_integerp(), is_gimple_reg(), is_gimple_reg_type(), is_unused_scalar_param(), is_va_list_type(), print_generic_expr(), ptr_parm_has_direct_uses(), tree_low_cst(), and type_internals_preclude_sra_p().
Referenced by ipa_early_sra().
|
static |
The very first phase of intraprocedural SRA. It marks in candidate_bitmap those with type which is suitable for scalarization.
References cfun, current_function_decl, and maybe_add_sra_candidate().
Referenced by perform_intra_sra().
|
static |
References dbg_cnt().
|
static |
Generate statements copying scalar replacements of accesses within a subtree into or out of AGG. ACCESS, all its children, siblings and their children are to be processed. AGG is an aggregate type expression (can be a declaration but does not have to be, it can for example also be a mem_ref or a series of handled components). TOP_OFFSET is the offset of the processed subtree which has to be subtracted from offsets of individual accesses to get corresponding offsets for AGG. If CHUNK_SIZE is non-null, copy only replacements in the interval <start_offset, start_offset + chunk_size>, otherwise copy all. GSI is a statement iterator used to place the new statements. WRITE should be true when the statements should write from AGG to the replacement and false if vice versa. if INSERT_AFTER is true, new statements will be added after the current statement in GSI, they will be added before the statement otherwise.
References build_debug_ref_for_model(), build_ref_for_model(), access::expr, access::first_child, force_gimple_operand_gsi(), get_access_replacement(), gimple_set_location(), access::grp_partial_lhs, access::grp_to_be_debug_replaced, access::grp_to_be_replaced, gsi_insert_after(), gsi_insert_before(), GSI_NEW_STMT, GSI_SAME_STMT, gsi_stmt(), access::next_sibling, access::offset, access::size, sra_stats, access::stmt, and update_stmt().
Referenced by handle_unscalarized_data_in_subtree(), initialize_parameter_reductions(), sra_modify_assign(), sra_modify_constructor_assign(), and sra_modify_expr().
|
staticread |
Search for an access representative for the given expression EXPR and return it or NULL if it cannot be found.
References access::base, bitmap_bit_p(), get_ref_base_and_extent(), get_var_base_offset_size_access(), HOST_WIDE_INT, offset, and access::size.
Referenced by sra_modify_assign(), sra_modify_constructor_assign(), and sra_modify_expr().
|
inlinestatic |
Return ACCESS scalar replacement, create it if it does not exist yet.
References access::replacement_decl.
Referenced by generate_subtree_copies(), init_subtree_with_zero(), load_assign_lhs_subreplacements(), sra_modify_assign(), and sra_modify_expr().
|
staticread |
Find the first adjustment for a particular parameter BASE in a vector of ADJUSTMENTS which is not a copy_param. Return NULL if there is no such adjustment.
References ipa_parm_adjustment::base, ipa_parm_adjustment::copy_param, and len.
Referenced by replace_removed_params_ssa_names().
Return a vector of pointers to accesses for the variable given in BASE or NULL if there is none.
References pointer_map_contains().
Referenced by get_first_repr_for_decl(), initialize_parameter_reductions(), sort_and_splice_var_accesses(), splice_param_accesses(), and unmodified_by_ref_scalar_representative().
|
staticread |
Return the first group representative for DECL or NULL if none exists.
References get_base_access_vector().
Referenced by analyze_all_variable_accesses(), and get_var_base_offset_size_access().
|
inlinestatic |
Return the index of BASE in PARMS. Abort if it is not found.
References len.
Referenced by turn_representatives_into_adjustments().
|
static |
Create and return a new suitable default definition SSA_NAME for RACC which is an access describing an uninitialized part of an aggregate that is being loaded.
References cfun, create_access_replacement(), get_or_create_ssa_default_def(), access::grp_to_be_debug_replaced, access::grp_to_be_replaced, and access::replacement_decl.
Referenced by sra_modify_assign().
|
static |
If a parameter replacement identified by ADJ does not yet exist in the form of declaration, create it and record it, otherwise return the previously created one.
References ipa_parm_adjustment::base, create_tmp_reg(), get_identifier(), make_fancy_name(), name_obstack, and ipa_parm_adjustment::new_ssa_base.
Referenced by replace_removed_params_ssa_names().
|
static |
If T is an SSA_NAME, return NULL if it is not a default def or return its base variable if it is. Return T if it is not an SSA_NAME.
Referenced by create_access(), disqualify_base_of_expr(), and sra_ipa_modify_expr().
|
staticread |
Find an access representative for the variable BASE and given OFFSET and SIZE. Requires that access trees have already been built. Return NULL if it cannot be found.
References find_access_in_subtree(), get_first_repr_for_decl(), access::next_grp, access::offset, and access::size.
Referenced by get_access_for_expr().
|
static |
Store all replacements in the access tree rooted in TOP_RACC either to their base aggregate if there are unscalarized data or directly to LHS of the statement that is pointed to by GSI otherwise.
References access::base, access::first_child, generate_subtree_copies(), gimple_assign_lhs(), gimple_location(), access::grp_unscalarized_data, gsi_stmt(), access::offset, SRA_UDH_LEFT, and SRA_UDH_RIGHT.
Referenced by load_assign_lhs_subreplacements(), and sra_modify_assign().
|
static |
Assign zero to all scalar replacements in an access subtree. ACCESS is the the root of the subtree to be processed. GSI is the statement iterator used for inserting statements which are added after the current statement if INSERT_AFTER is true or before it otherwise.
References build_zero_cst(), access::first_child, get_access_replacement(), gimple_set_location(), access::grp_to_be_debug_replaced, access::grp_to_be_replaced, gsi_insert_after(), gsi_insert_before(), GSI_NEW_STMT, GSI_SAME_STMT, gsi_stmt(), access::next_sibling, access::stmt, access::type, and update_stmt().
Referenced by sra_modify_constructor_assign().
|
static |
Generate statements initializing scalar replacements of parts of function parameters.
References bitmap_bit_p(), current_function_decl, generate_subtree_copies(), get_base_access_vector(), gsi_insert_seq_on_edge_immediate(), gsi_seq(), access::next_grp, and single_succ_edge().
Referenced by perform_intra_sra().
|
static |
Perform early interprocedural SRA.
References analyze_all_param_acesses(), bb_dereferences, cfun, cgraph_for_node_and_aliases(), cgraph_get_node(), current_function_decl, dump_file, encountered_apply_args, encountered_unchangable_recursive_call, find_param_candidates(), free(), func_param_count, HOST_WIDE_INT, ipa_dump_param_adjustments(), ipa_sra_preliminary_function_checks(), modify_function(), not_all_callers_have_enough_arguments_p(), scan_function(), sra_deinitialize(), sra_initialize(), SRA_MODE_EARLY_IPA, sra_stats, and statistics_counter_event().
|
static |
Return if early ipa sra shall be performed.
References dbg_cnt().
|
static |
Traverse the function body and all modifications as described in ADJUSTMENTS. Return true iff the CFG has been changed.
References cfg_changed, gimple_asm_input_op(), gimple_asm_ninputs(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_call_arg_ptr(), gimple_call_lhs(), gimple_call_lhs_ptr(), gimple_call_num_args(), gimple_purge_dead_eh_edges(), gimple_return_retval_ptr(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), maybe_clean_eh_stmt(), replace_removed_params_ssa_names(), sra_ipa_modify_assign(), sra_ipa_modify_expr(), and update_stmt().
Referenced by modify_function().
|
static |
Return false the function is apparently unsuitable for IPA-SRA based on it's attributes, return true otherwise. NODE is the cgraph node of the current function.
References cgraph_node::callers, cgraph_local_info::can_change_signature, cfun, cgraph_node_can_be_local_p(), current_function_decl, symtab_node_base::decl, dump_file, cgraph_node::local, function::stdarg, cgraph_node::symbol, and tree_versionable_function_p().
Referenced by ipa_early_sra().
|
static |
Return true iff PARM (which must be a parm_decl) is an unused scalar parameter.
References cfun, has_zero_uses(), is_gimple_reg(), and ssa_default_def().
Referenced by find_param_candidates(), and splice_all_param_accesses().
|
inlinestatic |
Return true iff TYPE is stdarg va_list type.
Referenced by find_param_candidates(), and maybe_add_sra_candidate().
|
static |
Perform "late" intraprocedural SRA.
References perform_intra_sra(), and SRA_MODE_INTRA.
|
static |
Try to generate statements to load all sub-replacements in an access subtree formed by children of LACC from scalar replacements in the TOP_RACC subtree. If that is not possible, refresh the TOP_RACC base aggregate and load the accesses from it. LEFT_OFFSET is the offset of the left whole subtree being copied. NEW_GSI is stmt iterator used for statement insertions after the original assignment, OLD_GSI is used to insert statements before the assignment. *REFRESHED keeps the information whether we have needed to refresh replacements of the LHS and from which side of the assignments this takes place.
References access::base, build_debug_ref_for_model(), build_ref_for_model(), find_access_in_subtree(), access::first_child, force_gimple_operand_gsi(), get_access_replacement(), gimple_location(), gimple_set_location(), access::grp_covered, access::grp_partial_lhs, access::grp_read, access::grp_to_be_debug_replaced, access::grp_to_be_replaced, access::grp_write, gsi_insert_after(), GSI_NEW_STMT, GSI_SAME_STMT, gsi_stmt(), handle_unscalarized_data_in_subtree(), HOST_WIDE_INT, access::next_sibling, access::offset, offset, access::size, sra_stats, SRA_UDH_LEFT, SRA_UDH_NONE, SRA_UDH_RIGHT, access::stmt, access::type, update_stmt(), and useless_type_conversion_p().
Referenced by sra_modify_assign().
|
static |
Append a name of the declaration to the name obstack. A helper function for make_fancy_name.
References buffer, name_obstack, and strlen().
Referenced by make_fancy_name_1().
|
static |
Create a human readable name for replacement variable of ACCESS.
References make_fancy_name_1(), and name_obstack.
Referenced by create_access_replacement(), and get_replaced_param_substitute().
|
static |
Helper for make_fancy_name.
References buffer, HOST_WIDE_INT_PRINT_DEC, integer_zerop(), make_fancy_decl_name(), name_obstack, and strlen().
Referenced by make_fancy_name().
gimple_opt_pass* make_pass_early_ipa_sra | ( | ) |
gimple_opt_pass* make_pass_sra | ( | ) |
gimple_opt_pass* make_pass_sra_early | ( | ) |
Callback of walk_aliased_vdefs, marks the access passed as DATA as maybe_modified.
References access::grp_maybe_modified.
Referenced by analyze_modified_params().
|
static |
Mark a dereference of BASE of distance DIST in a basic block tht STMT belongs to, unless the BB has already been marked as a potentially final.
References access::base, bb_dereferences, bitmap_bit_p(), current_function_decl, func_param_count, gimple_bb(), and basic_block_def::index.
Referenced by create_access().
|
static |
Return true if VAR is a candidate for SRA.
References bitmap_set_bit(), dump_file, dump_flags, hash_table< Descriptor, Allocator >::find_slot_with_hash(), host_integerp(), is_va_list_type(), needs_to_live_in_memory(), print_generic_expr(), reject(), SRA_MODE_EARLY_INTRA, tree_low_cst(), and type_internals_preclude_sra_p().
Referenced by find_var_candidates().
|
static |
Perform all the modification required in IPA-SRA for NODE to have parameters as given in ADJUSTMENTS. Return true iff the CFG has been changed.
References CDI_DOMINATORS, cfg_changed, cgraph_function_versioning(), cgraph_make_node_local(), collect_callers_of_node(), convert_callers(), current_function_decl, symtab_node_base::decl, free_dominance_info(), ipa_modify_formal_parameters(), ipa_sra_modify_function_body(), pop_cfun(), push_cfun(), rebuild_cgraph_edges(), sra_ipa_reset_debug_stmts(), and cgraph_node::symbol.
Referenced by ipa_early_sra().
|
inlinestatic |
Predicate to test the special value.
References no_accesses_representant.
Referenced by analyze_all_param_acesses(), analyze_caller_dereference_legality(), analyze_modified_params(), splice_all_param_accesses(), and turn_representatives_into_adjustments().
|
static |
Return false iff all callers have at least as many actual arguments as there are formal parameters in the current function.
References cgraph_edge::call_stmt, cgraph_node::callers, callsite_has_enough_arguments_p(), and cgraph_edge::next_caller.
Referenced by ipa_early_sra().
|
static |
The "main" function of intraprocedural SRA passes. Runs the analysis and if it reveals there are components of some aggregates to be scalarized, it runs the required transformations.
References analyze_all_variable_accesses(), cfun, find_var_candidates(), initialize_parameter_reductions(), scan_function(), sra_deinitialize(), sra_initialize(), sra_modify_function_body(), sra_stats, and statistics_counter_event().
Referenced by early_intra_sra(), and late_intra_sra().
|
staticread |
Pop an access from the work queue, and return it, assuming there is one.
References access::grp_queued, access::next_queued, and work_queue_head.
Referenced by propagate_all_subaccesses().
|
static |
Propagate all subaccesses across assignment links.
References add_access_to_work_queue(), access::base, bitmap_bit_p(), access::first_link, access::group_representative, assign_link::lacc, assign_link::next, pop_access_from_work_queue(), and propagate_subaccesses_across_link().
Referenced by analyze_all_variable_accesses().
|
static |
Propagate distances in bb_dereferences in the opposite direction than the control flow edges, in each step storing the maximum of the current value and the minimum of all successors. These steps are repeated until the table stabilizes. Note that BBs which might terminate the functions (according to final_bbs bitmap) never updated in this way.
References basic_block_def::aux, bb_dereferences, bitmap_bit_p(), cfun, edge_def::dest, first, func_param_count, HOST_WIDE_INT, basic_block_def::index, basic_block_def::preds, queue, edge_def::src, and basic_block_def::succs.
Referenced by analyze_caller_dereference_legality().
|
static |
Propagate all subaccesses of RACC across an assignment link to LACC. Return true if any new subaccess was created. Additionally, if RACC is a scalar access but LACC is not, change the type of the latter, if possible.
References access::base, build_ref_for_model(), build_user_friendly_ref_for_offset(), child_would_conflict_in_lacc(), create_artificial_child_access(), access::expr, access::first_child, access::grp_hint, access::grp_no_warning, access::grp_read, access::grp_unscalarizable_region, HOST_WIDE_INT, is_gimple_reg_type(), access::next_sibling, access::offset, access::size, and access::type.
Referenced by propagate_all_subaccesses().
|
static |
Scan immediate uses of a default definition SSA name of a parameter PARM and examine whether there are any direct or otherwise infeasible ones. If so, return true, otherwise return false. PARM must be a gimple register with a non-NULL default definition.
References cfun, gimple_assign_rhs1(), gimple_assign_single_p(), gimple_call_arg(), gimple_call_num_args(), gimple_get_lhs(), gimple_has_lhs(), handled_component_p(), integer_zerop(), is_gimple_call(), is_gimple_debug(), ssa_default_def(), types_compatible_p(), and ui.
Referenced by find_param_candidates().
|
static |
Print message to dump file why a variable was rejected.
References dump_file, dump_flags, and print_generic_expr().
Referenced by find_reloads(), maybe_add_sra_candidate(), and process_alt_operands().
|
static |
Move all link structures in their linked list in OLD_RACC to the linked list in NEW_RACC.
References access::first_link, access::last_link, and assign_link::next.
Referenced by sort_and_splice_var_accesses().
|
static |
If the statement STMT defines an SSA_NAME of a parameter which is to be removed because its value is not used, replace the SSA_NAME with a one relating to a created VAR_DECL together all of its uses and return true. ADJUSTMENTS is a pointer to an adjustments vector.
References dump_file, get_adjustment_for_base(), get_replaced_param_substitute(), gimple_assign_lhs(), gimple_assign_set_lhs(), gimple_call_lhs(), gimple_call_set_lhs(), gimple_phi_result(), gimple_phi_set_result(), is_gimple_assign(), is_gimple_call(), make_ssa_name(), print_generic_expr(), release_ssa_name(), and replace_uses_by().
Referenced by ipa_sra_modify_function_body().
|
static |
Scan function and look for interesting expressions and create access structures for them. Return true iff any access is created.
References asm_visit_addr(), bitmap_set_bit(), build_access_from_expr(), build_accesses_from_assign(), BUILT_IN_NORMAL, callsite_has_enough_arguments_p(), cgraph_get_node(), current_function_decl, disqualify_ops_if_throwing_stmt(), encountered_apply_args, encountered_recursive_call, encountered_unchangable_recursive_call, gimple_asm_input_op(), gimple_asm_ninputs(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_call_arg(), gimple_call_flags(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_num_args(), gimple_return_retval(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), basic_block_def::index, SRA_MODE_EARLY_IPA, stmt_can_throw_external(), and walk_stmt_load_store_addr_ops().
Referenced by ipa_early_sra(), and perform_intra_sra().
|
staticread |
Sort all accesses for the given variable, check for partial overlaps and return NULL if there are any. If there are none, pick a representative for each combination of offset and size and create a linked list out of them. Return the pointer to the first representative and make sure it is the first one in the vector of accesses.
References add_access_to_work_queue(), compare_access_positions(), first, access::first_link, get_base_access_vector(), access::group_representative, access::grp_assignment_read, access::grp_assignment_write, access::grp_hint, access::grp_partial_lhs, access::grp_read, access::grp_scalar_read, access::grp_scalar_write, access::grp_total_scalarization, access::grp_unscalarizable_region, access::grp_write, HOST_WIDE_INT, is_gimple_reg_type(), access::next_grp, access::offset, relink_to_new_repr(), access::size, access::type, and access::write.
Referenced by analyze_all_variable_accesses().
|
static |
Identify representatives of all accesses to all candidate parameters for IPA-SRA. Return result based on what representatives have been found.
References bitmap_bit_p(), BY_VAL_ACCESSES, current_function_decl, func_param_count, is_gimple_reg_type(), is_unused_scalar_param(), MODIF_BY_REF_ACCESSES, no_accesses_p(), no_accesses_representant, NO_GOOD_ACCESS, splice_param_accesses(), UNMODIF_BY_REF_ACCESSES, unmodified_by_ref_scalar_representative(), and UNUSED_PARAMS.
Referenced by analyze_all_param_acesses().
|
staticread |
Sort collected accesses for parameter PARM, identify representatives for each accessed region and link them together. Return NULL if there are different but overlapping accesses, return the special ptr value meaning there are no accesses for this parameter if that is the case and return the first representative otherwise. Set *RO_GRP if there is a group of accesses with only read (i.e. no write) accesses.
References access_precludes_ipa_sra_p(), compare_access_positions(), access::expr, get_base_access_vector(), access::group_representative, access::grp_maybe_modified, access::next_grp, access::next_sibling, no_accesses_representant, access::offset, reference_alias_ptr_type(), access::size, tree_low_cst(), access::type, and access::write.
Referenced by splice_all_param_accesses().
|
static |
Deallocate all general structures.
References delete_base_accesses(), hash_table< Descriptor, Allocator >::dispose(), free_alloc_pool(), name_obstack, pointer_map_destroy(), and pointer_map_traverse().
Referenced by ipa_early_sra(), and perform_intra_sra().
|
static |
Allocate necessary structures.
References cfun, hash_table< Descriptor, Allocator >::create(), create_alloc_pool(), encountered_apply_args, encountered_recursive_call, encountered_unchangable_recursive_call, function::local_decls, memset(), name_obstack, pointer_map_create(), sra_stats, and vec_safe_length().
Referenced by ipa_early_sra(), and perform_intra_sra().
|
static |
If the statement pointed to by STMT_PTR contains any expressions that need to replaced with a different one as noted by ADJUSTMENTS, do so. Handle any potential type incompatibilities (GSI is used to accommodate conversion statements and must point to the statement). Return true iff the statement was modified.
References build_constructor(), build_zero_cst(), force_gimple_operand_gsi(), gimple_assign_lhs_ptr(), gimple_assign_rhs1_ptr(), gimple_assign_set_rhs_from_tree(), gimple_assign_single_p(), gimple_location(), GSI_SAME_STMT, is_gimple_reg(), is_gimple_reg_type(), sra_ipa_modify_expr(), and useless_type_conversion_p().
Referenced by ipa_sra_modify_function_body().
|
static |
If the expression *EXPR should be replaced by a reduction of a parameter, do so. ADJUSTMENTS is a pointer to a vector of adjustments. CONVERT specifies whether the function should care about type incompatibility the current and new expressions. If it is false, the function will leave incompatibility issues to the caller. Return true iff the expression was modified.
References ipa_parm_adjustment::base, ipa_parm_adjustment::by_ref, ipa_parm_adjustment::copy_param, dump_file, dump_flags, get_ref_base_and_extent(), get_ssa_base_param(), HOST_WIDE_INT, len, double_int::low, mem_ref_offset(), ipa_parm_adjustment::offset, offset, print_generic_expr(), ipa_parm_adjustment::reduction, ipa_parm_adjustment::remove_param, ipa_parm_adjustment::type, and useless_type_conversion_p().
Referenced by ipa_sra_modify_function_body(), and sra_ipa_modify_assign().
|
static |
Call gimple_debug_bind_reset_value on all debug statements describing gimple register parameters that are being removed or replaced.
References add_local_decl(), ipa_parm_adjustment::base, cfun, copy(), ipa_parm_adjustment::copy_param, current_function_decl, gimple_clobber_p(), gimple_debug_bind_reset_value(), gsi_after_labels(), gsi_for_stmt(), gsi_insert_before(), gsi_remove(), GSI_SAME_STMT, is_gimple_debug(), is_gimple_reg(), len, release_defs(), single_succ(), single_succ_p(), ssa_default_def(), target_for_debug_bind(), ui, unlink_stmt_vdef(), and update_stmt().
Referenced by modify_function().
|
static |
Examine both sides of the assignment statement pointed to by STMT, replace them with a scalare replacement if there is one and generate copying of replacements if scalarized aggregates have been used in the assignment. GSI is used to hold generated statements for type conversions and subtree copying.
References access_has_children_p(), access_has_replacements_p(), access::base, build_debug_ref_for_model(), build_ref_for_model(), contains_bitfld_component_ref_p(), contains_vce_or_bfcref_p(), dump_file, access::first_child, force_gimple_operand_gsi(), generate_subtree_copies(), get_access_for_expr(), get_access_replacement(), get_repl_default_def_ssa_name(), gimple_assign_lhs(), gimple_assign_lhs_ptr(), gimple_assign_rhs1(), gimple_assign_rhs1_ptr(), gimple_assign_set_lhs(), gimple_assign_set_rhs_from_tree(), gimple_assign_single_p(), gimple_has_volatile_ops(), gimple_location(), access::grp_covered, access::grp_partial_lhs, access::grp_read, access::grp_to_be_debug_replaced, access::grp_to_be_replaced, access::grp_unscalarizable_region, access::grp_unscalarized_data, gsi_insert_before(), gsi_next(), gsi_remove(), GSI_SAME_STMT, gsi_stmt(), handle_unscalarized_data_in_subtree(), is_gimple_reg_type(), load_assign_lhs_subreplacements(), access::offset, print_gimple_stmt(), release_defs(), SRA_AM_MODIFIED, SRA_AM_NONE, SRA_AM_REMOVED, sra_modify_constructor_assign(), sra_modify_expr(), sra_stats, SRA_UDH_NONE, SRA_UDH_RIGHT, unlink_stmt_vdef(), unshare_expr(), and useless_type_conversion_p().
Referenced by sra_modify_function_body().
|
static |
Modify assignments with a CONSTRUCTOR on their RHS. STMT contains a pointer to the assignment and GSI is the statement iterator pointing at it. Returns the same values as sra_modify_assign.
References access_has_children_p(), access::base, access::first_child, generate_subtree_copies(), get_access_for_expr(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_clobber_p(), gimple_location(), access::grp_covered, gsi_remove(), init_subtree_with_zero(), release_defs(), SRA_AM_MODIFIED, SRA_AM_NONE, SRA_AM_REMOVED, unlink_stmt_vdef(), and vec_safe_length().
Referenced by sra_modify_assign().
|
static |
Replace the expression EXPR with a scalar replacement if there is one and generate other statements to do type conversion or subtree copying if necessary. GSI is used to place newly created statements, WRITE is true if the expression is being written to (it is on a LHS of a statement or output in an assembly statement).
References access::base, build_ref_for_model(), access::expr, access::first_child, force_gimple_operand_gsi(), generate_subtree_copies(), get_access_for_expr(), get_access_replacement(), gimple_location(), gimple_set_location(), access::grp_partial_lhs, access::grp_to_be_debug_replaced, access::grp_to_be_replaced, gsi_insert_after(), gsi_insert_before(), GSI_NEW_STMT, GSI_SAME_STMT, gsi_stmt(), host_integerp(), HOST_WIDE_INT, access::offset, sra_stats, access::stmt, tree_low_cst(), access::type, type(), and useless_type_conversion_p().
Referenced by sra_modify_assign(), and sra_modify_function_body().
|
static |
Traverse the function body and all modifications as decided in analyze_all_variable_accesses. Return true iff the CFG has been changed.
References cfg_changed, deleted, gimple_asm_input_op(), gimple_asm_ninputs(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_call_arg_ptr(), gimple_call_lhs(), gimple_call_lhs_ptr(), gimple_call_num_args(), gimple_purge_dead_eh_edges(), gimple_return_retval_ptr(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), maybe_clean_eh_stmt(), SRA_AM_MODIFIED, SRA_AM_REMOVED, sra_modify_assign(), sra_modify_expr(), access::stmt, and update_stmt().
Referenced by perform_intra_sra().
|
static |
Convert the decisions made at the representative level into compact parameter adjustments. REPRESENTATIVES are pointers to first representatives of each param accesses, ADJUSTMENTS_COUNT is the expected final number of adjustments.
References ipa_parm_adjustment::alias_ptr_type, access::base, ipa_parm_adjustment::base, ipa_parm_adjustment::base_index, ipa_parm_adjustment::by_ref, ipa_parm_adjustment::copy_param, current_function_decl, access::expr, func_param_count, get_param_index(), access::grp_maybe_modified, access::grp_not_necessarilly_dereferenced, ipa_get_vector_of_formal_parms(), memset(), access::next_grp, no_accesses_p(), access::offset, ipa_parm_adjustment::offset, reference_alias_ptr_type(), ipa_parm_adjustment::remove_param, access::type, and ipa_parm_adjustment::type.
Referenced by analyze_all_param_acesses().
|
static |
Return true iff TYPE is a RECORD_TYPE with fields that are either of gimple register types or (recursively) records with only these two kinds of fields. It also returns false if any of these records contains a bit-field.
References is_gimple_reg_type().
Referenced by analyze_all_variable_accesses().
|
static |
Return true iff the type contains a field or an element which does not allow scalarization.
References bit_position(), host_integerp(), and int_bit_position().
Referenced by find_param_candidates(), and maybe_add_sra_candidate().
|
staticread |
Return the representative access for the parameter declaration PARM if it is a scalar passed by reference which is not written to and the pointer value is not used directly. Thus, if it is legal to dereference it in the caller and we can rule out modifications through aliases, such parameter should be turned into one passed by value. Return NULL otherwise.
References get_base_access_vector(), access::group_representative, access::grp_read, access::grp_scalar_ptr, access::next_sibling, and access::write.
Referenced by splice_all_param_accesses().
|
static |
Alloc pool for allocating access structures.
int aggregate_params_reduced |
|
static |
Base (tree) -> Vector (vec<access_p> *) map.
|
static |
This is a table in which for each basic block and parameter there is a distance (offset + size) in that parameter which is dereferenced and accessed in that BB.
Referenced by analyze_caller_dereference_legality(), ipa_early_sra(), mark_parm_dereference(), and propagate_dereference_distances().
|
static |
Set of candidates.
|
static |
Referenced by duplicate_computed_gotos(), and undistribute_ops_list().
|
static |
int deleted |
int deleted_unused_parameters |
|
static |
scan_function sets the following to true if it encounters a call to __builtin_apply_args.
Referenced by ipa_early_sra(), scan_function(), and sra_initialize().
|
static |
Set by scan_function when it finds a recursive call.
Referenced by convert_callers(), scan_function(), and sra_initialize().
|
static |
Set by scan_function when it finds a recursive call with less actual arguments than formal parameters..
Referenced by ipa_early_sra(), scan_function(), and sra_initialize().
int exprs |
|
static |
Bitmap of BBs that can cause the function to "stop" progressing by returning, throwing externally, looping infinitely or calling a function which might abort etc..
|
static |
Number of parameters of the analyzed function when doing early ipa SRA.
Referenced by analyze_all_param_acesses(), analyze_caller_dereference_legality(), analyze_modified_params(), callsite_has_enough_arguments_p(), dump_dereferences_table(), find_param_candidates(), ipa_early_sra(), mark_parm_dereference(), propagate_dereference_distances(), splice_all_param_accesses(), and turn_representatives_into_adjustments().
|
static |
Alloc pool for allocating assign link structures.
|
static |
Obstack for creation of fancy names.
Referenced by create_access_replacement(), get_replaced_param_substitute(), make_fancy_decl_name(), make_fancy_name(), make_fancy_name_1(), sra_deinitialize(), and sra_initialize().
|
static |
Representative of no accesses at all.
Referenced by no_accesses_p(), splice_all_param_accesses(), and splice_param_accesses().
int param_reductions_created |
int replacements |
Referenced by delete_trivially_dead_insns(), and replace_dead_reg().
int scalar_by_ref_to_by_val |
int separate_lhs_rhs_handling |
|
static |
Bitmap of candidates which we should try to entirely scalarize away and those which cannot be (because they are and need be used as a whole).
Global variable describing which aggregate reduction we are performing at the moment.
struct { ... } sra_stats |
Dump contents of ACCESS to file F in a human friendly way. If GRP is true, representative fields are dumped, otherwise those which only describe the individual access are.
Referenced by analyze_all_param_acesses(), create_access_replacement(), generate_subtree_copies(), ipa_early_sra(), load_assign_lhs_subreplacements(), perform_intra_sra(), sra_initialize(), sra_modify_assign(), and sra_modify_expr().
int subreplacements |
int subtree_copies |
|
static |
Head of a linked list of accesses that need to have its subaccesses propagated to their assignment counterparts.
Referenced by add_access_to_work_queue(), and pop_access_from_work_queue().