GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple-expr.h"
#include "gimple.h"
#include "predict.h"
#include "sreal.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "cgraph.h"
#include "diagnostic.h"
#include "fold-const.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "symbol-summary.h"
#include "tree-vrp.h"
#include "ipa-cp.h"
#include "ipa-prop.h"
#include "tree-pretty-print.h"
#include "tree-inline.h"
#include "ipa-fnsummary.h"
#include "ipa-utils.h"
#include "tree-ssa-ccp.h"
#include "stringpool.h"
#include "attribs.h"
#include "dbgcnt.h"
#include "symtab-clones.h"
#include "gimple-range.h"
Data Structures | |
struct | caller_statistics |
class | value_topo_info< valtype > |
class | ipa_topo_info |
class | edge_clone_summary |
class | edge_clone_summary_t |
struct | gather_other_count_struct |
struct | desc_incoming_count_struct |
struct | symbol_and_index_together |
Macros | |
#define | INCLUDE_ALGORITHM |
Variables | |
object_allocator< ipcp_value< tree > > | ipcp_cst_values_pool ("IPA-CP constant values") |
object_allocator< ipcp_value< ipa_polymorphic_call_context > > | ipcp_poly_ctx_values_pool ("IPA-CP polymorphic contexts") |
object_allocator< ipcp_value_source< tree > > | ipcp_sources_pool ("IPA-CP value sources") |
object_allocator< ipcp_agg_lattice > | ipcp_agg_lattice_pool ("IPA_CP aggregate lattices") |
static profile_count | base_count |
static long | overall_size |
static long | orig_overall_size |
static hash_map< const char *, unsigned > * | clone_num_suffixes |
static call_summary< edge_clone_summary * > * | edge_clone_summaries = NULL |
#define INCLUDE_ALGORITHM |
Interprocedural constant propagation Copyright (C) 2005-2024 Free Software Foundation, Inc. Contributed by Razya Ladelsky <RAZYA@il.ibm.com> and Martin Jambor <mjambor@suse.cz> 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/>.
Interprocedural constant propagation (IPA-CP). The goal of this transformation is to 1) discover functions which are always invoked with some arguments with the same known constant values and modify the functions so that the subsequent optimizations can take advantage of the knowledge, and 2) partial specialization - create specialized versions of functions transformed in this way if some parameters are known constants only in certain contexts but the estimated tradeoff between speedup and cost size is deemed good. The algorithm also propagates types and attempts to perform type based devirtualization. Types are propagated much like constants. The algorithm basically consists of three stages. In the first, functions are analyzed one at a time and jump functions are constructed for all known call-sites. In the second phase, the pass propagates information from the jump functions across the call to reveal what values are available at what call sites, performs estimations of effects of known values on functions and their callees, and finally decides what specialized extra versions should be created. In the third, the special versions materialize and appropriate calls are redirected. The algorithm used is to a certain extent based on "Interprocedural Constant Propagation", by David Callahan, Keith D Cooper, Ken Kennedy, Linda Torczon, Comp86, pg 152-161 and "A Methodology for Procedure Cloning" by Keith D Cooper, Mary W. Hall, and Ken Kennedy. First stage - intraprocedural analysis ======================================= This phase computes jump_function and modification flags. A jump function for a call-site represents the values passed as an actual arguments of a given call-site. In principle, there are three types of values: Pass through - the caller's formal parameter is passed as an actual argument, plus an operation on it can be performed. Constant - a constant is passed as an actual argument. Unknown - neither of the above. All jump function types are described in detail in ipa-prop.h, together with the data structures that represent them and methods of accessing them. ipcp_generate_summary() is the main function of the first stage. Second stage - interprocedural analysis ======================================== This stage is itself divided into two phases. In the first, we propagate known values over the call graph, in the second, we make cloning decisions. It uses a different algorithm than the original Callahan's paper. First, we traverse the functions topologically from callers to callees and, for each strongly connected component (SCC), we propagate constants according to previously computed jump functions. We also record what known values depend on other known values and estimate local effects. Finally, we propagate cumulative information about these effects from dependent values to those on which they depend. Second, we again traverse the call graph in the same topological order and make clones for functions which we know are called with the same values in all contexts and decide about extra specialized clones of functions just for some contexts - these decisions are based on both local estimates and cumulative estimates propagated from callees. ipcp_propagate_stage() and ipcp_decision_stage() together constitute the third stage. Third phase - materialization of clones, call statement updates. ============================================ This stage is currently performed by call graph code (mainly in cgraphunit.cc and tree-inline.cc) according to instructions inserted to the call graph by the second stage.
|
static |
Add all values in lattices associated with NODE to the topological sort if they are not there yet.
References value_topo_info< valtype >::add_val(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_lattice< valtype >::bottom, ipa_topo_info::constants, ipa_topo_info::contexts, count, ipcp_param_lattices::ctxlat, i, ipa_get_param_count(), ipa_get_parm_lattices(), ipa_node_params_sum, ipcp_param_lattices::itself, ipcp_agg_lattice::next, ipcp_value< valtype >::next, and ipcp_lattice< valtype >::values.
Referenced by propagate_constants_topo().
|
static |
Given a NODE, and a set of its CALLERS, try to adjust order of the callers to let a non-self-recursive caller be the first element. Thus, we can simplify intersecting operations on values that arrive from all of these callers, especially when there exists self-recursive call. Return true if this kind of adjustment is possible.
References cgraph_edge::caller, and i.
Referenced by decide_whether_version_node(), and gather_edges_for_value().
|
static |
If caller edge counts of a clone created for a self-recursive arithmetic jump function must be adjusted because it is coming from a the "seed" clone for the first value and so has been excessively scaled back as if it was not a recursive call, adjust it so that the incoming counts of NODE match its count. NODE is the node or its thunk.
References adjust_clone_incoming_counts(), cgraph_edge::caller, cgraph_node::callers, profile_count::combine_with_ipa_count(), hash_set< KeyId, Lazy, Traits >::contains(), desc_incoming_count_struct::count, dump_file, profile_count::ipa(), cgraph_edge::next_caller, desc_incoming_count_struct::orig, desc_incoming_count_struct::processed_edges, and profile_count::zero().
Referenced by adjust_clone_incoming_counts(), and update_counts_for_self_gen_clones().
|
static |
At INDEX of a function being called by CS there is an ADDR_EXPR of a variable which is only dereferenced and which is represented by SYMBOL. See if we can remove ADDR reference in callers assosiated witht the call.
References adjust_refs_in_act_callers(), cgraph_node::call_for_symbol_thunks_and_aliases(), cgraph_edge::call_stmt, cgraph_edge::caller, cgraph_node::can_change_signature, symtab_node::create_reference(), dump_file, dump_flags, symtab_node::dump_name(), symtab_node::find_reference(), gcc_assert, symtab_node::get(), get_base_address(), symbol_and_index_together::index, ipa_edge_args_sum, ipa_get_controlled_uses(), ipa_get_ith_jump_func(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_jf_pass_through_refdesc_decremented(), ipa_get_param_load_dereferenced(), ipa_get_scalar_lat(), IPA_JF_CONST, IPA_JF_PASS_THROUGH, ipa_node_params_sum, IPA_REF_ADDR, IPA_REF_LOAD, ipa_set_controlled_uses(), ipa_set_jf_pass_through_refdesc_decremented(), IPA_UNDESCRIBED_USE, ipa_zap_jf_refdesc(), ipa_node_params::ipcp_orig_node, ipcp_lattice< valtype >::is_single_const(), ipa_node_params::known_csts, cgraph_edge::lto_stmt_uid, NULL, ipa_ref::remove_reference(), symbol_and_index_together::symbol, TDF_DETAILS, TREE_CODE, TREE_OPERAND, ipa_jump_func::type, and ipcp_lattice< valtype >::values.
Referenced by adjust_refs_in_act_callers(), and create_specialized_node().
|
static |
Worker callback of call_for_symbol_thunks_and_aliases to recursively call adjust_references_in_caller on edges up in the call-graph, if necessary.
References adjust_references_in_caller(), cgraph_node::callers, symbol_and_index_together::index, cgraph_edge::next_caller, and symbol_and_index_together::symbol.
Referenced by adjust_references_in_caller().
|
static |
Determine whether there is anything to propagate FROM SRC_PLATS through a pass-through JFUNC and if so, whether it has conform and conforms to the rules about propagating values passed by reference.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_by_ref, and ipa_get_jf_pass_through_agg_preserved().
Referenced by propagate_aggs_across_jump_function().
|
static |
Allocate a new ipcp_value holding a polymorphic context, initialize its value to SOURCE and clear all other fields.
References ipcp_poly_ctx_values_pool, ipcp_value< valtype >::self_recursion_generated_level, and ipcp_value< valtype >::value.
|
static |
Allocate a new ipcp_value holding a tree constant, initialize its value to SOURCE and clear all other fields.
References ipcp_cst_values_pool, ipcp_value< valtype >::self_recursion_generated_level, and ipcp_value< valtype >::value.
Referenced by ipcp_lattice< valtype >::add_value().
|
static |
Go over edges calling NODE and its thunks and gather information about incoming counts so that we know if we need to make any adjustments.
References analyze_clone_icoming_counts(), cgraph_node::callers, hash_set< KeyId, Lazy, Traits >::contains(), desc_incoming_count_struct::count, profile_count::ipa(), cgraph_edge::next_caller, desc_incoming_count_struct::orig, desc_incoming_count_struct::processed_edges, and desc_incoming_count_struct::unproc_orig_rec_edges.
Referenced by analyze_clone_icoming_counts(), and update_counts_for_self_gen_clones().
|
static |
Allocate the arrays in TOPO and topologically sort the nodes into order.
References symbol_table::cgraph_count, gcc_checking_assert, ignore_edge_p(), ipa_reduced_postorder(), ipa_topo_info::nnodes, ipa_topo_info::order, ipa_topo_info::stack, ipa_topo_info::stack_top, and symtab.
Referenced by ipcp_driver().
|
static |
Return true if on the way cfrom CS->caller to the final (non-alias and non-thunk) destination, the call passes through a thunk.
References symtab_node::alias, cgraph_edge::callee, cgraph_node::get_alias_target(), and cgraph_node::thunk.
Referenced by find_more_scalar_values_for_callers_subset(), and propagate_constants_across_call().
|
static |
Return true is CS calls DEST or its clone for all contexts. When ALLOW_RECURSION_TO_CLONE is false, also return false for self-recursive edges from/to an all-context clone.
References AVAIL_INTERPOSABLE, cgraph_edge::callee, cgraph_edge::caller, cgraph_node::function_symbol(), ipa_node_params_sum, ipa_node_params::ipcp_orig_node, and ipa_node_params::is_all_contexts_clone.
Referenced by cgraph_edge_brings_value_p(), and cgraph_edge_brings_value_p().
|
static |
Determine whether CS also brings all aggregate values that NODE is specialized for.
References gcc_checking_assert, ipa_node_params_sum, ipcp_get_transformation_summary(), ipa_node_params::ipcp_orig_node, ipcp_transformation::m_agg_values, push_agg_values_from_edge(), ipa_argagg_value_list::superset_of_p(), and vec_safe_is_empty().
Referenced by perhaps_add_new_callers().
|
static |
Determine whether CS also brings all scalar values that the NODE is specialized for.
References cgraph_edge::caller, count, i, ipa_edge_args_sum, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_get_type(), ipa_node_params_sum, ipa_value_from_jfunc(), ipa_node_params::known_csts, and values_equal_for_ipcp_p().
Referenced by perhaps_add_new_callers().
|
static |
Return true if edge CS does bring about the value described by SRC to DST_VAL of node DEST or its clone for all contexts.
References cgraph_edge::caller, calls_same_node_or_its_all_contexts_clone_p(), ipcp_param_lattices::ctxlat, ipcp_value_source< valtype >::index, ipa_get_parm_lattices(), ipa_node_params_sum, ipa_node_params::ipcp_orig_node, ipcp_lattice< valtype >::is_single_const(), ipa_node_params::known_contexts, ipa_node_params::node_dead, ipcp_value_source< valtype >::val, ipcp_value< valtype >::value, ipcp_lattice< valtype >::values, and values_equal_for_ipcp_p().
|
static |
Return true if edge CS does bring about the value described by SRC to DEST_VAL of node DEST or its clone for all contexts.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, cgraph_edge::caller, calls_same_node_or_its_all_contexts_clone_p(), ipa_argagg_value_list::get_value(), ipcp_value_source< valtype >::index, ipa_get_parm_lattices(), ipa_node_params_sum, ipcp_get_transformation_summary(), ipa_node_params::ipcp_orig_node, ipcp_lattice< valtype >::is_single_const(), ipcp_param_lattices::itself, ipa_node_params::known_csts, ipcp_agg_lattice::next, ipa_node_params::node_dead, NULL_TREE, ipcp_agg_lattice::offset, ipcp_value_source< valtype >::offset, ipcp_value_source< valtype >::val, ipcp_value< valtype >::value, ipcp_lattice< valtype >::values, and values_equal_for_ipcp_p().
Referenced by gather_edges_for_value(), get_info_about_necessary_edges(), and perhaps_add_new_callers().
|
static |
Return true if NODE should be cloned just for a parameter removal, possibly dumping a reason if not.
References cgraph_node::can_be_local_p(), cgraph_node::can_change_signature, dump_file, dump_flags, and TDF_DETAILS.
Referenced by estimate_local_effects().
|
static |
Callback for qsort to sort counts of all edges.
Referenced by ipcp_propagate_stage().
|
static |
Helper function to qsort a vector of ipa_uid_to_idx_map_elt elements according to the uid.
References a, b, gcc_unreachable, and ipa_uid_to_idx_map_elt::uid.
Referenced by ipcp_transformation::maybe_create_parm_idx_map().
|
static |
Copy known scalar values from AVALS into KNOWN_CSTS. Similarly, copy contexts to KNOWN_CONTEXTS and modify the copy according to VAL and INDEX.
References ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, and ipcp_value< valtype >::value.
|
static |
Copy known scalar values from AVALS into KNOWN_CSTS and modify the copy according to VAL and INDEX. If non-empty, replace KNOWN_CONTEXTS with its copy too.
References copy_useful_known_contexts(), ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, and ipcp_value< valtype >::value.
Referenced by decide_about_value().
|
static |
Return a copy of KNOWN_CSTS if it is not empty, otherwise return vNULL.
References known_contexts_useful_p(), and vNULL.
Referenced by copy_known_vectors_add_val(), decide_about_value(), and decide_whether_version_node().
|
static |
Worker of call_for_symbol_thunks_and_aliases, increment the integer DATA points to by the number of callers to NODE.
References cgraph_node::callers, and cgraph_edge::next_caller.
Referenced by initialize_node_lattices().
|
static |
Create a specialized version of NODE with known constants in KNOWN_CSTS, known contexts in KNOWN_CONTEXTS and known aggregate values in AGGVALS and redirect all edges in CALLERS to it.
References adjust_references_in_caller(), ipa_adjusted_param::base_index, cgraph_edge::caller, cgraph_node::callers, cgraph_node::can_change_signature, clone_num_suffixes, count, cgraph_node::create_virtual_clone(), symtab_node::decl, DECL_ASSEMBLER_NAME, ipa_argagg_value_list::dump(), dump_file, dump_flags, symtab_node::dump_name(), cgraph_node::expand_all_artificial_thunks(), gcc_assert, gcc_checking_assert, clone_info::get(), symtab_node::get(), get_base_address(), get_next_cgraph_edge_clone(), get_replacement_map(), ggc_alloc(), i, IDENTIFIER_POINTER, ipa_get_controlled_uses(), ipa_get_param_count(), ipa_get_param_load_dereferenced(), ipa_is_param_used(), ipa_node_params_sum, IPA_PARAM_OP_COPY, ipa_set_node_agg_value_chain(), cgraph_node::ipcp_clone, ipcp_discover_new_direct_edges(), ipa_node_params::ipcp_orig_node, ipa_node_params::known_contexts, ipa_node_params::known_csts, ipa_param_adjustments::m_adj_params, ipa_param_adjustments::m_always_copy_start, ipa_param_adjustments::m_skip_return, symtab_node::maybe_create_reference(), NULL, ipa_adjusted_param::op, clone_info::param_adjustments, ipa_adjusted_param::prev_clone_adjustment, ipa_adjusted_param::prev_clone_index, cgraph_edge::redirect_callee_duplicating_thunks(), TDF_DETAILS, TREE_CODE, clone_info::tree_map, TREE_OPERAND, vec_safe_copy(), vec_safe_length(), vec_safe_push(), and want_remove_some_param_p().
Referenced by decide_about_value(), and decide_whether_version_node().
|
static |
Decide whether to create a special version of NODE for value VAL of parameter at the given INDEX. If OFFSET is -1, the value is for the parameter itself, otherwise it is stored at the given OFFSET of the parameter. AVALS describes the other already known values. SELF_GEN_CLONES is a vector which contains clones created for self-recursive calls with an arithmetic pass-through jump function.
References copy_known_vectors_add_val(), copy_useful_known_contexts(), cgraph_node::count, create_specialized_node(), dbg_cnt(), dump_file, dump_flags, symtab_node::dump_name(), find_aggregate_values_for_callers_subset(), find_more_contexts_for_caller_subset(), find_more_scalar_values_for_callers_subset(), gather_edges_for_value(), gcc_checking_assert, get_info_about_necessary_edges(), get_max_overall_size(), good_cloning_opportunity_p(), HOST_WIDE_INT_PRINT_DEC, profile_count::ipa(), ipa_dump_param(), ipa_node_params_sum, ipcp_val_agg_replacement_ok_p(), ipcp_value_base::local_size_cost, ipcp_value_base::local_time_benefit, ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, profile_count::nonzero_p(), offset, overall_size, perhaps_add_new_callers(), print_ipcp_constant_value(), ipcp_value_base::prop_size_cost, ipcp_value_base::prop_time_benefit, ipcp_value< valtype >::self_recursion_generated_p(), ipcp_value< valtype >::spec_node, TDF_DETAILS, update_profiling_info(), ipcp_value< valtype >::value, and profile_count::zero().
Referenced by decide_whether_version_node().
|
static |
Decide whether and what specialized clones of NODE should be created.
References adjust_callers_for_value_intersection(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, ipcp_lattice< valtype >::bottom, ipcp_vr_lattice::bottom_p(), cgraph_edge::caller, cgraph_node::callers, cgraph_node::collect_callers(), copy_useful_known_contexts(), count, create_specialized_node(), ipcp_param_lattices::ctxlat, dbg_cnt(), decide_about_value(), ipa_node_params::do_clone_for_all_contexts, dump_file, dump_flags, symtab_node::dump_name(), find_aggregate_values_for_callers_subset(), find_more_contexts_for_caller_subset(), find_more_scalar_values_for_callers_subset(), gather_context_independent_values(), i, ipa_get_param_count(), ipa_get_parm_lattices(), ipa_is_param_used(), ipa_node_params_sum, ipa_range_contains_p(), ipcp_lattice< valtype >::is_single_const(), ipcp_param_lattices::itself, known_contexts_useful_p(), ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, ipcp_param_lattices::m_value_range, ipcp_vr_lattice::m_vr, ipcp_agg_lattice::next, ipcp_value< valtype >::next, ipa_node_params::node_dead, NULL, ipcp_agg_lattice::offset, print_ipcp_constant_value(), ipcp_value< valtype >::self_recursion_generated_p(), TDF_DETAILS, TREE_CODE, update_counts_for_self_gen_clones(), ipcp_value< valtype >::value, ipcp_lattice< valtype >::values, and vNULL.
Referenced by ipcp_decision_stage().
|
static |
Determine whether it is at all technically possible to create clones of NODE and store this information in the ipa_node_params structure associated with NODE.
References symtab_node::alias, AVAIL_INTERPOSABLE, BUILT_IN_NORMAL, cgraph_node::callees, cgraph_node::calls_comdat_local, symtab_node::comdat_local_p(), symtab_node::decl, DECL_ATTRIBUTES, DECL_EXTERNAL, DECL_FUNCTION_CODE(), dump_file, symtab_node::dump_name(), fndecl_built_in_p(), cgraph_node::get_availability(), lookup_attribute(), cgraph_edge::next_callee, NULL, opt_for_fn, cgraph_node::thunk, cgraph_node::versionable, and ipa_node_params::versionable.
Referenced by ipcp_propagate_stage().
|
static |
Calculate devirtualization time bonus for NODE, assuming we know information about arguments stored in AVALS.
References AVAIL_AVAILABLE, symtab_node::decl, DECL_DECLARED_INLINE_P, symtab_node::definition, cgraph_node::function_symbol(), cgraph_node::get(), cgraph_node::indirect_calls, ipa_fn_summary::inlinable, ipa_fn_summaries, ipa_get_indirect_edge_target_1(), ipa_size_summaries, ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, cgraph_edge::next_callee, and opt_for_fn.
Referenced by estimate_local_effects(), and perform_estimation_of_a_value().
|
static |
Dump new profiling counts of NODE. SPEC is true when NODE is a specialzied one, otherwise it will be referred to as the original node.
References cgraph_node::callees, cgraph_node::count, profile_count::dump(), dump_file, symtab_node::dump_name(), and cgraph_edge::next_callee.
Referenced by update_counts_for_self_gen_clones(), update_profiling_info(), and update_specialized_profile().
|
static |
Iterate over known values of parameters of NODE and estimate the local effects in terms of time and size they have.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, ipcp_lattice< valtype >::bottom, cgraph_node::call_for_symbol_thunks_and_aliases(), clone_for_param_removal_p(), count, ipcp_param_lattices::ctxlat, devirtualization_time_bonus(), ipa_node_params::do_clone_for_all_contexts, dump_file, dump_flags, symtab_node::dump_name(), estimate_ipcp_clone_size_and_time(), estimate_move_cost(), gather_caller_stats(), gather_context_independent_values(), gcc_checking_assert, get_max_overall_size(), good_cloning_opportunity_p(), hint_time_bonus(), HOST_WIDE_INT_PRINT_DEC, i, init_caller_stats(), ipa_dump_param(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_node_params_sum, ipcp_versionable_function_p(), ipcp_param_lattices::itself, ipcp_value_base::local_size_cost, ipcp_value_base::local_time_benefit, ipa_auto_call_arg_values::m_known_aggs, ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, ipcp_agg_lattice::next, ipcp_value< valtype >::next, NULL_TREE, overall_size, perform_estimation_of_a_value(), print_ipcp_constant_value(), TDF_DETAILS, sreal::to_double(), TREE_CODE, TREE_TYPE, ipcp_value< valtype >::value, ipcp_lattice< valtype >::values, and ipcp_param_lattices::virt_call.
Referenced by propagate_constants_topo().
|
static |
Look at edges in CALLERS and collect all known aggregate values that arrive from all of them. Return nullptr if there are none.
References gcc_checking_assert, i, intersect_argaggs_with(), ipa_node_params_sum, ipa_node_params::ipcp_orig_node, last, NULL, push_agg_values_from_edge(), and vec_safe_reserve_exact().
Referenced by decide_about_value(), and decide_whether_version_node().
|
static |
Given a NODE and a subset of its CALLERS, try to populate plank slots in KNOWN_CONTEXTS with polymorphic contexts that are also known for all of the CALLERS.
References cgraph_edge::caller, count, dump_file, dump_flags, FOR_EACH_VEC_ELT, i, ipa_context_from_jfunc(), ipa_dump_param(), ipa_edge_args_sum, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_get_poly_ctx_lat(), ipa_node_params_sum, ipa_polymorphic_call_context::meet_with(), print_ipcp_constant_value(), TDF_DETAILS, and ipa_polymorphic_call_context::useless_p().
Referenced by decide_about_value(), and decide_whether_version_node().
|
static |
Given a NODE, and a subset of its CALLERS, try to populate blanks slots in KNOWN_CSTS with constants that are also known for all of the CALLERS.
References call_passes_through_thunk(), cgraph_edge::caller, count, dump_file, dump_flags, FOR_EACH_VEC_ELT, gcc_assert, i, ipa_dump_param(), ipa_edge_args_sum, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_jf_arith_result(), ipa_get_jf_pass_through_operand(), ipa_get_jf_pass_through_operation(), ipa_get_param_count(), ipa_get_scalar_lat(), ipa_get_type(), ipa_node_params_sum, ipa_value_from_jfunc(), NULL_TREE, print_ipcp_constant_value(), self_recursive_pass_through_p(), TDF_DETAILS, and values_equal_for_ipcp_p().
Referenced by decide_about_value(), and decide_whether_version_node().
|
static |
Free information about strongly connected components and the arrays in TOPO.
References free(), ipa_free_postorder_info(), ipa_topo_info::order, and ipa_topo_info::stack.
Referenced by ipcp_driver().
|
static |
Worker callback of cgraph_for_node_and_aliases accumulating statistics of non-thunk incoming edges to NODE.
References cgraph_edge::caller, cgraph_node::callers, cgraph_edge::count, profile_count::initialized_p(), profile_count::ipa(), ipa_node_params_sum, cgraph_edge::maybe_hot_p(), cgraph_edge::next_caller, ipa_node_params::node_dead, cgraph_edge::sreal_frequency(), and cgraph_node::thunk.
Referenced by estimate_local_effects(), ipcp_cloning_candidate_p(), and update_profiling_info().
|
static |
Grow vectors in AVALS and fill them with information about values of parameters that are known to be independent of the context. Only calculate m_known_aggs if CALCULATE_AGGS is true. INFO describes the function. If REMOVABLE_PARAMS_COST is non-NULL, the movement cost of all removable parameters will be stored in it. TODO: Also grow context independent value range vectors.
References count, ipcp_param_lattices::ctxlat, estimate_move_cost(), gcc_checking_assert, i, ipa_get_param_count(), ipa_get_param_move_cost(), ipa_get_parm_lattices(), ipa_is_param_used(), ipcp_lattice< valtype >::is_single_const(), ipcp_param_lattices::itself, ipa_auto_call_arg_values::m_known_aggs, ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, push_agg_values_from_plats(), TREE_CODE, TREE_TYPE, ipcp_value< valtype >::value, and ipcp_lattice< valtype >::values.
Referenced by decide_whether_version_node(), and estimate_local_effects().
|
static |
Worker callback of call_for_symbol_thunks_and_aliases summing the number of counts that come from non-self-recursive calls..
References cgraph_node::callers, cgraph_node::clone_of, profile_count::ipa(), cgraph_edge::next_caller, gather_other_count_struct::orig, and gather_other_count_struct::other_count.
Referenced by update_counts_for_self_gen_clones().
|
static |
Return a vector of incoming edges that do bring value VAL to node DEST. It is assumed their number is known and equal to CALLER_COUNT.
References adjust_callers_for_value_intersection(), cgraph_edge_brings_value_p(), ipcp_value_source< valtype >::cs, get_next_cgraph_edge_clone(), ipcp_value_source< valtype >::next, and ipcp_value< valtype >::sources.
Referenced by decide_about_value().
|
static |
Given VAL that is intended for DEST, iterate over all its sources and if any of them is viable and hot, return true. In that case, for those that still hold, add their edge frequency and their number and cumulative profile counts of self-ecursive and other edges into *FREQUENCY, *CALLER_COUNT, REC_COUNT_SUM and NONREC_COUNT_SUM respectively.
References cgraph_edge::caller, cgraph_node::callers, cgraph_edge_brings_value_p(), cgraph_edge::count, count, ipcp_value_source< valtype >::cs, get_next_cgraph_edge_clone(), profile_count::initialized_p(), profile_count::ipa(), ipa_node_params_sum, cgraph_edge::maybe_hot_p(), ipcp_value_source< valtype >::next, cgraph_edge::next_caller, ipcp_value< valtype >::sources, cgraph_edge::sreal_frequency(), and profile_count::zero().
Referenced by decide_about_value().
|
static |
Get the overall limit oof growth based on parameters extracted from growth. it does not really make sense to mix functions with different overall growth limits but it is possible and if it happens, we do not want to select one limit at random.
References symtab_node::decl, opt_for_fn, and orig_overall_size.
Referenced by decide_about_value(), and estimate_local_effects().
|
inlinestatic |
Get the next clone in the linked list of clones of an edge.
References edge_clone_summaries, edge_clone_summary::next_clone, and NULL.
Referenced by create_specialized_node(), gather_edges_for_value(), get_info_about_necessary_edges(), perhaps_add_new_callers(), and update_counts_for_self_gen_clones().
|
static |
Construct a replacement map for a know VALUE for a formal parameter PARAM. Return it or NULL if for some reason it cannot be created. FORCE_LOAD_REF should be set to true when the reference created for the constant should be a load one and not an address one because the corresponding parameter p is only used as *p.
References dump_file, ipa_replace_map::force_load_ref, ggc_alloc(), ipa_dump_param(), ipa_replace_map::new_tree, ipa_replace_map::parm_num, and print_generic_expr().
Referenced by create_specialized_node().
|
static |
A helper function that returns result of operation specified by OPCODE on the value of SRC_VAL. If non-NULL, OPND1_TYPE is expected type for the value of SRC_VAL. If the operation is binary, OPND2 is a constant value acting as its second operand. If non-NULL, RES_TYPE is expected type of the result.
References ipa_get_jf_arith_result(), NULL_TREE, TREE_TYPE, useless_type_conversion_p(), and ipcp_value< valtype >::value.
Referenced by propagate_vals_across_arith_jfunc().
|
static |
Return true if cloning NODE is a good idea, given the estimated TIME_BENEFIT and SIZE_COST and with the sum of frequencies of incoming edges to the potential new clone in FREQUENCIES.
References base_count, symtab_node::decl, profile_count::dump(), dump_file, dump_flags, gcc_assert, incorporate_penalties(), ipa_node_params_sum, ipa_node_params::node_calling_single_call, ipa_node_params::node_is_self_scc, ipa_node_params::node_within_scc, profile_count::nonzero_p(), opt_for_fn, cgraph_node::optimize_for_size_p(), profile_count::probability_in(), TDF_DETAILS, sreal::to_double(), sreal::to_int(), and profile_probability::to_sreal().
Referenced by decide_about_value(), and estimate_local_effects().
|
static |
Return true if NODE has a caller from outside of its SCC that is not dead. Worker callback for cgraph_for_node_and_aliases.
References cgraph_node::call_for_symbol_thunks_and_aliases(), cgraph_edge::caller, cgraph_node::callers, has_undead_caller_from_outside_scc_p(), ipa_edge_within_scc(), ipa_node_params_sum, cgraph_edge::next_caller, ipa_node_params::node_dead, NULL, and cgraph_node::thunk.
Referenced by has_undead_caller_from_outside_scc_p(), and identify_dead_nodes().
|
static |
Return time bonus incurred because of hints stored in ESTIMATES.
References symtab_node::decl, ipa_call_estimates::hints, INLINE_HINT_loop_iterations, INLINE_HINT_loop_stride, ipa_call_estimates::loops_with_known_iterations, ipa_call_estimates::loops_with_known_strides, and opt_for_fn.
Referenced by estimate_local_effects(), and perform_estimation_of_a_value().
|
static |
Identify nodes within the same SCC as NODE which are no longer needed because of new clones and will be removed as unreachable.
References symtab_node::aux, cgraph_node::call_for_symbol_thunks_and_aliases(), dump_file, dump_flags, symtab_node::dump_name(), has_undead_caller_from_outside_scc_p(), ipa_node_params_sum, cgraph_node::local, ipa_node_params::node_dead, NULL, spread_undeadness(), and TDF_DETAILS.
Referenced by ipcp_decision_stage().
|
static |
Skip edges from and to nodes without ipa_cp enabled. Ignore not available symbols.
References AVAIL_INTERPOSABLE, cgraph_edge::callee, cgraph_edge::caller, symtab_node::decl, cgraph_node::function_or_virtual_thunk_symbol(), and opt_for_fn.
Referenced by build_toporder_info().
|
inlinestatic |
If there is a reason to penalize the function described by INFO in the cloning goodness evaluation, do so.
References symtab_node::decl, ipa_node_params::node_calling_single_call, ipa_node_params::node_is_self_scc, ipa_node_params::node_within_scc, and opt_for_fn.
Referenced by good_cloning_opportunity_p().
|
inlinestatic |
Initialize fields of STAT to zeroes and optionally set it up so that edges from IGNORED_CALLER are not counted.
References profile_count::zero().
Referenced by estimate_local_effects(), ipcp_cloning_candidate_p(), and update_profiling_info().
|
static |
Initialize ipcp_lattices.
References symtab_node::alias, ipcp_param_lattices::bits_lattice, cgraph_node::call_for_symbol_thunks_and_aliases(), count_callers(), ipcp_param_lattices::ctxlat, dump_file, dump_flags, symtab_node::dump_name(), gcc_assert, gcc_checking_assert, clone_info::get(), ipa_param_adjustments::get_surviving_params(), cgraph_node::has_gimple_body_p(), i, cgraph_node::indirect_calls, cgraph_edge::indirect_info, ipcp_vr_lattice::init(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_get_type(), ipa_node_params_sum, ipcp_cloning_candidate_p(), ipcp_versionable_function_p(), ipcp_param_lattices::itself, cgraph_node::local, ipa_param_adjustments::m_always_copy_start, ipcp_param_lattices::m_value_range, cgraph_edge::next_callee, NULL, clone_info::param_adjustments, cgraph_indirect_call_info::param_index, cgraph_indirect_call_info::polymorphic, set_agg_lats_to_bottom(), set_all_contains_variable(), set_single_call_flag(), ipcp_bits_lattice::set_to_bottom(), ipcp_lattice< valtype >::set_to_bottom(), ipcp_vr_lattice::set_to_bottom(), TDF_DETAILS, cgraph_node::thunk, and ipcp_param_lattices::virt_call.
Referenced by ipcp_propagate_stage().
|
static |
Turn all values in LIST that are not present in OTHER into NULL_TREEs. Return the number of remaining valid entries.
References i, NULL_TREE, and values_equal_for_ipcp_p().
Referenced by find_aggregate_values_for_callers_subset().
tree ipa_agg_value_from_jfunc | ( | ipa_node_params * | info, |
cgraph_node * | node, | ||
const ipa_agg_jf_item * | item ) |
Determine whether ITEM, jump function for an aggregate part, evaluates to a single known constant value and if so, return it. Otherwise return NULL. NODE and INFO describes the caller node or the one it is inlined to, and its related info.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, ipa_load_agg_data::by_ref, ipa_agg_jf_item::jump_func_agg_value::constant, ipa_pass_through_data::formal_id, gcc_checking_assert, ipa_argagg_value_list::get_value(), ipa_get_jf_arith_result(), ipa_get_parm_lattices(), IPA_JF_CONST, IPA_JF_LOAD_AGG, IPA_JF_PASS_THROUGH, IPA_JF_UNKNOWN, ipcp_get_transformation_summary(), ipa_node_params::ipcp_orig_node, ipcp_lattice< valtype >::is_single_const(), ipcp_param_lattices::itself, ipa_agg_jf_item::jftype, ipa_node_params::known_csts, ipa_node_params::lattices, ipa_agg_jf_item::jump_func_agg_value::load_agg, ipcp_agg_lattice::next, NULL_TREE, ipa_agg_jf_item::offset, ipa_load_agg_data::offset, ipcp_agg_lattice::offset, ipa_pass_through_data::operand, ipa_pass_through_data::operation, ipa_agg_jf_item::jump_func_agg_value::pass_through, TREE_TYPE, ipa_agg_jf_item::type, ipa_load_agg_data::type, UINT_MAX, useless_type_conversion_p(), ipa_agg_jf_item::value, ipcp_value< valtype >::value, and ipcp_lattice< valtype >::values.
Referenced by ipa_find_agg_cst_from_jfunc_items(), ipa_push_agg_values_from_jfunc(), and push_agg_values_for_index_from_edge().
ipa_polymorphic_call_context ipa_context_from_jfunc | ( | ipa_node_params * | info, |
cgraph_edge * | cs, | ||
int | csidx, | ||
ipa_jump_func * | jfunc ) |
Determine whether JFUNC evaluates to single known polymorphic context, given that INFO describes the caller node or the one it is inlined to, CS is the call graph edge corresponding to JFUNC and CSIDX index of the described parameter.
References ipa_polymorphic_call_context::combine_with(), cgraph_edge::in_polymorphic_cdtor, ipa_edge_args_sum, ipa_get_ith_polymorhic_call_context(), ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_offset(), ipa_get_jf_ancestor_type_preserved(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_jf_pass_through_type_preserved(), ipa_get_param_count(), ipa_get_poly_ctx_lat(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params::ipcp_orig_node, ipcp_lattice< valtype >::is_single_const(), ipa_node_params::known_contexts, ipa_node_params::lattices, NULL, ipa_polymorphic_call_context::offset_by(), ipa_polymorphic_call_context::possible_dynamic_type_change(), ipa_jump_func::type, ipa_polymorphic_call_context::useless_p(), and ipcp_lattice< valtype >::values.
Referenced by evaluate_properties_for_edge(), find_more_contexts_for_caller_subset(), and update_indirect_edges_after_inlining().
void ipa_cp_cc_finalize | ( | void | ) |
Reset all state within ipa-cp.cc so that we can rerun the compiler within the same process. For use by toplev::finalize.
References base_count, ipcp_free_transformation_sum(), orig_overall_size, overall_size, and profile_count::uninitialized().
Referenced by toplev::finalize().
tree ipa_get_indirect_edge_target | ( | struct cgraph_edge * | ie, |
ipa_call_arg_values * | avals, | ||
bool * | speculative ) |
If an indirect edge IE can be turned into a direct one based on data in AVALS, return the destination. Store into *SPECULATIVE a boolean determinig whether the discovered target is only speculative guess.
References ipa_get_indirect_edge_target_1(), ipa_call_arg_values::m_known_contexts, and ipa_call_arg_values::m_known_vals.
Referenced by estimate_edge_devirt_benefit().
|
static |
If an indirect edge IE can be turned into a direct one based on KNOWN_VALS KNOWN_CONTEXTS, and known aggregates either in AVS or KNOWN_AGGS return the destination. The latter three can be NULL. If AGG_REPS is not NULL, KNOWN_AGGS is ignored.
References cgraph_indirect_call_info::agg_contents, cgraph_indirect_call_info::by_ref, cgraph_edge::caller, ipa_polymorphic_call_context::combine_with(), symtab_node::decl, fndecl_built_in_p(), gcc_assert, gcc_checking_assert, cgraph_node::get(), ipa_argagg_value_list::get_value(), gimple_get_virt_method_for_vtable(), cgraph_indirect_call_info::guaranteed_unmodified, cgraph_edge::in_polymorphic_cdtor, cgraph_edge::indirect_info, ipa_find_agg_cst_from_init(), ipa_impossible_devirt_target(), cgraph_edge::maybe_hot_p(), NULL, NULL_TREE, cgraph_indirect_call_info::offset, offset, ipa_polymorphic_call_context::offset_by(), opt_for_fn, cgraph_indirect_call_info::otr_token, cgraph_indirect_call_info::otr_type, cgraph_indirect_call_info::param_index, cgraph_indirect_call_info::polymorphic, ipa_polymorphic_call_context::possible_dynamic_type_change(), possible_polymorphic_call_target_p(), possible_polymorphic_call_targets(), cgraph_edge::speculative, TREE_CODE, TREE_OPERAND, try_speculative_devirtualization(), ipa_polymorphic_call_context::useless_p(), cgraph_indirect_call_info::vptr_changed, and vtable_pointer_value_to_vtable().
Referenced by devirtualization_time_bonus(), ipa_get_indirect_edge_target(), and ipcp_discover_new_direct_edges().
|
static |
Return the result of an ancestor jump function JFUNC on the constant value INPUT. Return NULL_TREE if that cannot be determined.
References build1(), build_int_cst(), fold_build2, gcc_checking_assert, ipa_get_jf_ancestor_keep_null(), ipa_get_jf_ancestor_offset(), is_gimple_ip_invariant_address(), known_eq, NULL_TREE, ptr_type_node, TREE_CODE, TREE_TYPE, and zerop().
Referenced by ipa_value_from_jfunc(), and propagate_vals_across_ancestor().
|
static |
Return the result of a (possibly arithmetic) operation on the constant value INPUT. OPERAND is 2nd operand for binary operation. RES_TYPE is the type of the parameter to which the result is passed. Return NULL_TREE if that cannot be determined or be considered an interprocedural invariant.
References boolean_type_node, expr_type_first_operand_type_p(), fold_binary, fold_unary, is_gimple_ip_invariant(), NULL_TREE, tcc_comparison, tcc_unary, TREE_CODE_CLASS, TREE_TYPE, and values_equal_for_ipcp_p().
Referenced by find_more_scalar_values_for_callers_subset(), get_val_across_arith_op(), ipa_agg_value_from_jfunc(), ipa_get_jf_pass_through_result(), and push_agg_values_for_index_from_edge().
|
static |
Return the result of a (possibly arithmetic) pass through jump function JFUNC on the constant value INPUT. RES_TYPE is the type of the parameter to which the result is passed. Return NULL_TREE if that cannot be determined or be considered an interprocedural invariant.
References ipa_get_jf_arith_result(), ipa_get_jf_pass_through_operand(), and ipa_get_jf_pass_through_operation().
Referenced by ipa_value_from_jfunc().
|
inlinestatic |
Return the param lattices structure corresponding to the Ith formal parameter of the function described by INFO.
References gcc_assert, gcc_checking_assert, i, ipa_get_param_count(), ipa_node_params::ipcp_orig_node, and ipa_node_params::lattices.
Referenced by add_all_node_vals_to_toposort(), cgraph_edge_brings_value_p(), cgraph_edge_brings_value_p(), decide_whether_version_node(), estimate_local_effects(), gather_context_independent_values(), initialize_node_lattices(), ipa_agg_value_from_jfunc(), ipa_get_poly_ctx_lat(), ipa_get_scalar_lat(), ipcp_store_vr_results(), print_all_lattices(), propagate_aggregate_lattice(), propagate_aggs_across_jump_function(), propagate_bits_across_jump_function(), propagate_constants_across_call(), propagate_vr_across_jump_function(), push_agg_values_for_index_from_edge(), and push_agg_values_from_edge().
|
inlinestatic |
Return the lattice corresponding to the scalar value of the Ith formal parameter of the function described by INFO.
References ipcp_param_lattices::ctxlat, i, and ipa_get_parm_lattices().
Referenced by find_more_contexts_for_caller_subset(), ipa_context_from_jfunc(), and propagate_context_across_jump_function().
|
inlinestatic |
Return the lattice corresponding to the scalar value of the Ith formal parameter of the function described by INFO.
References i, ipa_get_parm_lattices(), and ipcp_param_lattices::itself.
Referenced by adjust_references_in_caller(), find_more_scalar_values_for_callers_subset(), ipa_value_from_jfunc(), ipcp_verify_propagated_values(), and propagate_scalar_across_jump_function().
void ipa_push_agg_values_from_jfunc | ( | ipa_node_params * | info, |
cgraph_node * | node, | ||
ipa_agg_jump_function * | agg_jfunc, | ||
unsigned | dst_index, | ||
vec< ipa_argagg_value > * | res ) |
Process all items in AGG_JFUNC relative to caller (or the node the original caller is inlined to) NODE which described by INFO and push the results to RES as describing values passed in parameter DST_INDEX.
References ipa_agg_jump_function::by_ref, ipa_argagg_value::by_ref, gcc_assert, ipa_argagg_value::index, ipa_agg_value_from_jfunc(), ipa_agg_jump_function::items, ipa_argagg_value::killed, ipa_agg_jf_item::offset, ipa_argagg_value::unit_offset, and ipa_argagg_value::value.
Referenced by evaluate_properties_for_edge().
Like irange::contains_p(), but convert VAL to the range of R if necessary.
References wi::fits_to_tree_p(), fold_convert, r, and wi::to_wide().
Referenced by decide_whether_version_node().
tree ipa_value_from_jfunc | ( | class ipa_node_params * | info, |
struct ipa_jump_func * | jfunc, | ||
tree | parm_type ) |
Determine whether JFUNC evaluates to a single known constant value and if so, return it. Otherwise return NULL. INFO describes the caller node or the one it is inlined to, so that pass-through jump functions can be evaluated. PARM_TYPE is the type of the parameter to which the result is passed.
References ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_result(), ipa_get_jf_constant(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_result(), ipa_get_param_count(), ipa_get_scalar_lat(), IPA_JF_ANCESTOR, IPA_JF_CONST, IPA_JF_PASS_THROUGH, ipa_node_params::ipcp_orig_node, ipcp_lattice< valtype >::is_single_const(), ipa_node_params::known_csts, ipa_node_params::lattices, NULL_TREE, ipa_jump_func::type, and ipcp_lattice< valtype >::values.
Referenced by cgraph_edge_brings_all_scalars_for_node(), evaluate_properties_for_edge(), find_more_scalar_values_for_callers_subset(), and try_make_edge_direct_simple_call().
void ipa_value_range_from_jfunc | ( | vrange & | vr, |
ipa_node_params * | info, | ||
cgraph_edge * | cs, | ||
ipa_jump_func * | jfunc, | ||
tree | parm_type ) |
Determine range of JFUNC given that INFO describes the caller node or the one it is inlined to, CS is the call graph edge corresponding to JFUNC and PARM_TYPE of the parameter.
References cgraph_edge::caller, cgraph_node::inlined_to, ipa_get_jf_pass_through_formal_id(), ipa_get_type(), IPA_JF_PASS_THROUGH, ipa_vr_intersect_with_arith_jfunc(), ipa_vr_operation_and_type_effects(), ipcp_get_transformation_summary(), ipa_vr::known_p(), ipa_jump_func::m_vr, ipcp_transformation::m_vr, vrange::set_varying(), vrange::singleton_p(), ipa_jump_func::type, and ipa_vr::type().
Referenced by evaluate_properties_for_edge().
|
static |
Given a PASS_THROUGH jump function JFUNC that takes as its source SRC_VR of SRC_TYPE and the result needs to be DST_TYPE, if any value range information can be deduced at all, intersect VR with it.
References boolean_type_node, range_op_handler::fold_range(), vrange::intersect(), ipa_get_jf_pass_through_operand(), ipa_get_jf_pass_through_operation(), ipa_range_set_and_normalize(), ipa_vr_operation_and_type_effects(), ipa_vr_supported_type_p(), range_op_handler::operand_check_p(), tcc_comparison, tcc_unary, TREE_CODE_CLASS, TREE_TYPE, value_range::type(), value_range::undefined_p(), and value_range::varying_p().
Referenced by ipa_value_range_from_jfunc(), and propagate_vr_across_jump_function().
|
static |
Same as above, but the SRC_VR argument is an IPA_VR which must first be extracted onto a vrange.
References ipa_vr::get_vrange(), and ipa_vr_operation_and_type_effects().
|
static |
Emulate effects of unary OPERATION and/or conversion from SRC_TYPE to DST_TYPE on value range in SRC_VR and store it to DST_VR. Return true if the result is a range that is not VARYING nor UNDEFINED.
References range_op_handler::fold_range(), ipa_vr_supported_type_p(), range_op_handler::operand_check_p(), value_range::set_varying(), vrange::undefined_p(), and vrange::varying_p().
Referenced by ipa_value_range_from_jfunc(), ipa_vr_intersect_with_arith_jfunc(), ipa_vr_operation_and_type_effects(), and propagate_vr_across_jump_function().
Return true if VALUE can be safely IPA-CP propagated to a parameter of type PARAM_TYPE.
References fold_convertible_p(), TREE_TYPE, and useless_type_conversion_p().
Referenced by propagate_scalar_across_jump_function(), propagate_vals_across_ancestor(), and propagate_vals_across_arith_jfunc().
|
static |
Return true if this NODE is viable candidate for cloning.
References profile_count::apply_scale(), cgraph_node::call_for_symbol_thunks_and_aliases(), cgraph_node::count, symtab_node::decl, dump_file, symtab_node::dump_name(), gather_caller_stats(), gcc_checking_assert, cgraph_node::has_gimple_body_p(), init_caller_stats(), profile_count::initialized_p(), profile_count::ipa(), ipa_size_summaries, opt_for_fn, cgraph_node::optimize_for_size_p(), and profile_count::zero().
Referenced by initialize_node_lattices().
|
static |
The decision stage. Iterate over the topological order of call graph nodes TOPO and make specialized clones if deemed beneficial.
References symtab_node::aux, decide_whether_version_node(), dump_file, cgraph_node::has_gimple_body_p(), i, identify_dead_nodes(), ipcp_versionable_function_p(), ipa_topo_info::nnodes, and ipa_topo_info::order.
Referenced by ipcp_driver().
|
static |
Discover newly direct outgoing edges from NODE which is a new clone with known KNOWN_CSTS and make them direct.
References cgraph_indirect_call_info::agg_contents, cgraph_edge::callee, dump_file, dump_flags, symtab_node::find_reference(), cgraph_node::indirect_calls, cgraph_edge::indirect_info, ipa_get_controlled_uses(), ipa_get_indirect_edge_target_1(), ipa_get_param_load_dereferenced(), ipa_make_edge_direct_to_target(), ipa_node_params_sum, IPA_REF_ADDR, ipa_set_controlled_uses(), IPA_UNDESCRIBED_USE, ipa_update_overall_fn_summary(), cgraph_edge::next_callee, NULL, cgraph_indirect_call_info::param_index, cgraph_indirect_call_info::polymorphic, ipa_ref::remove_reference(), cgraph_edge::speculative, and TDF_DETAILS.
Referenced by create_specialized_node().
|
static |
The IPCP driver.
References build_toporder_info(), clone_num_suffixes, dump_file, dump_flags, edge_clone_summaries, free_toporder_info(), ipa_check_create_edge_args(), ipa_check_create_node_params(), ipa_free_all_structures_after_ipa_cp(), ipa_print_all_jump_functions(), ipa_print_all_params(), ipcp_decision_stage(), ipcp_propagate_stage(), ipcp_store_vr_results(), NULL, symtab, and TDF_DETAILS.
|
static |
Initialization and computation of IPCP data structures. This is the initial intraprocedural analysis of functions, which gathers information to be propagated later on.
References dump_file, FOR_EACH_FUNCTION_WITH_GIMPLE_BODY, ipa_analyze_node(), and ipa_register_cgraph_hooks().
|
static |
Propagate constants, polymorphic contexts and their effects from the summaries interprocedurally.
References symtab_node::alias, base_count, cgraph_node::callees, compare_edge_profile_counts(), ipa_topo_info::constants, ipa_topo_info::contexts, cgraph_node::count, count, symtab_node::decl, symtab_node::definition, determine_versionability(), profile_count::dump(), dump_file, dump_flags, symbol_table::edges_count, FOR_EACH_DEFINED_FUNCTION, cgraph_node::function_or_virtual_thunk_symbol(), gcc_assert, cgraph_node::has_gimple_body_p(), initialize_node_lattices(), profile_count::initialized_p(), profile_count::ipa(), ipa_get_param_count(), ipa_node_params_sum, ipa_size_summaries, ipcp_verify_propagated_values(), ipa_node_params::lattices, MAX, cgraph_edge::next_callee, NULL, opt_for_fn, orig_overall_size, overall_size, print_all_lattices(), propagate_constants_topo(), value_topo_info< valtype >::propagate_effects(), ipa_size_summary::self_size, symtab, TDF_DETAILS, profile_count::uninitialized(), and ipa_node_params::versionable.
Referenced by ipcp_driver().
|
static |
Look up all VR and bits information that we have discovered and copy it over to the transformation summary.
References ipcp_param_lattices::bits_lattice, ipcp_vr_lattice::bottom_p(), ipcp_bits_lattice::constant_p(), count, dbg_cnt(), symtab_node::decl, dump_file, symtab_node::dump_name(), FOR_EACH_FUNCTION_WITH_GIMPLE_BODY, wide_int_storage::from(), ipcp_bits_lattice::get_mask(), ipcp_bits_lattice::get_value(), i, ipa_get_param_count(), ipa_get_parm_lattices(), ipa_get_type(), ipa_node_params_sum, ipa_node_params::ipcp_orig_node, ipcp_transformation_initialize(), ipcp_transformation_sum, ipa_node_params::lattices, ipcp_param_lattices::m_value_range, ipcp_transformation::m_vr, ipcp_vr_lattice::m_vr, NULL, opt_for_fn, print_hex(), value_range::set_varying(), ipcp_vr_lattice::top_p(), TYPE_PRECISION, TYPE_SIGN, value_range::update_bitmask(), and vec_safe_reserve_exact().
Referenced by ipcp_driver().
DEBUG_FUNCTION bool ipcp_val_agg_replacement_ok_p | ( | vec< ipa_argagg_value, va_gc > * | , |
int | , | ||
HOST_WIDE_INT | offset, | ||
ipa_polymorphic_call_context | ) |
Return true if offset is minus one because source of a polymorphic context cannot be an aggregate value.
References offset.
DEBUG_FUNCTION bool ipcp_val_agg_replacement_ok_p | ( | vec< ipa_argagg_value, va_gc > * | aggvals, |
int | index, | ||
HOST_WIDE_INT | offset, | ||
tree | value ) |
Return true if OFFSET indicates this was not an aggregate value or there is a replacement equivalent to VALUE, INDEX and OFFSET among those in the AGGVALS list.
References ipa_argagg_value_list::get_value(), offset, and values_equal_for_ipcp_p().
Referenced by decide_about_value().
DEBUG_FUNCTION void ipcp_verify_propagated_values | ( | void | ) |
If checking is enabled, verify that no lattice is in the TOP state, i.e. not bottom, not containing a variable component and without any known value at the same time.
References ipcp_lattice< valtype >::bottom, ipcp_lattice< valtype >::contains_variable, count, symtab_node::decl, symbol_table::dump(), dump_file, FOR_EACH_FUNCTION_WITH_GIMPLE_BODY, gcc_unreachable, i, ipa_get_param_count(), ipa_get_scalar_lat(), ipa_node_params_sum, opt_for_fn, print_all_lattices(), symtab, and ipcp_lattice< valtype >::values_count.
Referenced by ipcp_propagate_stage().
|
static |
Return true if it is at all technically possible to create clones of a NODE.
References ipa_node_params_sum, and ipa_node_params::versionable.
Referenced by estimate_local_effects(), initialize_node_lattices(), ipcp_decision_stage(), propagate_aggregate_lattice(), propagate_context_across_jump_function(), and propagate_scalar_across_jump_function().
|
static |
Return true if KNOWN_CONTEXTS contain at least one useful context.
References FOR_EACH_VEC_ELT, i, and ipa_polymorphic_call_context::useless_p().
Referenced by copy_useful_known_contexts(), and decide_whether_version_node().
profile_count lenient_count_portion_handling | ( | profile_count | remainder, |
cgraph_node * | orig_node ) |
With partial train run we do not want to assume that original's count is zero whenever we redurect all executed edges to clone. Simply drop profile to local one in this case. In eany case, return the new value. ORIG_NODE is the original node and its count has not been updaed yet.
References cgraph_node::count, symtab_node::decl, profile_count::guessed_local(), profile_count::ipa(), profile_count::ipa_p(), profile_count::nonzero_p(), and opt_for_fn.
Referenced by update_counts_for_self_gen_clones(), update_profiling_info(), and update_specialized_profile().
ipa_opt_pass_d * make_pass_ipa_cp | ( | gcc::context * | ctxt | ) |
|
static |
Walk aggregate lattices in DEST_PLATS from ***AGLAT on, until ***aglat is an already existing lattice for the given OFFSET and SIZE, marking all skipped lattices as containing variable and checking for overlaps. If there is no already existing lattice for the OFFSET and VAL_SIZE, create one, initialize it with offset, size and contains_variable to PRE_EXISTING, and return true, unless there are too many already. If there are two many, return false. If there are overlaps turn whole DEST_PLATS to bottom and return false. If any skipped lattices were newly marked as containing variable, set *CHANGE to true. MAX_AGG_ITEMS is the maximum number of lattices.
References ipcp_param_lattices::aggs_count, ipcp_lattice< valtype >::contains_variable, gcc_assert, gcc_checking_assert, ipcp_agg_lattice_pool, ipcp_agg_lattice::next, ipcp_agg_lattice::offset, offset, set_agg_lats_to_bottom(), and ipcp_agg_lattice::size.
Referenced by merge_aggregate_lattices(), and propagate_aggs_across_jump_function().
|
static |
Merge existing aggregate lattices in SRC_PLATS to DEST_PLATS, subtracting DELTA_OFFSET. CS is the call graph edge and SRC_IDX the index of the source parameter used for lattice value sources. Return true if DEST_PLATS changed in any way.
References ipcp_lattice< valtype >::add_value(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, cgraph_edge::callee, symtab_node::decl, cgraph_node::function_symbol(), merge_agg_lats_step(), ipcp_agg_lattice::next, ipcp_value< valtype >::next, NULL, opt_for_fn, set_agg_lats_contain_variable(), set_chain_of_aglats_contains_variable(), set_check_aggs_by_ref(), and ipcp_lattice< valtype >::set_contains_variable().
Referenced by propagate_aggs_across_jump_function().
|
static |
Perform time and size measurement of NODE with the context given in AVALS, calculate the benefit compared to the node without specialization and store it into VAL. Take into account REMOVABLE_PARAMS_COST of all context-independent or unused removable parameters and EST_MOVE_COST, the estimated movement of the considered parameter.
References symtab_node::decl, DECL_DECLARED_INLINE_P, DECL_EXTERNAL, devirtualization_time_bonus(), estimate_ipcp_clone_size_and_time(), gcc_checking_assert, hint_time_bonus(), ipcp_value_base::local_size_cost, ipcp_value_base::local_time_benefit, ipa_call_estimates::nonspecialized_time, ipa_call_estimates::size, and ipa_call_estimates::time.
Referenced by estimate_local_effects().
|
static |
Given an original NODE and a VAL for which we have already created a specialized clone, look whether there are incoming edges that still lead into the old node but now also bring the requested value and also conform to all other criteria such that they can be redirected the special node. This function can therefore redirect the final edge in a SCC.
References cgraph_edge::caller, cgraph_edge_brings_all_agg_vals_for_node(), cgraph_edge_brings_all_scalars_for_node(), cgraph_edge_brings_value_p(), cgraph_edge::count, ipcp_value_source< valtype >::cs, dump_file, symtab_node::dump_name(), cgraph_node::expand_all_artificial_thunks(), get_next_cgraph_edge_clone(), profile_count::initialized_p(), profile_count::ipa(), ipcp_value_source< valtype >::next, profile_count::nonzero_p(), cgraph_edge::redirect_callee_duplicating_thunks(), ipcp_value< valtype >::sources, ipcp_value< valtype >::spec_node, update_specialized_profile(), and profile_count::zero().
Referenced by decide_about_value().
|
static |
Pop a node from the stack in TOPO and return it or return NULL if the stack is empty.
References ipa_node_params_sum, NULL, ipa_topo_info::stack, and ipa_topo_info::stack_top.
Referenced by propagate_constants_topo().
Print all ipcp_lattices of all functions to F.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, ipcp_param_lattices::bits_lattice, count, ipcp_param_lattices::ctxlat, symtab_node::dump_name(), FOR_EACH_FUNCTION_WITH_GIMPLE_BODY, HOST_WIDE_INT_PRINT_DEC, i, ipa_get_param_count(), ipa_get_parm_lattices(), ipa_node_params_sum, ipa_node_params::ipcp_orig_node, ipcp_param_lattices::itself, ipcp_param_lattices::m_value_range, ipcp_agg_lattice::next, ipcp_agg_lattice::offset, ipcp_bits_lattice::print(), ipcp_lattice< valtype >::print(), ipcp_vr_lattice::print(), and ipcp_param_lattices::virt_call.
Referenced by ipcp_propagate_stage(), and ipcp_verify_propagated_values().
|
static |
Print V which is extracted from a value in a lattice to F. This overloaded function is used to print constant polymorphic call contexts.
References ipa_polymorphic_call_context::dump().
|
static |
Print V which is extracted from a value in a lattice to F. This overloaded function is used to print tree constants.
References ipa_print_constant_value().
Referenced by decide_about_value(), decide_whether_version_node(), estimate_local_effects(), find_more_contexts_for_caller_subset(), find_more_scalar_values_for_callers_subset(), and ipcp_lattice< valtype >::print().
|
static |
Propagate values through ITEM, jump function for a part of an aggregate, into corresponding aggregate lattice AGLAT. CS is the call graph edge associated with the jump function. Return true if AGLAT changed in any way.
References ipcp_lattice< valtype >::add_value(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_by_ref, ipcp_lattice< valtype >::bottom, ipa_load_agg_data::by_ref, cgraph_edge::caller, ipa_agg_jf_item::jump_func_agg_value::constant, ipcp_lattice< valtype >::contains_variable, ipa_pass_through_data::formal_id, gcc_checking_assert, ipa_get_parm_lattices(), IPA_JF_CONST, IPA_JF_LOAD_AGG, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipcp_versionable_function_p(), is_gimple_ip_invariant(), ipcp_lattice< valtype >::is_single_const(), ipcp_param_lattices::itself, ipa_agg_jf_item::jftype, ipa_agg_jf_item::jump_func_agg_value::load_agg, ipcp_agg_lattice::next, NULL, NULL_TREE, ipa_load_agg_data::offset, ipcp_agg_lattice::offset, ipa_pass_through_data::operand, ipa_pass_through_data::operation, ipa_agg_jf_item::jump_func_agg_value::pass_through, propagate_vals_across_arith_jfunc(), ipcp_lattice< valtype >::set_contains_variable(), ipcp_agg_lattice::size, tree_to_shwi(), ipa_agg_jf_item::type, ipa_load_agg_data::type, TYPE_SIZE, and ipa_agg_jf_item::value.
Referenced by propagate_aggs_across_jump_function().
|
static |
Propagate scalar values across jump function JFUNC that is associated with edge CS and put the values into DEST_LAT.
References ipa_jump_func::agg, agg_pass_through_permissible_p(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipa_agg_jump_function::by_ref, cgraph_edge::callee, cgraph_edge::caller, symtab_node::decl, FOR_EACH_VEC_ELT, cgraph_node::function_symbol(), gcc_assert, i, ipa_get_jf_ancestor_agg_preserved(), ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_offset(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_parm_lattices(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, IPA_JF_UNKNOWN, ipa_node_params_sum, ipa_agg_jump_function::items, ipa_agg_jf_item::jftype, merge_agg_lats_step(), merge_aggregate_lattices(), ipcp_agg_lattice::next, NULL, ipa_agg_jf_item::offset, opt_for_fn, propagate_aggregate_lattice(), set_agg_lats_contain_variable(), set_agg_lats_to_bottom(), set_chain_of_aglats_contains_variable(), set_check_aggs_by_ref(), tree_to_shwi(), ipa_agg_jf_item::type, ipa_jump_func::type, and TYPE_SIZE.
Referenced by propagate_constants_across_call().
bool propagate_bits_across_jump_function | ( | cgraph_edge * | cs, |
int | idx, | ||
ipa_jump_func * | jfunc, | ||
ipcp_bits_lattice * | dest_lattice ) |
Propagate bits across jfunc that is associated with edge cs and update dest_lattice accordingly.
References ipcp_param_lattices::bits_lattice, ipcp_bits_lattice::bottom_p(), build_int_cstu(), cgraph_edge::callee, cgraph_edge::caller, dump_file, dump_flags, symtab_node::dump_name(), cgraph_node::function_symbol(), value_range::get_bitmask(), ipa_vr::get_vrange(), INTEGRAL_TYPE_P, ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_keep_null(), ipa_get_jf_ancestor_offset(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operand(), ipa_get_jf_pass_through_operation(), ipa_get_parm_lattices(), ipa_get_type(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipcp_bits_lattice::known_nonzero_p(), ipa_jump_func::m_vr, irange_bitmask::mask(), ipcp_bits_lattice::meet_with(), NULL_TREE, offset, POINTER_TYPE_P, ipcp_bits_lattice::set_to_bottom(), size_type_node, TDF_DETAILS, ipa_jump_func::type, TYPE_PRECISION, TYPE_SIGN, value_range::undefined_p(), irange_bitmask::value(), and value_range::varying_p().
Referenced by propagate_constants_across_call().
|
static |
Propagate constants from the caller to the callee of CS. INFO describes the caller.
References AVAIL_INTERPOSABLE, ipcp_param_lattices::bits_lattice, call_passes_through_thunk(), cgraph_edge::callee, cgraph_edge::caller, ipcp_param_lattices::ctxlat, symtab_node::decl, symtab_node::definition, cgraph_node::function_symbol(), gcc_checking_assert, cgraph_node::has_gimple_body_p(), i, ipa_edge_args_sum, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_get_type(), ipa_node_params_sum, ipcp_param_lattices::itself, ipcp_param_lattices::m_value_range, opt_for_fn, propagate_aggs_across_jump_function(), propagate_bits_across_jump_function(), propagate_context_across_jump_function(), propagate_scalar_across_jump_function(), propagate_vr_across_jump_function(), set_all_contains_variable(), and ipcp_vr_lattice::set_to_bottom().
Referenced by propagate_constants_topo().
|
static |
One pass of constants propagation along the call graph edges, from callers to callees (requires topological ordering in TOPO), iterate over strongly connected components.
References add_all_node_vals_to_toposort(), cgraph_edge::callee, cgraph_node::callees, symtab_node::decl, estimate_local_effects(), FOR_EACH_VEC_ELT, cgraph_node::function_symbol(), cgraph_node::has_gimple_body_p(), i, ipa_edge_within_scc(), ipa_get_nodes_in_cycle(), ipa_node_params_sum, cgraph_edge::next_callee, ipa_topo_info::nnodes, ipa_node_params::node_is_self_scc, ipa_node_params::node_within_scc, NULL, opt_for_fn, ipa_topo_info::order, pop_node_from_stack(), propagate_constants_across_call(), and push_node_to_stack().
Referenced by ipcp_propagate_stage().
|
static |
Propagate scalar values across jump function JFUNC that is associated with edge CS and describes argument IDX and put the values into DEST_LAT.
References ipcp_lattice< valtype >::add_value(), ipcp_lattice< valtype >::bottom, cgraph_edge::caller, ipa_polymorphic_call_context::combine_with(), ipcp_lattice< valtype >::contains_variable, ipa_polymorphic_call_context::equal_to(), cgraph_edge::in_polymorphic_cdtor, ipa_edge_args_sum, ipa_get_ith_polymorhic_call_context(), ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_offset(), ipa_get_jf_ancestor_type_preserved(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_jf_pass_through_type_preserved(), ipa_get_poly_ctx_lat(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipcp_versionable_function_p(), ipcp_value< valtype >::next, ipa_polymorphic_call_context::offset_by(), ipa_polymorphic_call_context::possible_dynamic_type_change(), ipcp_lattice< valtype >::set_contains_variable(), ipa_jump_func::type, ipa_polymorphic_call_context::useless_p(), ipcp_value< valtype >::value, ipcp_lattice< valtype >::values, and ipcp_lattice< valtype >::values_count.
Referenced by propagate_constants_across_call().
|
static |
Propagate scalar values across jump function JFUNC that is associated with edge CS and put the values into DEST_LAT. PARM_TYPE is the type of the parameter to which the result is passed.
References ipcp_lattice< valtype >::add_value(), ipcp_lattice< valtype >::bottom, cgraph_edge::caller, ipcp_lattice< valtype >::contains_variable, ipa_get_jf_ancestor_formal_id(), ipa_get_jf_constant(), ipa_get_jf_pass_through_formal_id(), ipa_get_scalar_lat(), IPA_JF_ANCESTOR, IPA_JF_CONST, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipacp_value_safe_for_type(), ipcp_versionable_function_p(), NULL, propagate_vals_across_ancestor(), propagate_vals_across_pass_through(), ipcp_lattice< valtype >::set_contains_variable(), ipa_jump_func::type, and ipcp_lattice< valtype >::values_count.
Referenced by propagate_constants_across_call().
|
static |
Propagate values through an ancestor jump function JFUNC associated with edge CS, taking values from SRC_LAT and putting them into DEST_LAT. SRC_IDX is the index of the source parameter.
References ipcp_lattice< valtype >::add_value(), ipa_edge_within_scc(), ipa_get_jf_ancestor_result(), ipacp_value_safe_for_type(), ipcp_value< valtype >::next, ipcp_lattice< valtype >::set_contains_variable(), ipcp_value< valtype >::value, and ipcp_lattice< valtype >::values.
Referenced by propagate_scalar_across_jump_function().
|
static |
Propagate values through an arithmetic transformation described by a jump function associated with edge CS, taking values from SRC_LAT and putting them into DEST_LAT. OPND1_TYPE is expected type for the values in SRC_LAT. OPND2 is a constant value if transformation is a binary operation. SRC_OFFSET specifies offset in an aggregate if SRC_LAT describes lattice of a part of the aggregate. SRC_IDX is the index of the source parameter. RES_TYPE is the value type of result being propagated into. Return true if DEST_LAT changed.
References ipcp_lattice< valtype >::add_value(), cgraph_edge::caller, ipcp_value_source< valtype >::cs, symtab_node::decl, FOR_EACH_VEC_ELT, gcc_assert, gcc_checking_assert, get_val_across_arith_op(), i, ipa_edge_within_scc(), ipacp_value_safe_for_type(), ipcp_value< valtype >::next, ipcp_value_source< valtype >::next, opt_for_fn, ipcp_value< valtype >::self_recursion_generated_p(), ipcp_lattice< valtype >::set_contains_variable(), ipcp_value< valtype >::sources, cgraph_edge::sreal_frequency(), and ipcp_lattice< valtype >::values.
Referenced by propagate_aggregate_lattice(), and propagate_vals_across_pass_through().
|
static |
Propagate values through a pass-through jump function JFUNC associated with edge CS, taking values from SRC_LAT and putting them into DEST_LAT. SRC_IDX is the index of the source parameter. PARM_TYPE is the type of the parameter to which the result is passed.
References ipa_get_jf_pass_through_operand(), ipa_get_jf_pass_through_operation(), NULL_TREE, and propagate_vals_across_arith_jfunc().
Referenced by propagate_scalar_across_jump_function().
|
static |
Propagate value range across jump function JFUNC that is associated with edge CS with param of callee of PARAM_TYPE and update DEST_PLATS accordingly.
References ipcp_vr_lattice::bottom_p(), cgraph_edge::caller, ipa_edge_within_scc(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_parm_lattices(), ipa_get_type(), IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipa_vr_intersect_with_arith_jfunc(), ipa_vr_operation_and_type_effects(), ipa_vr_supported_type_p(), ipcp_param_lattices::m_value_range, ipa_jump_func::m_vr, ipcp_vr_lattice::m_vr, ipcp_vr_lattice::meet_with(), ipcp_vr_lattice::set_to_bottom(), value_range::set_varying(), ipa_jump_func::type, ipa_vr::type(), value_range::undefined_p(), and value_range::varying_p().
Referenced by propagate_constants_across_call().
|
static |
Push all aggregate values coming along edge CS for parameter number INDEX to RES. If INTERIM is non-NULL, it contains the current interim state of collected aggregate values which can be used to compute values passed over self-recursive edges. This basically one iteration of push_agg_values_from_edge over one parameter, which allows for simpler early returns.
References ipa_jump_func::agg, ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, ipa_agg_jump_function::by_ref, ipa_argagg_value::by_ref, cgraph_edge::caller, gcc_assert, ipa_argagg_value_list::get_value(), ipa_argagg_value::index, ipa_agg_value_from_jfunc(), ipa_edge_args_sum, ipa_get_ith_jump_func(), ipa_get_jf_ancestor_agg_preserved(), ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_offset(), ipa_get_jf_arith_result(), ipa_get_jf_pass_through_agg_preserved(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_parm_lattices(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipcp_get_transformation_summary(), ipa_node_params::ipcp_orig_node, ipa_agg_jump_function::items, ipa_argagg_value::killed, ipa_agg_jf_item::offset, ipa_pass_through_data::operand, ipa_pass_through_data::operation, ipa_agg_jf_item::jump_func_agg_value::pass_through, ipa_argagg_value_list::push_adjusted_values(), push_agg_values_from_plats(), self_recursive_agg_pass_through_p(), self_recursive_pass_through_p(), ipa_agg_jf_item::type, ipa_jump_func::type, UINT_MAX, ipa_argagg_value::unit_offset, ipa_agg_jf_item::value, and ipa_argagg_value::value.
Referenced by push_agg_values_from_edge().
|
static |
Push all aggregate values coming along edge CS to RES. DEST_INFO is the description of ultimate callee of CS or the one it was cloned from (the summary where lattices are). If INTERIM is non-NULL, it contains the current interim state of collected aggregate values which can be used to compute values passed over self-recursive edges (if OPTIMIZE_SELF_RECURSION is true) and to skip values which clearly will not be part of intersection with INTERIM.
References ipcp_param_lattices::aggs_bottom, count, ipa_argagg_value::index, ipa_edge_args_sum, ipa_get_cs_argument_count(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_is_param_used(), ipa_argagg_value_list::m_elts, MIN, NULL, push_agg_values_for_index_from_edge(), and array_slice< T >::size().
Referenced by cgraph_edge_brings_all_agg_vals_for_node(), and find_aggregate_values_for_callers_subset().
|
static |
Push to RES information about single lattices describing aggregate values in PLATS as those describing parameter DEST_INDEX and the original offset minus UNIT_DELTA. Return true if any item has been pushed to RES.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, ipa_argagg_value::by_ref, gcc_assert, ipa_argagg_value::index, ipa_argagg_value::killed, ipcp_agg_lattice::next, ipa_argagg_value::unit_offset, and ipa_argagg_value::value.
Referenced by gather_context_independent_values(), and push_agg_values_for_index_from_edge().
|
inlinestatic |
Add NODE to the stack in TOPO, unless it is already there.
References ipa_node_params_sum, ipa_node_params::node_enqueued, ipa_topo_info::stack, and ipa_topo_info::stack_top.
Referenced by propagate_constants_topo().
|
static |
Return true if JFUNC, which describes a part of an aggregate represented or pointed to by the i-th parameter of call CS, is a pass-through function to itself when the cgraph_node involved is not an IPA-CP clone.. When SIMPLE is true, further check if JFUNC is a simple no-operation pass-through.
References AVAIL_INTERPOSABLE, cgraph_edge::callee, cgraph_edge::caller, ipa_pass_through_data::formal_id, cgraph_node::function_symbol(), i, IPA_JF_LOAD_AGG, ipa_node_params_sum, ipa_agg_jf_item::jftype, ipa_agg_jf_item::jump_func_agg_value::load_agg, ipa_agg_jf_item::offset, ipa_load_agg_data::offset, ipa_pass_through_data::operation, ipa_agg_jf_item::jump_func_agg_value::pass_through, ipa_agg_jf_item::type, ipa_load_agg_data::type, useless_type_conversion_p(), and ipa_agg_jf_item::value.
Referenced by push_agg_values_for_index_from_edge().
|
static |
Return true if JFUNC, which describes a i-th parameter of call CS, is a pass-through function to itself when the cgraph_node involved is not an IPA-CP clone. When SIMPLE is true, further check if JFUNC is a simple no-operation pass-through.
References AVAIL_INTERPOSABLE, cgraph_edge::callee, cgraph_edge::caller, cgraph_node::function_symbol(), i, ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), IPA_JF_PASS_THROUGH, ipa_node_params_sum, and ipa_jump_func::type.
Referenced by find_more_scalar_values_for_callers_subset(), and push_agg_values_for_index_from_edge().
|
inlinestatic |
Mark all aggregate lattices in PLATS as containing an unknown value and return true if they were not previously marked as such.
References ipcp_param_lattices::aggs_contain_variable.
Referenced by merge_aggregate_lattices(), propagate_aggs_across_jump_function(), and set_all_contains_variable().
|
inlinestatic |
Set all aggregate lattices in PLATS to bottom and return true if they were not previously set as such.
References ipcp_param_lattices::aggs_bottom.
Referenced by initialize_node_lattices(), merge_agg_lats_step(), propagate_aggs_across_jump_function(), and set_check_aggs_by_ref().
|
inlinestatic |
Mark bot aggregate and scalar lattices as containing an unknown variable, return true is any of them has not been marked as such so far.
References ipcp_param_lattices::bits_lattice, ipcp_param_lattices::ctxlat, ipcp_param_lattices::itself, ipcp_param_lattices::m_value_range, set_agg_lats_contain_variable(), ipcp_lattice< valtype >::set_contains_variable(), ipcp_bits_lattice::set_to_bottom(), and ipcp_vr_lattice::set_to_bottom().
Referenced by initialize_node_lattices(), and propagate_constants_across_call().
|
static |
Set all AGLAT and all other aggregate lattices reachable by next pointers as containing an unknown value.
References ipcp_agg_lattice::next, and ipcp_lattice< valtype >::set_contains_variable().
Referenced by merge_aggregate_lattices(), and propagate_aggs_across_jump_function().
|
static |
If DEST_PLATS already has aggregate items, check that aggs_by_ref matches NEW_AGGS_BY_REF and if not, mark all aggs as bottoms and return true (in all other cases, return false). If there are no aggregate items, set aggs_by_ref to NEW_AGGS_BY_REF.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_by_ref, and set_agg_lats_to_bottom().
Referenced by merge_aggregate_lattices(), and propagate_aggs_across_jump_function().
|
static |
Worker of call_for_symbol_thunks_and_aliases, it is supposed to be called on the one caller of some other node. Set the caller's corresponding flag.
References cgraph_edge::caller, cgraph_node::callers, ipa_node_params_sum, cgraph_node::local, cgraph_edge::next_caller, and cgraph_node::thunk.
Referenced by initialize_node_lattices().
|
static |
Transitively mark all callees of NODE within the same SCC as not dead.
References cgraph_edge::callee, cgraph_node::callees, cgraph_node::function_symbol(), ipa_edge_within_scc(), ipa_node_params_sum, cgraph_edge::next_callee, ipa_node_params::node_dead, NULL, and spread_undeadness().
Referenced by identify_dead_nodes(), and spread_undeadness().
|
static |
When ORIG_NODE has been cloned for values which have been generated fora self-recursive call as a result of an arithmetic pass-through jump-functions, adjust its count together with counts of all such clones in SELF_GEN_CLONES which also at this point contains ORIG_NODE itself. The function sums the counts of the original node and all its clones that cannot be attributed to a specific clone because it comes from a non-recursive edge. This sum is then evenly divided between the clones and on top of that each one gets all the counts which can be attributed directly to it.
References hash_set< KeyId, Lazy, Traits >::add(), adjust_clone_incoming_counts(), profile_count::adjust_for_ipa_scaling(), analyze_clone_icoming_counts(), cgraph_node::callees, hash_set< KeyId, Lazy, Traits >::contains(), cgraph_node::count, desc_incoming_count_struct::count, dump_file, dump_profile_updates(), gather_count_of_non_rec_edges(), get_next_cgraph_edge_clone(), i, profile_count::ipa(), lenient_count_portion_handling(), cgraph_edge::next_callee, desc_incoming_count_struct::orig, gather_other_count_struct::orig, gather_other_count_struct::other_count, desc_incoming_count_struct::processed_edges, desc_incoming_count_struct::unproc_orig_rec_edges, and profile_count::zero().
Referenced by decide_whether_version_node().
|
static |
After a specialized NEW_NODE version of ORIG_NODE has been created, update their profile information to reflect this. This function should not be used for clones generated for arithmetic pass-through jump functions on a self-recursive call graph edge, that situation is handled by update_counts_for_self_gen_clones.
References profile_count::adjust_for_ipa_scaling(), profile_count::adjusted_zero(), profile_count::apply_scale(), cgraph_node::call_for_symbol_thunks_and_aliases(), cgraph_node::callees, profile_count::combine_with_ipa_count(), cgraph_node::count, symtab_node::decl, profile_count::dump(), dump_file, dump_profile_updates(), gather_caller_stats(), profile_count::global0(), profile_count::guessed_local(), cgraph_node::indirect_calls, init_caller_stats(), profile_count::ipa(), lenient_count_portion_handling(), cgraph_node::local, MAX, MIN, cgraph_edge::next_callee, profile_count::nonzero_p(), opt_for_fn, and profile_count::zero().
Referenced by decide_about_value().
|
static |
Update the respective profile of specialized NEW_NODE and the original ORIG_NODE after additional edges with cumulative count sum REDIRECTED_SUM have been redirected to the specialized version.
References profile_count::apply_scale(), cgraph_node::callees, cgraph_edge::count, cgraph_node::count, profile_count::dump(), dump_file, dump_profile_updates(), profile_count::ipa(), lenient_count_portion_handling(), cgraph_edge::next_callee, and profile_count::zero().
Referenced by perhaps_add_new_callers().
|
static |
Return true iff X and Y should be considered equal contexts by IPA-CP.
References ipa_polymorphic_call_context::equal_to(), and y.
Return true iff X and Y should be considered equal values by IPA-CP.
References DECL_IN_CONSTANT_POOL, DECL_INITIAL, gcc_checking_assert, NULL_TREE, operand_equal_p(), TREE_CODE, TREE_OPERAND, and y.
Referenced by ipcp_lattice< valtype >::add_value(), cgraph_edge_brings_all_scalars_for_node(), cgraph_edge_brings_value_p(), cgraph_edge_brings_value_p(), find_more_scalar_values_for_callers_subset(), intersect_argaggs_with(), ipa_agg_jump_functions_equivalent_p(), ipa_agg_pass_through_jf_equivalent_p(), ipa_get_jf_arith_result(), ipa_jump_functions_equivalent_p(), ipcp_val_agg_replacement_ok_p(), and ipa_argagg_value_list::superset_of_p().
|
static |
Return true if we would like to remove a parameter from NODE when cloning it with KNOWN_CSTS scalar constants.
References count, clone_info::get(), ipa_param_adjustments::get_surviving_params(), i, ipa_get_param_count(), ipa_is_param_used(), ipa_node_params_sum, and clone_info::param_adjustments.
Referenced by create_specialized_node().
|
static |
Base count to use in heuristics when using profile feedback.
Referenced by good_cloning_opportunity_p(), ipa_cp_cc_finalize(), and ipcp_propagate_stage().
|
static |
Node name to unique clone suffix number map.
Referenced by create_specialized_node(), and ipcp_driver().
|
static |
object_allocator< ipcp_agg_lattice > ipcp_agg_lattice_pool("IPA_CP aggregate lattices") | ( | "IPA_CP aggregate lattices" | ) |
object_allocator< ipcp_value< tree > > ipcp_cst_values_pool("IPA-CP constant values") | ( | "IPA-CP constant values" | ) |
Allocation pools for values and their sources in ipa-cp.
Referenced by allocate_and_init_ipcp_value(), ipa_free_all_structures_after_iinln(), and ipa_free_all_structures_after_ipa_cp().
object_allocator< ipcp_value< ipa_polymorphic_call_context > > ipcp_poly_ctx_values_pool("IPA-CP polymorphic contexts") | ( | "IPA-CP polymorphic contexts" | ) |
object_allocator< ipcp_value_source< tree > > ipcp_sources_pool("IPA-CP value sources") | ( | "IPA-CP value sources" | ) |
|
static |
Referenced by get_max_overall_size(), ipa_cp_cc_finalize(), and ipcp_propagate_stage().
|
static |
Original overall size of the program.
Referenced by clone_inlined_nodes(), decide_about_value(), dump_histogram(), estimate_local_effects(), execute_split_functions(), find_split_points(), inline_call(), ipa_cp_cc_finalize(), ipa_profile(), and ipcp_propagate_stage().