summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 90390007456..8d3d6ed1c4b 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -428,7 +428,7 @@ determine_versionability (struct cgraph_node *node)
reason = "alias or thunk";
else if (!node->local.versionable)
reason = "not a tree_versionable_function";
- else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
+ else if (node->get_availability () <= AVAIL_INTERPOSABLE)
reason = "insufficient body availability";
else if (!opt_for_fn (node->decl, optimize)
|| !opt_for_fn (node->decl, flag_ipa_cp))
@@ -442,7 +442,7 @@ determine_versionability (struct cgraph_node *node)
}
/* Don't clone decls local to a comdat group; it breaks and for C++
decloned constructors, inlining is always better anyway. */
- else if (symtab_comdat_local_p (node))
+ else if (node->comdat_local_p ())
reason = "comdat-local function";
if (reason && dump_file && !node->alias && !node->thunk.thunk_p)
@@ -491,8 +491,8 @@ gather_caller_stats (struct cgraph_node *node, void *data)
for (cs = node->callers; cs; cs = cs->next_caller)
if (cs->caller->thunk.thunk_p)
- cgraph_for_node_and_aliases (cs->caller, gather_caller_stats,
- stats, false);
+ cs->caller->call_for_symbol_thunks_and_aliases (gather_caller_stats,
+ stats, false);
else
{
stats->count_sum += cs->count;
@@ -512,7 +512,7 @@ ipcp_cloning_candidate_p (struct cgraph_node *node)
{
struct caller_statistics stats;
- gcc_checking_assert (cgraph_function_with_gimple_body_p (node));
+ gcc_checking_assert (node->has_gimple_body_p ());
if (!flag_ipa_cp_clone)
{
@@ -533,7 +533,7 @@ ipcp_cloning_candidate_p (struct cgraph_node *node)
}
init_caller_stats (&stats);
- cgraph_for_node_and_aliases (node, gather_caller_stats, &stats, false);
+ node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats, false);
if (inline_summary (node)->self_size < stats.n_calls)
{
@@ -698,7 +698,7 @@ initialize_node_lattices (struct cgraph_node *node)
bool disable = false, variable = false;
int i;
- gcc_checking_assert (cgraph_function_with_gimple_body_p (node));
+ gcc_checking_assert (node->has_gimple_body_p ());
if (!node->local.local)
{
/* When cloning is allowed, we can assume that externally visible
@@ -897,7 +897,7 @@ ipcp_verify_propagated_values (void)
{
if (dump_file)
{
- dump_symtab (dump_file);
+ symtab_node::dump_table (dump_file);
fprintf (dump_file, "\nIPA lattices after constant "
"propagation, before gcc_unreachable:\n");
print_all_lattices (dump_file, true, false);
@@ -1435,10 +1435,10 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
bool ret = false;
int i, args_count, parms_count;
- callee = cgraph_function_node (cs->callee, &availability);
+ callee = cs->callee->function_symbol (&availability);
if (!callee->definition)
return false;
- gcc_checking_assert (cgraph_function_with_gimple_body_p (callee));
+ gcc_checking_assert (callee->has_gimple_body_p ());
callee_info = IPA_NODE_REF (callee);
args = IPA_EDGE_REF (cs);
@@ -1452,7 +1452,7 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
of aliases first. */
alias_or_thunk = cs->callee;
while (alias_or_thunk->alias)
- alias_or_thunk = cgraph_alias_target (alias_or_thunk);
+ alias_or_thunk = alias_or_thunk->get_alias_target ();
if (alias_or_thunk->thunk.thunk_p)
{
ret |= set_all_contains_variable (ipa_get_parm_lattices (callee_info,
@@ -1468,7 +1468,7 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
struct ipcp_param_lattices *dest_plats;
dest_plats = ipa_get_parm_lattices (callee_info, i);
- if (availability == AVAIL_OVERWRITABLE)
+ if (availability == AVAIL_INTERPOSABLE)
ret |= set_all_contains_variable (dest_plats);
else
{
@@ -1599,7 +1599,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
if ((TREE_CODE (TREE_TYPE (target)) == FUNCTION_TYPE
&& DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE)
|| !possible_polymorphic_call_target_p
- (ie, cgraph_get_node (target)))
+ (ie, cgraph_node::get (target)))
target = ipa_impossible_devirt_target (ie, target);
return target;
}
@@ -1647,7 +1647,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
}
if (target && !possible_polymorphic_call_target_p (ie,
- cgraph_get_node (target)))
+ cgraph_node::get (target)))
target = ipa_impossible_devirt_target (ie, target);
return target;
@@ -1694,10 +1694,10 @@ devirtualization_time_bonus (struct cgraph_node *node,
/* Only bare minimum benefit for clearly un-inlineable targets. */
res += 1;
- callee = cgraph_get_node (target);
+ callee = cgraph_node::get (target);
if (!callee || !callee->definition)
continue;
- callee = cgraph_function_node (callee, &avail);
+ callee = callee->function_symbol (&avail);
if (avail < AVAIL_AVAILABLE)
continue;
isummary = inline_summary (callee);
@@ -1931,7 +1931,8 @@ estimate_local_effects (struct cgraph_node *node)
int time, size;
init_caller_stats (&stats);
- cgraph_for_node_and_aliases (node, gather_caller_stats, &stats, false);
+ node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats,
+ false);
estimate_ipcp_clone_size_and_time (node, known_csts, known_binfos,
known_aggs_ptrs, &size, &time, &hints);
time -= devirtualization_time_bonus (node, known_csts, known_binfos,
@@ -1945,7 +1946,7 @@ estimate_local_effects (struct cgraph_node *node)
"time_benefit: %i\n", size, base_time - time);
if (size <= 0
- || cgraph_will_be_removed_from_program_if_no_direct_calls (node))
+ || node->will_be_removed_from_program_if_no_direct_calls_p ())
{
info->do_clone_for_all_contexts = true;
base_time = time;
@@ -2207,12 +2208,12 @@ propagate_constants_topo (struct topo_info *topo)
{
unsigned j;
struct cgraph_node *v, *node = topo->order[i];
- vec<cgraph_node_ptr> cycle_nodes = ipa_get_nodes_in_cycle (node);
+ vec<cgraph_node *> cycle_nodes = ipa_get_nodes_in_cycle (node);
/* First, iteratively propagate within the strongly connected component
until all lattices stabilize. */
FOR_EACH_VEC_ELT (cycle_nodes, j, v)
- if (cgraph_function_with_gimple_body_p (v))
+ if (v->has_gimple_body_p ())
push_node_to_stack (topo, v);
v = pop_node_from_stack (topo);
@@ -2231,7 +2232,7 @@ propagate_constants_topo (struct topo_info *topo)
the local effects of the discovered constants and all valid values to
their topological sort. */
FOR_EACH_VEC_ELT (cycle_nodes, j, v)
- if (cgraph_function_with_gimple_body_p (v))
+ if (v->has_gimple_body_p ())
{
struct cgraph_edge *cs;
@@ -2314,7 +2315,7 @@ ipcp_propagate_stage (struct topo_info *topo)
struct ipa_node_params *info = IPA_NODE_REF (node);
determine_versionability (node);
- if (cgraph_function_with_gimple_body_p (node))
+ if (node->has_gimple_body_p ())
{
info->lattices = XCNEWVEC (struct ipcp_param_lattices,
ipa_get_param_count (info));
@@ -2407,8 +2408,8 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node,
/* Vector of pointers which for linked lists of clones of an original crgaph
edge. */
-static vec<cgraph_edge_p> next_edge_clone;
-static vec<cgraph_edge_p> prev_edge_clone;
+static vec<cgraph_edge *> next_edge_clone;
+static vec<cgraph_edge *> prev_edge_clone;
static inline void
grow_edge_clone_vectors (void)
@@ -2481,7 +2482,7 @@ cgraph_edge_brings_value_p (struct cgraph_edge *cs,
struct ipcp_value_source *src)
{
struct ipa_node_params *caller_info = IPA_NODE_REF (cs->caller);
- cgraph_node *real_dest = cgraph_function_node (cs->callee);
+ cgraph_node *real_dest = cs->callee->function_symbol ();
struct ipa_node_params *dst_info = IPA_NODE_REF (real_dest);
if ((dst_info->ipcp_orig_node && !dst_info->is_all_contexts_clone)
@@ -2569,11 +2570,11 @@ get_info_about_necessary_edges (struct ipcp_value *val, int *freq_sum,
/* Return a vector of incoming edges that do bring value VAL. It is assumed
their number is known and equal to CALLER_COUNT. */
-static vec<cgraph_edge_p>
+static vec<cgraph_edge *>
gather_edges_for_value (struct ipcp_value *val, int caller_count)
{
struct ipcp_value_source *src;
- vec<cgraph_edge_p> ret;
+ vec<cgraph_edge *> ret;
ret.create (caller_count);
for (src = val->sources; src; src = src->next)
@@ -2657,10 +2658,12 @@ update_profiling_info (struct cgraph_node *orig_node,
return;
init_caller_stats (&stats);
- cgraph_for_node_and_aliases (orig_node, gather_caller_stats, &stats, false);
+ orig_node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats,
+ false);
orig_sum = stats.count_sum;
init_caller_stats (&stats);
- cgraph_for_node_and_aliases (new_node, gather_caller_stats, &stats, false);
+ new_node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats,
+ false);
new_sum = stats.count_sum;
if (orig_node_count < orig_sum + new_sum)
@@ -2755,10 +2758,10 @@ static struct cgraph_node *
create_specialized_node (struct cgraph_node *node,
vec<tree> known_vals,
struct ipa_agg_replacement_value *aggvals,
- vec<cgraph_edge_p> callers)
+ vec<cgraph_edge *> callers)
{
struct ipa_node_params *new_info, *info = IPA_NODE_REF (node);
- vec<ipa_replace_map_p, va_gc> *replace_trees = NULL;
+ vec<ipa_replace_map *, va_gc> *replace_trees = NULL;
struct ipa_agg_replacement_value *av;
struct cgraph_node *new_node;
int i, count = ipa_get_param_count (info);
@@ -2798,8 +2801,8 @@ create_specialized_node (struct cgraph_node *node,
}
}
- new_node = cgraph_create_virtual_clone (node, callers, replace_trees,
- args_to_skip, "constprop");
+ new_node = node->create_virtual_clone (callers, replace_trees,
+ args_to_skip, "constprop");
ipa_set_node_agg_value_chain (new_node, aggvals);
for (av = aggvals; av; av = av->next)
new_node->maybe_add_reference (av->value, IPA_REF_ADDR, NULL);
@@ -2830,7 +2833,7 @@ create_specialized_node (struct cgraph_node *node,
static void
find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
vec<tree> known_vals,
- vec<cgraph_edge_p> callers)
+ vec<cgraph_edge *> callers)
{
struct ipa_node_params *info = IPA_NODE_REF (node);
int i, count = ipa_get_param_count (info);
@@ -3139,7 +3142,7 @@ intersect_aggregates_with_edge (struct cgraph_edge *cs, int index,
static struct ipa_agg_replacement_value *
find_aggregate_values_for_callers_subset (struct cgraph_node *node,
- vec<cgraph_edge_p> callers)
+ vec<cgraph_edge *> callers)
{
struct ipa_node_params *dest_info = IPA_NODE_REF (node);
struct ipa_agg_replacement_value *res = NULL;
@@ -3346,10 +3349,9 @@ perhaps_add_new_callers (struct cgraph_node *node, struct ipcp_value *val)
while (cs)
{
enum availability availability;
- struct cgraph_node *dst = cgraph_function_node (cs->callee,
- &availability);
+ struct cgraph_node *dst = cs->callee->function_symbol (&availability);
if ((dst == node || IPA_NODE_REF (dst)->is_all_contexts_clone)
- && availability > AVAIL_OVERWRITABLE
+ && availability > AVAIL_INTERPOSABLE
&& cgraph_edge_brings_value_p (cs, src))
{
if (cgraph_edge_brings_all_scalars_for_node (cs, val->spec_node)
@@ -3422,7 +3424,7 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
struct ipa_agg_replacement_value *aggvals;
int freq_sum, caller_count;
gcov_type count_sum;
- vec<cgraph_edge_p> callers;
+ vec<cgraph_edge *> callers;
vec<tree> kv;
if (val->spec_node)
@@ -3542,14 +3544,14 @@ decide_whether_version_node (struct cgraph_node *node)
if (info->do_clone_for_all_contexts)
{
struct cgraph_node *clone;
- vec<cgraph_edge_p> callers;
+ vec<cgraph_edge *> callers;
if (dump_file)
fprintf (dump_file, " - Creating a specialized node of %s/%i "
"for all known contexts.\n", node->name (),
node->order);
- callers = collect_callers_of_node (node);
+ callers = node->collect_callers ();
move_binfos_to_values (known_csts, known_binfos);
clone = create_specialized_node (node, known_csts,
known_aggs_to_agg_replacement_list (known_aggs),
@@ -3582,7 +3584,7 @@ spread_undeadness (struct cgraph_node *node)
struct cgraph_node *callee;
struct ipa_node_params *info;
- callee = cgraph_function_node (cs->callee, NULL);
+ callee = cs->callee->function_symbol (NULL);
info = IPA_NODE_REF (callee);
if (info->node_dead)
@@ -3604,9 +3606,8 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node,
for (cs = node->callers; cs; cs = cs->next_caller)
if (cs->caller->thunk.thunk_p
- && cgraph_for_node_and_aliases (cs->caller,
- has_undead_caller_from_outside_scc_p,
- NULL, true))
+ && cs->caller->call_for_symbol_thunks_and_aliases
+ (has_undead_caller_from_outside_scc_p, NULL, true))
return true;
else if (!ipa_edge_within_scc (cs)
&& !IPA_NODE_REF (cs->caller)->node_dead)
@@ -3623,10 +3624,9 @@ identify_dead_nodes (struct cgraph_node *node)
{
struct cgraph_node *v;
for (v = node; v ; v = ((struct ipa_dfs_info *) v->aux)->next_cycle)
- if (cgraph_will_be_removed_from_program_if_no_direct_calls (v)
- && !cgraph_for_node_and_aliases (v,
- has_undead_caller_from_outside_scc_p,
- NULL, true))
+ if (v->will_be_removed_from_program_if_no_direct_calls_p ()
+ && !v->call_for_symbol_thunks_and_aliases
+ (has_undead_caller_from_outside_scc_p, NULL, true))
IPA_NODE_REF (v)->node_dead = 1;
for (v = node; v ; v = ((struct ipa_dfs_info *) v->aux)->next_cycle)
@@ -3663,7 +3663,7 @@ ipcp_decision_stage (struct topo_info *topo)
struct cgraph_node *v;
iterate = false;
for (v = node; v ; v = ((struct ipa_dfs_info *) v->aux)->next_cycle)
- if (cgraph_function_with_gimple_body_p (v)
+ if (v->has_gimple_body_p ()
&& ipcp_versionable_function_p (v))
iterate |= decide_whether_version_node (v);