aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-05-08 21:14:24 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-05-08 19:14:24 +0000
commit74605a11f3c482656558d332058870d15cc718d5 (patch)
treebacaa437c56da65959eaf4a81ceee12d963848df /gcc/cgraph.c
parent5c04950727f2a7a0e00c07776a417f24aea7da9a (diff)
downloadgcc-74605a11f3c482656558d332058870d15cc718d5.zip
gcc-74605a11f3c482656558d332058870d15cc718d5.tar.gz
gcc-74605a11f3c482656558d332058870d15cc718d5.tar.bz2
cgraph.c (cgraph_clone_node): Add call_duplication_hook parameter.
* cgraph.c (cgraph_clone_node): Add call_duplication_hook parameter. (cgraph_create_virtual_clone): Call hooks once virtual clone is finished. * cgraph.h (cgraph_clone_node): Update prototype. * ipa-cp.c (ipcp_estimate_growth): Use estimate_ipcp_clone_size_and_time. * ipa-inline-transform.c (clone_inlined_nodes): Update. * lto-cgraph.c (input_node): Update. * ipa-inline.c (recursive_inlining): Update. * ipa-inline.h (estimate_ipcp_clone_size_and_time): New function. (evaluate_conditions_for_known_args): Break out from ... (evaluate_conditions_for_edge): ... here. (evaluate_conditions_for_ipcp_clone): New function. (inline_node_duplication_hook): Update clone summary based on parameter map. (estimate_callee_size_and_time): Rename to ... (estimate_node_size_and_time): take NODE instead of EDGE; take POSSIBLE_TRUTHS as argument. (estimate_callee_size_and_time): Update. (estimate_ipcp_clone_size_and_time): New function. (do_estimate_edge_time): Update. From-SVN: r173551
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 1f6f89f..a6d5482 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2128,6 +2128,7 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
return new_edge;
}
+
/* Create node representing clone of N executed COUNT times. Decrease
the execution counts from original node too.
The new clone will have decl set to DECL that may or may not be the same
@@ -2135,11 +2136,15 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
When UPDATE_ORIGINAL is true, the counts are subtracted from the original
function's profile to reflect the fact that part of execution is handled
- by node. */
+ by node.
+ When CALL_DUPLICATOIN_HOOK is true, the ipa passes are acknowledged about
+ the new clone. Otherwise the caller is responsible for doing so later. */
+
struct cgraph_node *
cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
bool update_original,
- VEC(cgraph_edge_p,heap) *redirect_callers)
+ VEC(cgraph_edge_p,heap) *redirect_callers,
+ bool call_duplication_hook)
{
struct cgraph_node *new_node = cgraph_create_node_1 ();
struct cgraph_edge *e;
@@ -2202,7 +2207,6 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
n->clones = new_node;
new_node->clone_of = n;
- cgraph_call_node_duplication_hooks (n, new_node);
if (n->decl != decl)
{
struct cgraph_node **slot;
@@ -2221,6 +2225,9 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
*aslot = new_node;
}
}
+
+ if (call_duplication_hook)
+ cgraph_call_node_duplication_hooks (n, new_node);
return new_node;
}
@@ -2287,7 +2294,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
new_node = cgraph_clone_node (old_node, new_decl, old_node->count,
CGRAPH_FREQ_BASE, false,
- redirect_callers);
+ redirect_callers, false);
/* Update the properties.
Make clone visible only within this translation unit. Make sure
that is not weak also.
@@ -2358,6 +2365,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
new_node->lowered = true;
new_node->reachable = true;
+ cgraph_call_node_duplication_hooks (old_node, new_node);
+
return new_node;
}