GCC Middle and Back End API Reference
|
Data Structures | |
struct | ipcp_value_source |
struct | ipcp_value |
struct | ipcp_lattice |
struct | ipcp_agg_lattice |
struct | ipcp_param_lattices |
struct | caller_statistics |
struct | topo_info |
Variables | |
alloc_pool | ipcp_values_pool |
alloc_pool | ipcp_sources_pool |
alloc_pool | ipcp_agg_lattice_pool |
static gcov_type | max_count |
static long | overall_size |
static long | max_new_size |
static struct ipcp_value * | values_topo |
static vec< cgraph_edge_p > | next_edge_clone |
|
static |
Add all values in lattices associated with NODE to the topological sort if they are not there yet.
References add_val_to_toposort(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_lattice::bottom, count, ipa_get_param_count(), ipa_get_parm_lattices(), ipcp_param_lattices::itself, ipcp_value::next, ipcp_agg_lattice::next, and ipcp_lattice::values.
Referenced by propagate_constants_topo().
|
inlinestatic |
Like above but passes a special value of offset to distinguish that the origin is the scalar value of the parameter rather than a part of an aggregate.
References add_value_to_lattice().
Referenced by propagate_scalar_accross_jump_function(), propagate_vals_accross_ancestor(), and propagate_vals_accross_pass_through().
|
static |
Add value CUR_VAL and all yet-unsorted values it is dependent on to the topological sort of values.
References ipcp_value::dfs, ipcp_value::low_link, ipcp_value_source::next, ipcp_value::on_stack, ipcp_value::scc_next, ipcp_value::sources, stack, ipcp_value::topo_next, ipcp_value_source::val, and values_topo.
Referenced by add_all_node_vals_to_toposort().
|
static |
Add a new value source to VAL, marking that a value comes from edge CS and (if the underlying jump function is a pass-through or an ancestor one) from a caller value SRC_VAL of a caller parameter described by SRC_INDEX. OFFSET is negative if the source was the scalar value of the parameter itself or the offset within an aggregate.
References ipcp_value_source::cs, ipcp_value_source::index, ipcp_value_source::next, ipcp_value_source::offset, offset, pool_alloc(), ipcp_value::sources, and ipcp_value_source::val.
Referenced by add_value_to_lattice().
|
static |
Try to add NEWVAL to LAT, potentially creating a new struct ipcp_value for it. CS, SRC_VAL SRC_INDEX and OFFSET are meant for add_value_source and have the same meaning.
References add_value_source(), ipcp_lattice::bottom, ipcp_value_source::cs, edge_within_scc(), memset(), ipcp_value_source::next, ipcp_value::next, pool_alloc(), pool_free(), set_lattice_to_bottom(), ipcp_value::sources, ipcp_value::value, ipcp_lattice::values, ipcp_lattice::values_count, and values_equal_for_ipcp_p().
Referenced by add_scalar_value_to_lattice(), merge_aggregate_lattices(), and propagate_aggs_accross_jump_function().
|
static |
The current interface in ipa-inline-analysis requires a pointer vector. Create it. FIXME: That interface should be re-worked, this is slightly silly. Still, I'd like to discuss how to change it first and this demonstrates the issue.
Referenced by estimate_local_effects().
|
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 intersect_aggregates_with_edge(), and propagate_aggs_accross_jump_function().
|
static |
Copy agggregate replacement values of NODE (which is an IPA-CP clone) to the vector result while subtracting OFFSET from the individual value offsets.
References ipa_agg_replacement_value::index, ipa_get_agg_replacements_for_node(), ipa_agg_replacement_value::next, ipa_agg_jf_item::offset, ipa_agg_replacement_value::offset, offset, ipa_agg_jf_item::value, ipa_agg_replacement_value::value, and vNULL.
Referenced by intersect_aggregates_with_edge().
|
static |
Allocate the arrays in TOPO and topologically sort the nodes into order.
References cgraph_n_nodes, ipa_reduced_postorder(), topo_info::nnodes, topo_info::order, topo_info::stack, and topo_info::stack_top.
Referenced by ipcp_driver().
|
static |
Determine whether CS also brings all aggregate values that NODE is specialized for.
References ipcp_param_lattices::aggs_bottom, cgraph_edge::caller, count, ipa_agg_replacement_value::index, intersect_aggregates_with_edge(), ipa_get_agg_replacements_for_node(), ipa_get_cs_argument_count(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_node_params::ipcp_orig_node, ipa_agg_replacement_value::next, ipa_agg_jf_item::offset, ipa_agg_jf_item::value, and values_equal_for_ipcp_p().
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, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_value_from_jfunc(), ipa_node_params::known_vals, 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.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, cgraph_edge::callee, cgraph_edge::caller, get_clone_agg_value(), ipcp_value_source::index, ipa_get_parm_lattices(), ipa_lat_is_single_const(), ipa_node_params::ipcp_orig_node, ipa_node_params::is_all_contexts_clone, ipcp_param_lattices::itself, ipa_node_params::known_vals, ipcp_agg_lattice::next, ipa_node_params::node_dead, ipcp_value_source::offset, ipcp_agg_lattice::offset, ipcp_value_source::val, ipcp_value::value, ipcp_lattice::values, and values_equal_for_ipcp_p().
Referenced by gather_edges_for_value(), get_info_about_necessary_edges(), and perhaps_add_new_callers().
|
static |
Gate for IPCP optimization.
|
static |
Return all context independent values from aggregate lattices in PLATS in a vector. Return NULL if there are none.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, ipcp_param_lattices::aggs_count, ipa_lat_is_single_const(), ipcp_agg_lattice::next, ipa_agg_jf_item::offset, ipa_agg_jf_item::value, and vec_safe_push().
Referenced by gather_context_independent_values().
|
static |
Go through PLATS and create a vector of values consisting of values and offsets (minus OFFSET) of lattices that contain only a single value.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, ipa_lat_is_single_const(), ipcp_agg_lattice::next, ipa_agg_jf_item::offset, offset, ipa_agg_jf_item::value, and vNULL.
Referenced by intersect_aggregates_with_edge().
|
staticread |
Create a specialized version of NODE with known constants and types of parameters in KNOWN_VALS and redirect all edges in CALLERS to it.
References bitmap_set_bit(), cgraph_local_info::can_change_signature, cgraph_create_virtual_clone(), cgraph_max_uid, cgraph_node_name(), count, dump_file, dump_flags, get_replacement_map(), ipa_dump_agg_replacement_values(), ipa_get_param_count(), ipa_is_param_used(), ipa_maybe_record_reference(), ipa_node_params_vector, IPA_REF_ADDR, ipa_set_node_agg_value_chain(), ipcp_discover_new_direct_edges(), ipa_node_params::ipcp_orig_node, ipa_node_params::known_vals, cgraph_node::local, ipa_agg_replacement_value::next, update_profiling_info(), ipa_agg_replacement_value::value, and vec_safe_push().
Referenced by decide_about_value(), and decide_whether_version_node().
|
static |
Decide wheter 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. KNOWN_CSTS, KNOWN_BINFOS and KNOWN_AGGS describe the other already known values.
References cgraph_node_name(), create_specialized_node(), dump_file, dump_flags, find_aggregate_values_for_callers_subset(), find_more_scalar_values_for_callers_subset(), gather_edges_for_value(), get_info_about_necessary_edges(), good_cloning_opportunity_p(), HOST_WIDE_INT_PRINT_DEC, ipa_agg_replacement_value::index, ipa_dump_param(), ipcp_val_in_agg_replacements_p(), ipcp_value::local_size_cost, ipcp_value::local_time_benefit, max_new_size, move_binfos_to_values(), symtab_node_base::order, overall_size, perhaps_add_new_callers(), print_ipcp_constant_value(), ipcp_value::prop_size_cost, ipcp_value::prop_time_benefit, ipcp_value::spec_node, cgraph_node::symbol, and ipcp_value::value.
Referenced by decide_whether_version_node().
|
static |
Decide whether and what specialized clones of NODE should be created.
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, ipcp_lattice::bottom, cgraph_node::callers, cgraph_node_name(), cgraph_node::clone, collect_callers_of_node(), count, create_specialized_node(), decide_about_value(), ipa_node_params::do_clone_for_all_contexts, dump_file, dump_flags, gather_context_independent_values(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_lat_is_single_const(), ipcp_param_lattices::itself, known_aggs_to_agg_replacement_list(), move_binfos_to_values(), ipcp_value::next, ipcp_agg_lattice::next, ipcp_agg_lattice::offset, symtab_node_base::order, cgraph_node::symbol, ipcp_lattice::values, vec_free(), 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_base::alias, AVAIL_OVERWRITABLE, cgraph_function_body_availability(), cgraph_node_name(), dump_file, cgraph_node::local, symtab_node_base::order, cgraph_node::symbol, cgraph_node::thunk, cgraph_thunk_info::thunk_p, and cgraph_local_info::versionable.
Referenced by ipcp_propagate_stage().
|
static |
Calculate devirtualization time bonus for NODE, assuming we know KNOWN_CSTS and KNOWN_BINFOS.
References cgraph_get_node(), symtab_node_base::decl, symtab_node_base::definition, cgraph_node::indirect_calls, inline_summary::inlinable, inline_summary(), ipa_get_indirect_edge_target(), cgraph_edge::next_callee, inline_summary::size, and cgraph_node::symbol.
Referenced by estimate_local_effects().
|
static |
Dump new profiling counts
References cgraph_edge::callee, cgraph_node::callees, cgraph_node_name(), cgraph_node::count, cgraph_edge::count, dump_file, HOST_WIDE_INT, HOST_WIDE_INT_PRINT_DEC, and cgraph_edge::next_callee.
Referenced by update_profiling_info(), and update_specialized_profile().
|
inlinestatic |
Return true iff the CS is an edge within a strongly connected component as computed by ipa_reduced_postorder.
References symtab_node_base::aux, cgraph_edge::callee, cgraph_edge::caller, cgraph_function_node(), ipa_dfs_info::scc_no, and cgraph_node::symbol.
Referenced by add_value_to_lattice(), has_undead_caller_from_outside_scc_p(), propagate_constants_topo(), propagate_vals_accross_ancestor(), propagate_vals_accross_pass_through(), and spread_undeadness().
|
static |
Iterate over known values of parameters of NODE and estimate the local effects in terms of time and size they have.
References agg_jmp_p_vec_for_t_vec(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, ipcp_lattice::bottom, cgraph_for_node_and_aliases(), cgraph_node_name(), cgraph_will_be_removed_from_program_if_no_direct_calls(), count, caller_statistics::count_sum, devirtualization_time_bonus(), ipa_node_params::do_clone_for_all_contexts, dump_file, dump_flags, estimate_ipcp_clone_size_and_time(), estimate_move_cost(), caller_statistics::freq_sum, gather_caller_stats(), gather_context_independent_values(), good_cloning_opportunity_p(), hint_time_bonus(), HOST_WIDE_INT_PRINT_DEC, init_caller_stats(), inline_summary(), ipa_dump_param(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_lat_is_single_const(), ipcp_versionable_function_p(), ipa_agg_jump_function::items, ipcp_param_lattices::itself, ipcp_value::local_size_cost, ipcp_value::local_time_benefit, max_new_size, caller_statistics::n_calls, ipcp_value::next, ipcp_agg_lattice::next, ipa_agg_jf_item::offset, ipcp_agg_lattice::offset, symtab_node_base::order, overall_size, print_ipcp_constant_value(), cgraph_node::symbol, inline_summary::time, ipcp_value::value, ipa_agg_jf_item::value, ipcp_lattice::values, vec_free(), vec_safe_push(), and ipcp_param_lattices::virt_call.
Referenced by propagate_constants_topo().
|
staticread |
Look at edges in CALLERS and collect all known aggregate values that arrive from all of them.
References ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipa_agg_replacement_value::by_ref, count, ipa_agg_replacement_value::index, intersect_aggregates_with_edge(), ipa_get_cs_argument_count(), ipa_get_param_count(), ipa_get_parm_lattices(), ipa_agg_replacement_value::next, ipa_agg_jf_item::offset, ipa_agg_replacement_value::offset, ipa_agg_jf_item::value, ipa_agg_replacement_value::value, and vNULL.
Referenced by decide_about_value().
|
static |
Given a NODE, and a subset of its CALLERS, try to populate blanks slots in KNOWN_VALS with constants and types that are also known for all of the CALLERS.
References cgraph_edge::caller, count, dump_file, dump_flags, ipa_dump_param(), ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_get_scalar_lat(), ipa_value_from_jfunc(), print_ipcp_constant_value(), and values_equal_for_ipcp_p().
Referenced by decide_about_value().
|
static |
Free information about strongly connected components and the arrays in TOPO.
References free(), ipa_free_postorder_info(), topo_info::order, and 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_for_node_and_aliases(), cgraph_maybe_hot_edge_p(), cgraph_edge::count, caller_statistics::count_sum, caller_statistics::freq_sum, cgraph_edge::frequency, caller_statistics::n_calls, caller_statistics::n_hot_calls, cgraph_edge::next_caller, stats, cgraph_node::thunk, and cgraph_thunk_info::thunk_p.
Referenced by estimate_local_effects(), ipcp_cloning_candidate_p(), and update_profiling_info().
|
static |
Allocate KNOWN_CSTS, KNOWN_BINFOS and, if non-NULL, KNOWN_AGGS and populate them with values of parameters that are known independent of the context. INFO describes the function. If REMOVABLE_PARAMS_COST is non-NULL, the movement cost of all removable parameters will be stored in it.
References ipcp_param_lattices::aggs_by_ref, ipa_agg_jump_function::by_ref, context_independent_aggregate_values(), count, estimate_move_cost(), ipa_get_param_count(), ipa_get_param_move_cost(), ipa_get_parm_lattices(), ipa_is_param_used(), ipa_lat_is_single_const(), ipa_agg_jump_function::items, ipcp_param_lattices::itself, ipcp_value::value, ipcp_lattice::values, and ipcp_param_lattices::virt_call.
Referenced by decide_whether_version_node(), and estimate_local_effects().
|
static |
Return a vector of incoming edges that do bring value VAL. It is assumed their number is known and equal to CALLER_COUNT.
References cgraph_edge_brings_value_p(), ipcp_value_source::cs, get_next_cgraph_edge_clone(), ipcp_value_source::next, and ipcp_value::sources.
Referenced by decide_about_value().
|
static |
See if NODE is a clone with a known aggregate value at a given OFFSET of a parameter with the given INDEX.
References ipa_agg_replacement_value::index, ipa_get_agg_replacements_for_node(), ipa_agg_replacement_value::next, ipa_agg_replacement_value::offset, and ipa_agg_replacement_value::value.
Referenced by cgraph_edge_brings_value_p().
|
static |
Given VAL, iterate over all its sources and if they still hold, add their edge frequency and their number into *FREQUENCY and *CALLER_COUNT respectively.
References cgraph_edge_brings_value_p(), cgraph_maybe_hot_edge_p(), count, cgraph_edge::count, ipcp_value_source::cs, cgraph_edge::frequency, get_next_cgraph_edge_clone(), ipcp_value_source::next, and ipcp_value::sources.
Referenced by decide_about_value().
|
staticread |
Get the next clone in the linked list of clones of an edge.
References cgraph_edge::uid.
Referenced by gather_edges_for_value(), get_info_about_necessary_edges(), and perhaps_add_new_callers().
|
staticread |
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.
References dump_file, ipa_dump_param(), ipa_replace_map::new_tree, ipa_replace_map::old_tree, ipa_replace_map::parm_num, print_generic_expr(), ipa_replace_map::ref_p, and ipa_replace_map::replace_p.
Referenced by create_specialized_node().
|
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 symtab_node_base::decl, dump_file, dump_flags, HOST_WIDE_INT, HOST_WIDE_INT_PRINT_DEC, HOST_WIDEST_INT, HOST_WIDEST_INT_PRINT_DEC, max_count, optimize_function_for_speed_p(), and cgraph_node::symbol.
Referenced by decide_about_value(), and estimate_local_effects().
|
inlinestatic |
References cgraph_edge_max_uid.
Referenced by ipcp_driver(), and ipcp_edge_duplication_hook().
|
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_edge::caller, cgraph_node::callers, cgraph_for_node_and_aliases(), edge_within_scc(), cgraph_edge::next_caller, cgraph_node::thunk, and cgraph_thunk_info::thunk_p.
Referenced by identify_dead_nodes().
|
static |
Return time bonus incurred because of HINTS.
References INLINE_HINT_array_index, INLINE_HINT_loop_iterations, and INLINE_HINT_loop_stride.
Referenced by estimate_local_effects().
|
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_base::aux, cgraph_for_node_and_aliases(), cgraph_node_name(), cgraph_will_be_removed_from_program_if_no_direct_calls(), dump_file, dump_flags, has_undead_caller_from_outside_scc_p(), symtab_node_base::order, spread_undeadness(), and cgraph_node::symbol.
Referenced by ipcp_decision_stage().
|
inlinestatic |
Initialize fields of STAT to zeroes.
References caller_statistics::count_sum, caller_statistics::freq_sum, caller_statistics::n_calls, and caller_statistics::n_hot_calls.
Referenced by estimate_local_effects(), ipcp_cloning_candidate_p(), and update_profiling_info().
|
static |
Initialize ipcp_lattices.
References symtab_node_base::alias, cgraph_function_with_gimple_body_p(), cgraph_node_name(), dump_file, dump_flags, cgraph_node::indirect_calls, cgraph_edge::indirect_info, ipa_get_param_count(), ipa_get_parm_lattices(), ipcp_cloning_candidate_p(), ipcp_versionable_function_p(), ipcp_param_lattices::itself, cgraph_local_info::local, cgraph_node::local, cgraph_edge::next_callee, symtab_node_base::order, cgraph_indirect_call_info::param_index, cgraph_indirect_call_info::polymorphic, set_agg_lats_to_bottom(), set_all_contains_variable(), set_lattice_to_bottom(), cgraph_node::symbol, cgraph_node::thunk, cgraph_thunk_info::thunk_p, and ipcp_param_lattices::virt_call.
Referenced by ipcp_propagate_stage().
|
static |
Intersect values in INTER with aggregate values that come along edge CS to parameter number INDEX and return it. If INTER does not actually exist yet, copy all incoming values to it. If we determine we ended up with no values whatsoever, return a released vector.
References ipa_jump_func::agg, agg_pass_through_permissible_p(), agg_replacements_to_vector(), ipcp_param_lattices::aggs, cgraph_edge::caller, copy_plats_to_inter(), HOST_WIDE_INT, intersect_with_agg_replacements(), intersect_with_plats(), 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_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_parm_lattices(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params::ipcp_orig_node, ipa_agg_jump_function::items, ipa_agg_jf_item::offset, ipa_jump_func::type, ipa_agg_jf_item::value, and values_equal_for_ipcp_p().
Referenced by cgraph_edge_brings_all_agg_vals_for_node(), and find_aggregate_values_for_callers_subset().
|
static |
Intersect all values in INTER with those that we have already scheduled to be replaced in parameter number INDEX of NODE, which is an IPA-CP clone (while subtracting OFFSET).
References ipa_agg_replacement_value::index, ipa_get_agg_replacements_for_node(), ipa_agg_replacement_value::next, ipa_agg_jf_item::offset, ipa_agg_replacement_value::offset, ipa_agg_jf_item::value, ipa_agg_replacement_value::value, and values_equal_for_ipcp_p().
Referenced by intersect_aggregates_with_edge().
|
static |
Intersect all values in INTER with single value lattices in PLATS (while subtracting OFFSET).
References ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_contain_variable, ipcp_agg_lattice::next, ipa_agg_jf_item::offset, ipcp_agg_lattice::offset, ipcp_value::value, ipa_agg_jf_item::value, ipcp_lattice::values, and values_equal_for_ipcp_p().
Referenced by intersect_aggregates_with_edge().
tree ipa_get_indirect_edge_target | ( | struct cgraph_edge * | ie, |
vec< tree > | known_vals, | ||
vec< tree > | known_binfos, | ||
vec< ipa_agg_jump_function_p > | known_aggs | ||
) |
If an indirect edge IE can be turned into a direct one based on KNOWN_VALS (which can contain both constants and binfos), KNOWN_BINFOS (which can be NULL) or KNOWN_AGGS (which also can be NULL) return the destination.
References ipa_get_indirect_edge_target_1().
Referenced by devirtualization_time_bonus(), and estimate_edge_devirt_benefit().
|
static |
If an indirect edge IE can be turned into a direct one based on KNOWN_VALS (which can contain both constants and binfos), KNOWN_BINFOS, KNOWN_AGGS or AGG_REPS 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, ipa_agg_replacement_value::by_ref, cgraph_indirect_call_info::by_ref, get_binfo_at_offset(), gimple_extract_devirt_binfo_from_cst(), gimple_get_virt_method_for_binfo(), HOST_WIDE_INT, ipa_agg_replacement_value::index, cgraph_edge::indirect_info, ipa_find_agg_cst_for_param(), ipa_agg_replacement_value::next, cgraph_indirect_call_info::offset, ipa_agg_replacement_value::offset, cgraph_indirect_call_info::otr_token, cgraph_indirect_call_info::otr_type, cgraph_indirect_call_info::param_index, cgraph_indirect_call_info::polymorphic, token(), and ipa_agg_replacement_value::value.
Referenced by 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 build_ref_for_offset(), get_binfo_at_offset(), ipa_get_jf_ancestor_offset(), and ipa_get_jf_ancestor_type().
Referenced by ipa_value_from_jfunc(), and propagate_vals_accross_ancestor().
|
static |
Return the result of a (possibly arithmetic) pass through jump function JFUNC on the constant value INPUT. Return NULL_TREE if that cannot be determined or itself is considered an interprocedural invariant.
References ipa_get_jf_pass_through_operand(), ipa_get_jf_pass_through_operation(), is_gimple_ip_invariant(), and tcc_comparison.
Referenced by ipa_value_from_jfunc(), and propagate_vals_accross_pass_through().
|
staticread |
Return the param lattices structure corresponding to the Ith formal parameter of the function described by INFO.
References 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_all_agg_vals_for_node(), cgraph_edge_brings_value_p(), decide_whether_version_node(), estimate_local_effects(), find_aggregate_values_for_callers_subset(), gather_context_independent_values(), initialize_node_lattices(), intersect_aggregates_with_edge(), ipa_get_scalar_lat(), print_all_lattices(), propagate_aggs_accross_jump_function(), and propagate_constants_accross_call().
|
staticread |
Return the lattice corresponding to the scalar value of the Ith formal parameter of the function described by INFO.
References ipa_get_parm_lattices(), and ipcp_param_lattices::itself.
Referenced by find_more_scalar_values_for_callers_subset(), ipa_value_from_jfunc(), ipcp_verify_propagated_values(), and propagate_scalar_accross_jump_function().
|
inlinestatic |
Return whether LAT is a lattice with a single constant and without an undefined value.
References ipcp_lattice::bottom, ipcp_lattice::contains_variable, and ipcp_lattice::values_count.
Referenced by cgraph_edge_brings_value_p(), context_independent_aggregate_values(), copy_plats_to_inter(), decide_whether_version_node(), estimate_local_effects(), gather_context_independent_values(), and ipa_value_from_jfunc().
tree ipa_value_from_jfunc | ( | ) |
Determine whether JFUNC evaluates to a known value (that is either a constant or a binfo) and if so, return it. Otherwise return NULL. INFO describes the caller node so that pass-through jump functions can be evaluated.
References ipa_binfo_from_known_type_jfunc(), 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_scalar_lat(), IPA_JF_ANCESTOR, IPA_JF_CONST, IPA_JF_KNOWN_TYPE, IPA_JF_PASS_THROUGH, ipa_lat_is_single_const(), ipa_node_params::ipcp_orig_node, ipa_node_params::known_vals, ipa_node_params::lattices, ipa_jump_func::type, ipcp_value::value, and ipcp_lattice::values.
Referenced by cgraph_edge_brings_all_scalars_for_node(), evaluate_properties_for_edge(), find_more_scalar_values_for_callers_subset(), try_make_edge_direct_simple_call(), and try_make_edge_direct_virtual_call().
|
static |
Return true if this NODE is viable candidate for cloning.
References cgraph_for_node_and_aliases(), cgraph_function_with_gimple_body_p(), cgraph_node_name(), cgraph_node::count, caller_statistics::count_sum, symtab_node_base::decl, dump_file, gather_caller_stats(), init_caller_stats(), max_count, caller_statistics::n_calls, caller_statistics::n_hot_calls, optimize_function_for_speed_p(), and cgraph_node::symbol.
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_base::aux, cgraph_function_with_gimple_body_p(), decide_whether_version_node(), dump_file, identify_dead_nodes(), ipcp_versionable_function_p(), topo_info::nnodes, topo_info::order, and cgraph_node::symbol.
Referenced by ipcp_driver().
|
static |
Discover newly direct outgoing edges from NODE which is a new clone with known KNOWN_VALS and make them direct.
References cgraph_indirect_call_info::agg_contents, cgraph_edge::callee, dump_file, dump_flags, cgraph_node::indirect_calls, cgraph_edge::indirect_info, inline_update_overall_summary(), ipa_find_reference(), ipa_get_controlled_uses(), ipa_get_indirect_edge_target_1(), ipa_make_edge_direct_to_target(), ipa_remove_reference(), ipa_set_controlled_uses(), cgraph_edge::next_callee, cgraph_indirect_call_info::param_index, cgraph_indirect_call_info::polymorphic, and vNULL.
Referenced by create_specialized_node().
|
static |
The IPCP driver.
References build_toporder_info(), cgraph_add_edge_duplication_hook(), cgraph_remove_edge_duplication_hook(), create_alloc_pool(), dump_file, dump_flags, edge_duplication_hook_holder, free_toporder_info(), grow_next_edge_clone_vector(), 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_edge_duplication_hook(), and ipcp_propagate_stage().
|
static |
Edge duplication hook to grow the appropriate linked list in next_edge_clone.
References grow_next_edge_clone_vector(), and cgraph_edge::uid.
Referenced by ipcp_driver().
|
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 symtab_node_base::decl, dump_file, ipa_analyze_node(), ipa_register_cgraph_hooks(), cgraph_node::local, cgraph_node::symbol, tree_versionable_function_p(), and cgraph_local_info::versionable.
|
static |
Propagate constants, binfos and their effects from the summaries interprocedurally.
References symtab_node_base::alias, cgraph_function_with_gimple_body_p(), cgraph_node::count, symtab_node_base::definition, determine_versionability(), dump_file, dump_flags, initialize_node_lattices(), inline_summary(), ipa_get_param_count(), ipa_update_after_lto_read(), ipcp_verify_propagated_values(), ipa_node_params::lattices, max_count, max_new_size, overall_size, print_all_lattices(), propagate_constants_topo(), propagate_effects(), inline_summary::self_size, and cgraph_node::symbol.
Referenced by ipcp_driver().
|
static |
Read ipcp summary.
References ipa_prop_read_jump_functions().
DEBUG_FUNCTION bool ipcp_val_in_agg_replacements_p | ( | struct ipa_agg_replacement_value * | aggvals, |
int | index, | ||
HOST_WIDE_INT | offset, | ||
tree | value | ||
) |
Return true if there is a replacement equivalent to VALUE, INDEX and OFFSET among those in the AGGVALS list.
References ipa_agg_replacement_value::index, ipa_agg_replacement_value::next, ipa_agg_replacement_value::offset, ipa_agg_replacement_value::value, 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::bottom, ipcp_lattice::contains_variable, count, dump_file, ipa_get_param_count(), ipa_get_scalar_lat(), print_all_lattices(), and ipcp_lattice::values_count.
Referenced by ipcp_propagate_stage().
|
static |
Return true if it is at all technically possible to create clones of a NODE.
References cgraph_node::local, and cgraph_local_info::versionable.
Referenced by estimate_local_effects(), initialize_node_lattices(), ipcp_decision_stage(), and propagate_scalar_accross_jump_function().
|
static |
Write ipcp summary for nodes in SET.
References ipa_prop_write_jump_functions().
|
staticread |
Turn KNOWN_AGGS into a list of aggreate replacement values.
References ipa_agg_jump_function::by_ref, ipa_agg_replacement_value::by_ref, ipa_agg_replacement_value::index, ipa_agg_jump_function::items, ipa_agg_replacement_value::next, ipa_agg_jf_item::offset, ipa_agg_replacement_value::offset, ipa_agg_jf_item::value, and ipa_agg_replacement_value::value.
Referenced by decide_whether_version_node().
ipa_opt_pass_d* make_pass_ipa_cp | ( | ) |
|
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.
References ipcp_param_lattices::aggs_count, ipcp_lattice::contains_variable, memset(), ipcp_agg_lattice::next, ipcp_agg_lattice::offset, offset, pool_alloc(), set_agg_lats_to_bottom(), set_lattice_contains_variable(), and ipcp_agg_lattice::size.
Referenced by merge_aggregate_lattices(), and propagate_aggs_accross_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 add_value_to_lattice(), ipcp_param_lattices::aggs, ipcp_param_lattices::aggs_bottom, ipcp_param_lattices::aggs_by_ref, ipcp_param_lattices::aggs_contain_variable, HOST_WIDE_INT, merge_agg_lats_step(), ipcp_value::next, ipcp_agg_lattice::next, set_agg_lats_contain_variable(), set_chain_of_aglats_contains_variable(), set_check_aggs_by_ref(), and set_lattice_contains_variable().
Referenced by propagate_aggs_accross_jump_function().
Copy KNOWN_BINFOS to KNOWN_VALS.
Referenced by decide_about_value(), and decide_whether_version_node().
|
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 the special node. This function can therefore redirect the final edge in a SCC.
References AVAIL_OVERWRITABLE, cgraph_edge::callee, cgraph_edge::caller, cgraph_edge_brings_all_agg_vals_for_node(), cgraph_edge_brings_all_scalars_for_node(), cgraph_edge_brings_value_p(), cgraph_function_node(), cgraph_node_name(), cgraph_redirect_edge_callee(), cgraph_edge::count, ipcp_value_source::cs, dump_file, get_next_cgraph_edge_clone(), ipcp_value_source::next, symtab_node_base::order, ipcp_value::sources, ipcp_value::spec_node, cgraph_node::symbol, and update_specialized_profile().
Referenced by decide_about_value().
|
staticread |
Pop a node from the stack in TOPO and return it or return NULL if the stack is empty.
References topo_info::stack, and topo_info::stack_top.
Referenced by propagate_constants_topo().
|
static |
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, cgraph_node_name(), count, HOST_WIDE_INT_PRINT_DEC, ipa_get_param_count(), ipa_get_parm_lattices(), ipcp_param_lattices::itself, ipcp_agg_lattice::next, ipcp_agg_lattice::offset, symtab_node_base::order, print_lattice(), cgraph_node::symbol, 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.
References print_generic_expr().
Referenced by decide_about_value(), estimate_local_effects(), find_more_scalar_values_for_callers_subset(), and print_lattice().
|
static |
Print a lattice LAT to F.
References ipcp_lattice::bottom, cgraph_edge::caller, ipcp_lattice::contains_variable, ipcp_value_source::cs, cgraph_edge::frequency, ipcp_value::local_size_cost, ipcp_value::local_time_benefit, ipcp_value_source::next, ipcp_value::next, symtab_node_base::order, print_ipcp_constant_value(), ipcp_value::prop_size_cost, ipcp_value::prop_time_benefit, ipcp_value::sources, cgraph_node::symbol, ipcp_value::value, ipcp_lattice::values, and ipcp_lattice::values_count.
Referenced by print_all_lattices().
|
static |
Propagate scalar values across jump function JFUNC that is associated with edge CS and put the values into DEST_LAT.
References add_value_to_lattice(), 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::caller, HOST_WIDE_INT, 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, is_gimple_ip_invariant(), ipa_agg_jump_function::items, merge_agg_lats_step(), merge_aggregate_lattices(), ipcp_agg_lattice::next, ipa_agg_jf_item::offset, set_agg_lats_contain_variable(), set_agg_lats_to_bottom(), set_chain_of_aglats_contains_variable(), set_check_aggs_by_ref(), tree_low_cst(), ipa_jump_func::type, and ipa_agg_jf_item::value.
Referenced by propagate_constants_accross_call().
|
static |
Propagate constants from the caller to the callee of CS. INFO describes the caller.
References symtab_node_base::alias, AVAIL_OVERWRITABLE, cgraph_edge::callee, cgraph_alias_target(), cgraph_function_node(), cgraph_function_with_gimple_body_p(), symtab_node_base::definition, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_get_parm_lattices(), ipcp_param_lattices::itself, propagate_aggs_accross_jump_function(), propagate_scalar_accross_jump_function(), set_all_contains_variable(), cgraph_node::symbol, cgraph_node::thunk, and cgraph_thunk_info::thunk_p.
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(), symtab_node_base::aux, cgraph_edge::callee, cgraph_node::callees, cgraph_function_with_gimple_body_p(), edge_within_scc(), estimate_local_effects(), cgraph_edge::next_callee, ipa_dfs_info::next_cycle, topo_info::nnodes, topo_info::order, pop_node_from_stack(), propagate_constants_accross_call(), push_node_to_stack(), and cgraph_node::symbol.
Referenced by ipcp_propagate_stage().
|
static |
Propagate the estimated effects of individual values along the topological from the dependent values to those they depend on.
References cgraph_maybe_hot_edge_p(), ipcp_value_source::cs, ipcp_value::local_size_cost, ipcp_value::local_time_benefit, ipcp_value_source::next, ipcp_value::prop_size_cost, ipcp_value::prop_time_benefit, safe_add(), ipcp_value::scc_next, ipcp_value::sources, ipcp_value::topo_next, and ipcp_value_source::val.
Referenced by ipcp_propagate_stage().
|
static |
Propagate scalar values across jump function JFUNC that is associated with edge CS and put the values into DEST_LAT.
References add_scalar_value_to_lattice(), ipcp_lattice::bottom, cgraph_edge::caller, ipcp_lattice::contains_variable, ipa_binfo_from_known_type_jfunc(), 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_KNOWN_TYPE, IPA_JF_PASS_THROUGH, ipcp_versionable_function_p(), propagate_vals_accross_ancestor(), propagate_vals_accross_pass_through(), set_lattice_contains_variable(), ipa_jump_func::type, and ipcp_lattice::values_count.
Referenced by propagate_constants_accross_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 add_scalar_value_to_lattice(), edge_within_scc(), ipa_get_jf_ancestor_result(), ipcp_value::next, set_lattice_contains_variable(), ipcp_value::value, and ipcp_lattice::values.
Referenced by propagate_scalar_accross_jump_function().
|
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.
References add_scalar_value_to_lattice(), edge_within_scc(), ipa_get_jf_pass_through_operation(), ipa_get_jf_pass_through_result(), ipcp_value::next, set_lattice_contains_variable(), ipcp_value::value, and ipcp_lattice::values.
Referenced by propagate_scalar_accross_jump_function().
|
inlinestatic |
Add NODE to the stack in TOPO, unless it is already there.
References ipa_node_params::node_enqueued, topo_info::stack, and topo_info::stack_top.
Referenced by propagate_constants_topo().
|
static |
Return the sum of A and B if none of them is bigger than INT_MAX/2, return the bigger one if otherwise.
Referenced by propagate_effects().
|
inlinestatic |
Mark all aggegate 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(), and propagate_aggs_accross_jump_function().
|
inlinestatic |
Set all aggegate 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_accross_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::aggs_contain_variable, ipcp_lattice::contains_variable, and ipcp_param_lattices::itself.
Referenced by initialize_node_lattices(), and propagate_constants_accross_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 set_lattice_contains_variable().
Referenced by merge_aggregate_lattices(), and propagate_aggs_accross_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_accross_jump_function().
|
inlinestatic |
Mark lattice as containing an unknown value and return true if it previously was not marked as such.
References ipcp_lattice::contains_variable.
Referenced by merge_agg_lats_step(), merge_aggregate_lattices(), propagate_scalar_accross_jump_function(), propagate_vals_accross_ancestor(), propagate_vals_accross_pass_through(), and set_chain_of_aglats_contains_variable().
|
inlinestatic |
Set lattice LAT to bottom and return true if it previously was not set as such.
References ipcp_lattice::bottom.
Referenced by add_value_to_lattice(), and 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_function_node(), edge_within_scc(), cgraph_edge::next_callee, and ipa_node_params::node_dead.
Referenced by identify_dead_nodes().
|
static |
After a specialized NEW_NODE version of ORIG_NODE has been created, update their profile information to reflect this.
References apply_probability(), cgraph_node::callees, cgraph_for_node_and_aliases(), cgraph_node_name(), cgraph_node::count, cgraph_edge::count, caller_statistics::count_sum, dump_file, dump_profile_updates(), cgraph_edge::frequency, gather_caller_stats(), HOST_WIDE_INT, HOST_WIDE_INT_PRINT_DEC, init_caller_stats(), cgraph_edge::next_callee, symtab_node_base::order, and cgraph_node::symbol.
Referenced by create_specialized_node().
|
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 apply_probability(), cgraph_node::callees, count, cgraph_node::count, cgraph_edge::count, dump_file, dump_profile_updates(), cgraph_edge::frequency, HOST_WIDE_INT, HOST_WIDE_INT_PRINT_DEC, and cgraph_edge::next_callee.
Referenced by perhaps_add_new_callers().
|
static |
Return true iff X and Y should be considered equal values by IPA-CP.
References operand_equal_p().
Referenced by add_value_to_lattice(), cgraph_edge_brings_all_agg_vals_for_node(), cgraph_edge_brings_all_scalars_for_node(), cgraph_edge_brings_value_p(), find_more_scalar_values_for_callers_subset(), intersect_aggregates_with_edge(), intersect_with_agg_replacements(), intersect_with_plats(), and ipcp_val_in_agg_replacements_p().
alloc_pool ipcp_agg_lattice_pool |
Referenced by ipa_free_all_structures_after_iinln(), and ipa_free_all_structures_after_ipa_cp().
alloc_pool ipcp_sources_pool |
Referenced by ipa_free_all_structures_after_iinln(), and ipa_free_all_structures_after_ipa_cp().
alloc_pool ipcp_values_pool |
Allocation pools for values and their sources in ipa-cp.
Referenced by ipa_free_all_structures_after_iinln(), and ipa_free_all_structures_after_ipa_cp().
|
static |
Maximal count found in program.
Referenced by good_cloning_opportunity_p(), ipcp_cloning_candidate_p(), and ipcp_propagate_stage().
|
static |
Referenced by decide_about_value(), estimate_local_effects(), and ipcp_propagate_stage().
|
static |
Vector of pointers which for linked lists of clones of an original crgaph edge.
|
static |
Original overall size of the program.
Referenced by decide_about_value(), dump_histogram(), estimate_local_effects(), execute_split_functions(), find_split_points(), ipa_profile(), and ipcp_propagate_stage().
|
static |
Head of the linked list of topologically sorted values.
Referenced by add_val_to_toposort().