summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authormkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-15 03:46:08 +0000
committermkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-15 03:46:08 +0000
commit20da201369da65e2415c4671b9419bcc0b0eb3fa (patch)
tree1efbbc4ccd7ffb98f0069e2281a731e60cdb0fa3 /gcc/ipa-cp.c
parent370d7c073ee1faca205f178d3ee4acab92a00cff (diff)
downloadgcc-20da201369da65e2415c4671b9419bcc0b0eb3fa.tar.gz
* ipa-cp.c (ipa_value_from_jfunc): Make global.
(ipa_cst_from_jfunc): Remove, use ipa_value_from_jfunc instead. (get_indirect_edge_target): Rename, make global. (devirtualization_time_bonus, estimate_local_effects,) (ipcp_discover_new_direct_edges): Update. * ipa-inline-analysis.c (evaluate_conditions_for_edge): Generalize to also handle types. Rename to ... (evaluate_properties_for_edge): Use instead of evaluate_conditions_for_edge. (estimate_edge_devirt_benefit): New function. (estimate_calls_size_and_time): Use it. (estimate_node_size_and_time, estimate_ipcp_clone_size_and_time,) (inline_merge_summary): Update. (do_estimate_edge_time, do_estimate_edge_growth): Update. Calculate parameter information at the call site and pass it on to subroutines. * tree-inline.c (estimate_num_insns): Distinguish between direct and indirect calls. (init_inline_once): Set size and time costs or indirect calls. * tree-inline.h (eni_weights): Add indirect_call_cost. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181377 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 45cb00b2169..10e1834ce7b 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -693,7 +693,7 @@ ipa_value_from_known_type_jfunc (struct ipa_jump_func *jfunc)
describes the caller node so that pass-through jump functions can be
evaluated. */
-static tree
+tree
ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
{
if (jfunc->type == IPA_JF_CONST)
@@ -753,21 +753,6 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
return NULL_TREE;
}
-/* Determine whether JFUNC evaluates to a constant and if so, return it.
- Otherwise return NULL. INFO describes the caller node so that pass-through
- jump functions can be evaluated. */
-
-tree
-ipa_cst_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
-{
- tree res = ipa_value_from_jfunc (info, jfunc);
-
- if (res && TREE_CODE (res) == TREE_BINFO)
- return NULL_TREE;
- else
- return res;
-}
-
/* 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
@@ -1112,10 +1097,10 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
(which can contain both constants and binfos) or KNOWN_BINFOS (which can be
NULL) return the destination. */
-static tree
-get_indirect_edge_target (struct cgraph_edge *ie,
- VEC (tree, heap) *known_vals,
- VEC (tree, heap) *known_binfos)
+tree
+ipa_get_indirect_edge_target (struct cgraph_edge *ie,
+ VEC (tree, heap) *known_vals,
+ VEC (tree, heap) *known_binfos)
{
int param_index = ie->indirect_info->param_index;
HOST_WIDE_INT token, anc_offset;
@@ -1185,7 +1170,7 @@ devirtualization_time_bonus (struct cgraph_node *node,
struct inline_summary *isummary;
tree target;
- target = get_indirect_edge_target (ie, known_csts, known_binfos);
+ target = ipa_get_indirect_edge_target (ie, known_csts, known_binfos);
if (!target)
continue;
@@ -1344,7 +1329,8 @@ estimate_local_effects (struct cgraph_node *node)
init_caller_stats (&stats);
cgraph_for_node_and_aliases (node, gather_caller_stats, &stats, false);
- estimate_ipcp_clone_size_and_time (node, known_csts, &size, &time);
+ estimate_ipcp_clone_size_and_time (node, known_csts, known_binfos,
+ &size, &time);
time -= devirtualization_time_bonus (node, known_csts, known_binfos);
time -= removable_params_cost;
size -= stats.n_calls * removable_params_cost;
@@ -1415,7 +1401,8 @@ estimate_local_effects (struct cgraph_node *node)
else
continue;
- estimate_ipcp_clone_size_and_time (node, known_csts, &size, &time);
+ estimate_ipcp_clone_size_and_time (node, known_csts, known_binfos,
+ &size, &time);
time_benefit = base_time - time
+ devirtualization_time_bonus (node, known_csts, known_binfos)
+ removable_params_cost + emc;
@@ -1673,7 +1660,7 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node,
tree target;
next_ie = ie->next_callee;
- target = get_indirect_edge_target (ie, known_vals, NULL);
+ target = ipa_get_indirect_edge_target (ie, known_vals, NULL);
if (target)
ipa_make_edge_direct_to_target (ie, target);
}