GCC Middle and Back End API Reference
ipa-cp.c File 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

Functions

static struct ipcp_param_latticesipa_get_parm_lattices ()
static struct ipcp_latticeipa_get_scalar_lat ()
static bool ipa_lat_is_single_const ()
static bool edge_within_scc ()
static void print_ipcp_constant_value ()
static void print_lattice (FILE *f, struct ipcp_lattice *lat, bool dump_sources, bool dump_benefits)
static void print_all_lattices ()
static void determine_versionability ()
static bool ipcp_versionable_function_p ()
static void init_caller_stats ()
static bool gather_caller_stats ()
static bool ipcp_cloning_candidate_p ()
static void build_toporder_info ()
static void free_toporder_info ()
static void push_node_to_stack ()
static struct cgraph_nodepop_node_from_stack ()
static bool set_lattice_to_bottom ()
static bool set_lattice_contains_variable ()
static bool set_agg_lats_to_bottom ()
static bool set_agg_lats_contain_variable ()
static bool set_all_contains_variable ()
static void initialize_node_lattices ()
static tree ipa_get_jf_pass_through_result ()
static tree ipa_get_jf_ancestor_result ()
tree ipa_value_from_jfunc ()
DEBUG_FUNCTION void ipcp_verify_propagated_values ()
static bool values_equal_for_ipcp_p ()
static void add_value_source (struct ipcp_value *val, struct cgraph_edge *cs, struct ipcp_value *src_val, int src_idx, HOST_WIDE_INT offset)
static bool add_value_to_lattice (struct ipcp_lattice *lat, tree newval, struct cgraph_edge *cs, struct ipcp_value *src_val, int src_idx, HOST_WIDE_INT offset)
static bool add_scalar_value_to_lattice (struct ipcp_lattice *lat, tree newval, struct cgraph_edge *cs, struct ipcp_value *src_val, int src_idx)
static bool propagate_vals_accross_pass_through (struct cgraph_edge *cs, struct ipa_jump_func *jfunc, struct ipcp_lattice *src_lat, struct ipcp_lattice *dest_lat, int src_idx)
static bool propagate_vals_accross_ancestor (struct cgraph_edge *cs, struct ipa_jump_func *jfunc, struct ipcp_lattice *src_lat, struct ipcp_lattice *dest_lat, int src_idx)
static bool propagate_scalar_accross_jump_function (struct cgraph_edge *cs, struct ipa_jump_func *jfunc, struct ipcp_lattice *dest_lat)
static bool set_check_aggs_by_ref (struct ipcp_param_lattices *dest_plats, bool new_aggs_by_ref)
static bool merge_agg_lats_step (struct ipcp_param_lattices *dest_plats, HOST_WIDE_INT offset, HOST_WIDE_INT val_size, struct ipcp_agg_lattice ***aglat, bool pre_existing, bool *change)
static bool set_chain_of_aglats_contains_variable ()
static bool merge_aggregate_lattices (struct cgraph_edge *cs, struct ipcp_param_lattices *dest_plats, struct ipcp_param_lattices *src_plats, int src_idx, HOST_WIDE_INT offset_delta)
static bool agg_pass_through_permissible_p (struct ipcp_param_lattices *src_plats, struct ipa_jump_func *jfunc)
static bool propagate_aggs_accross_jump_function (struct cgraph_edge *cs, struct ipa_jump_func *jfunc, struct ipcp_param_lattices *dest_plats)
static bool propagate_constants_accross_call ()
static tree ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie, vec< tree > known_vals, vec< tree > known_binfos, vec< ipa_agg_jump_function_p > known_aggs, struct ipa_agg_replacement_value *agg_reps)
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)
static int devirtualization_time_bonus (struct cgraph_node *node, vec< tree > known_csts, vec< tree > known_binfos, vec< ipa_agg_jump_function_p > known_aggs)
static int hint_time_bonus ()
static bool good_cloning_opportunity_p (struct cgraph_node *node, int time_benefit, int freq_sum, gcov_type count_sum, int size_cost)
static vec< ipa_agg_jf_item_t,
va_gc > * 
context_independent_aggregate_values ()
static bool gather_context_independent_values (struct ipa_node_params *info, vec< tree > *known_csts, vec< tree > *known_binfos, vec< ipa_agg_jump_function_t > *known_aggs, int *removable_params_cost)
static vec
< ipa_agg_jump_function_p
agg_jmp_p_vec_for_t_vec ()
static void estimate_local_effects ()
static void add_val_to_toposort ()
static void add_all_node_vals_to_toposort ()
static void propagate_constants_topo ()
static int safe_add ()
static void propagate_effects ()
static void ipcp_propagate_stage ()
static void ipcp_discover_new_direct_edges (struct cgraph_node *node, vec< tree > known_vals, struct ipa_agg_replacement_value *aggvals)
static void grow_next_edge_clone_vector ()
static void ipcp_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, __attribute__((unused)) void *data)
static tree get_clone_agg_value (struct cgraph_node *node, HOST_WIDEST_INT offset, int index)
static bool cgraph_edge_brings_value_p (struct cgraph_edge *cs, struct ipcp_value_source *src)
static struct cgraph_edgeget_next_cgraph_edge_clone ()
static bool get_info_about_necessary_edges (struct ipcp_value *val, int *freq_sum, gcov_type *count_sum, int *caller_count)
static vec< cgraph_edge_pgather_edges_for_value ()
static struct ipa_replace_mapget_replacement_map ()
static void dump_profile_updates (struct cgraph_node *orig_node, struct cgraph_node *new_node)
static void update_profiling_info (struct cgraph_node *orig_node, struct cgraph_node *new_node)
static void update_specialized_profile (struct cgraph_node *new_node, struct cgraph_node *orig_node, gcov_type redirected_sum)
static struct cgraph_nodecreate_specialized_node (struct cgraph_node *node, vec< tree > known_vals, struct ipa_agg_replacement_value *aggvals, vec< cgraph_edge_p > callers)
static void find_more_scalar_values_for_callers_subset (struct cgraph_node *node, vec< tree > known_vals, vec< cgraph_edge_p > callers)
static vec< ipa_agg_jf_item_tcopy_plats_to_inter ()
static void intersect_with_plats (struct ipcp_param_lattices *plats, vec< ipa_agg_jf_item_t > *inter, HOST_WIDE_INT offset)
static vec< ipa_agg_jf_item_tagg_replacements_to_vector (struct cgraph_node *node, int index, HOST_WIDE_INT offset)
static void intersect_with_agg_replacements (struct cgraph_node *node, int index, vec< ipa_agg_jf_item_t > *inter, HOST_WIDE_INT offset)
static vec< ipa_agg_jf_item_tintersect_aggregates_with_edge (struct cgraph_edge *cs, int index, vec< ipa_agg_jf_item_t > inter)
static struct
ipa_agg_replacement_value
find_aggregate_values_for_callers_subset (struct cgraph_node *node, vec< cgraph_edge_p > callers)
static struct
ipa_agg_replacement_value
known_aggs_to_agg_replacement_list ()
static bool cgraph_edge_brings_all_scalars_for_node (struct cgraph_edge *cs, struct cgraph_node *node)
static bool cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs, struct cgraph_node *node)
static void perhaps_add_new_callers ()
static void move_binfos_to_values (vec< tree > known_vals, vec< tree > known_binfos)
DEBUG_FUNCTION bool ipcp_val_in_agg_replacements_p (struct ipa_agg_replacement_value *aggvals, int index, HOST_WIDE_INT offset, tree value)
static bool decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset, struct ipcp_value *val, vec< tree > known_csts, vec< tree > known_binfos)
static bool decide_whether_version_node ()
static void spread_undeadness ()
static bool has_undead_caller_from_outside_scc_p (struct cgraph_node *node, void *data)
static void identify_dead_nodes ()
static void ipcp_decision_stage ()
static unsigned int ipcp_driver ()
static void ipcp_generate_summary ()
static void ipcp_write_summary ()
static void ipcp_read_summary ()
static bool cgraph_gate_cp ()
ipa_opt_pass_dmake_pass_ipa_cp ()

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_valuevalues_topo
static vec< cgraph_edge_pnext_edge_clone

Function Documentation

static void add_all_node_vals_to_toposort ( )
static
static bool add_scalar_value_to_lattice ( struct ipcp_lattice lat,
tree  newval,
struct cgraph_edge cs,
struct ipcp_value src_val,
int  src_idx 
)
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 void add_val_to_toposort ( )
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 void add_value_source ( struct ipcp_value val,
struct cgraph_edge cs,
struct ipcp_value src_val,
int  src_idx,
HOST_WIDE_INT  offset 
)
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 bool add_value_to_lattice ( struct ipcp_lattice lat,
tree  newval,
struct cgraph_edge cs,
struct ipcp_value src_val,
int  src_idx,
HOST_WIDE_INT  offset 
)
static
static vec<ipa_agg_jump_function_p> agg_jmp_p_vec_for_t_vec ( )
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 bool agg_pass_through_permissible_p ( struct ipcp_param_lattices src_plats,
struct ipa_jump_func jfunc 
)
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 vec<ipa_agg_jf_item_t> agg_replacements_to_vector ( struct cgraph_node node,
int  index,
HOST_WIDE_INT  offset 
)
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 void build_toporder_info ( )
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 bool cgraph_edge_brings_all_scalars_for_node ( struct cgraph_edge cs,
struct cgraph_node node 
)
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 bool cgraph_gate_cp ( )
static
Gate for IPCP optimization.   
static vec<ipa_agg_jf_item_t, va_gc>* context_independent_aggregate_values ( )
static
static vec<ipa_agg_jf_item_t> copy_plats_to_inter ( )
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().

static bool decide_about_value ( struct cgraph_node node,
int  index,
HOST_WIDE_INT  offset,
struct ipcp_value val,
vec< tree known_csts,
vec< tree known_binfos 
)
static
static void determine_versionability ( )
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 int devirtualization_time_bonus ( struct cgraph_node node,
vec< tree known_csts,
vec< tree known_binfos,
vec< ipa_agg_jump_function_p known_aggs 
)
static
static void dump_profile_updates ( struct cgraph_node orig_node,
struct cgraph_node new_node 
)
static
static bool edge_within_scc ( )
inlinestatic
static void estimate_local_effects ( )
static
static void find_more_scalar_values_for_callers_subset ( struct cgraph_node node,
vec< tree known_vals,
vec< cgraph_edge_p callers 
)
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 void free_toporder_info ( )
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 bool gather_context_independent_values ( struct ipa_node_params info,
vec< tree > *  known_csts,
vec< tree > *  known_binfos,
vec< ipa_agg_jump_function_t > *  known_aggs,
int *  removable_params_cost 
)
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 vec<cgraph_edge_p> gather_edges_for_value ( )
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 tree get_clone_agg_value ( struct cgraph_node node,
HOST_WIDEST_INT  offset,
int  index 
)
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 bool get_info_about_necessary_edges ( struct ipcp_value val,
int *  freq_sum,
gcov_type count_sum,
int *  caller_count 
)
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().

static struct cgraph_edge* get_next_cgraph_edge_clone ( )
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().

static struct ipa_replace_map* get_replacement_map ( )
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 bool good_cloning_opportunity_p ( struct cgraph_node node,
int  time_benefit,
int  freq_sum,
gcov_type  count_sum,
int  size_cost 
)
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().

static void grow_next_edge_clone_vector ( )
inlinestatic
static bool has_undead_caller_from_outside_scc_p ( struct cgraph_node node,
void *  data 
)
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 int hint_time_bonus ( )
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 void identify_dead_nodes ( )
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().

static void init_caller_stats ( )
inlinestatic
static void intersect_with_agg_replacements ( struct cgraph_node node,
int  index,
vec< ipa_agg_jf_item_t > *  inter,
HOST_WIDE_INT  offset 
)
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 void intersect_with_plats ( struct ipcp_param_lattices plats,
vec< ipa_agg_jf_item_t > *  inter,
HOST_WIDE_INT  offset 
)
static
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 tree ipa_get_indirect_edge_target_1 ( struct cgraph_edge ie,
vec< tree known_vals,
vec< tree known_binfos,
vec< ipa_agg_jump_function_p known_aggs,
struct ipa_agg_replacement_value agg_reps 
)
static
static tree ipa_get_jf_ancestor_result ( )
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 tree ipa_get_jf_pass_through_result ( )
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().

static struct ipcp_lattice* ipa_get_scalar_lat ( )
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().

static bool ipa_lat_is_single_const ( )
inlinestatic
static void ipcp_decision_stage ( )
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 void ipcp_edge_duplication_hook ( struct cgraph_edge src,
struct cgraph_edge dst,
__attribute__((unused)) void *  data 
)
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 void ipcp_generate_summary ( )
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 void ipcp_read_summary ( )
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 bool ipcp_versionable_function_p ( )
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 void ipcp_write_summary ( )
static
Write ipcp summary for nodes in SET.   

References ipa_prop_write_jump_functions().

ipa_opt_pass_d* make_pass_ipa_cp ( )
static bool merge_agg_lats_step ( struct ipcp_param_lattices dest_plats,
HOST_WIDE_INT  offset,
HOST_WIDE_INT  val_size,
struct ipcp_agg_lattice ***  aglat,
bool  pre_existing,
bool *  change 
)
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 bool merge_aggregate_lattices ( struct cgraph_edge cs,
struct ipcp_param_lattices dest_plats,
struct ipcp_param_lattices src_plats,
int  src_idx,
HOST_WIDE_INT  offset_delta 
)
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().

static void move_binfos_to_values ( vec< tree known_vals,
vec< tree known_binfos 
)
static
Copy KNOWN_BINFOS to KNOWN_VALS.   

Referenced by decide_about_value(), and decide_whether_version_node().

static void perhaps_add_new_callers ( )
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().

static struct cgraph_node* pop_node_from_stack ( )
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 void print_ipcp_constant_value ( )
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 void propagate_constants_topo ( )
static
static void propagate_effects ( )
static
static bool propagate_vals_accross_ancestor ( struct cgraph_edge cs,
struct ipa_jump_func jfunc,
struct ipcp_lattice src_lat,
struct ipcp_lattice dest_lat,
int  src_idx 
)
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 bool propagate_vals_accross_pass_through ( struct cgraph_edge cs,
struct ipa_jump_func jfunc,
struct ipcp_lattice src_lat,
struct ipcp_lattice dest_lat,
int  src_idx 
)
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().

static void push_node_to_stack ( )
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 int safe_add ( )
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().

static bool set_agg_lats_contain_variable ( )
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().

static bool set_agg_lats_to_bottom ( )
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().

static bool set_all_contains_variable ( )
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 bool set_chain_of_aglats_contains_variable ( )
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 bool set_check_aggs_by_ref ( struct ipcp_param_lattices dest_plats,
bool  new_aggs_by_ref 
)
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().

static bool set_lattice_contains_variable ( )
inlinestatic
static bool set_lattice_to_bottom ( )
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 void spread_undeadness ( )
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 void update_profiling_info ( struct cgraph_node orig_node,
struct cgraph_node new_node 
)
static
static void update_specialized_profile ( struct cgraph_node new_node,
struct cgraph_node orig_node,
gcov_type  redirected_sum 
)
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().


Variable Documentation

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().

gcov_type max_count
static
Maximal count found in program.   

Referenced by good_cloning_opportunity_p(), ipcp_cloning_candidate_p(), and ipcp_propagate_stage().

long max_new_size
static
vec<cgraph_edge_p> next_edge_clone
static
Vector of pointers which for linked lists of clones of an original crgaph
   edge.  
long overall_size
static
struct ipcp_value* values_topo
static
Head of the linked list of topologically sorted values.  

Referenced by add_val_to_toposort().