aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2011-01-03 14:06:54 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2011-01-03 14:06:54 +0100
commitce47fda3ce6adfe86f725930dedbfb1f775ddd45 (patch)
treea0198b9cc6e29df5e3c9c571f5a99db84117cc75 /gcc/cgraph.c
parentfd0bcb5af982e58e40c5fad1eb0d1a54316b2807 (diff)
downloadgcc-ce47fda3ce6adfe86f725930dedbfb1f775ddd45.zip
gcc-ce47fda3ce6adfe86f725930dedbfb1f775ddd45.tar.gz
gcc-ce47fda3ce6adfe86f725930dedbfb1f775ddd45.tar.bz2
re PR tree-optimization/46984 (g++.dg/torture/pr45699.C FAILs with -fno-early-inlining -flto)
2011-01-03 Martin Jambor <mjambor@suse.cz> PR tree-optimization/46984 * cgraph.h (cgraph_indirect_call_info): make field thunk_delta HOST_WIDE_INT. (cgraph_create_indirect_edge): Fixed line length. (cgraph_indirect_call_info): Declare. (cgraph_make_edge_direct) Update declaration. * cgraph.c (cgraph_allocate_init_indirect_info): New function. (cgraph_create_indirect_edge): Use it. (cgraph_make_edge_direct): Made delta HOST_WIDE_INT. Updated all callees. * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update for the new thunk_delta representation. * ipa-prop.c (ipa_make_edge_direct_to_target): Convert delta to HOST_WIDE_INT. (ipa_write_indirect_edge_info): Remove streaming of thunk_delta. (ipa_read_indirect_edge_info): Likewise. * lto-cgraph.c (output_edge_opt_summary): New function. (output_node_opt_summary): Call it on all outgoing edges. (input_edge_opt_summary): New function. (input_node_opt_summary): Call it on all outgoing edges. * testsuite/g++.dg/ipa/pr46984.C: New test. From-SVN: r168420
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index f96bd64..c8f9b04 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -860,7 +860,7 @@ cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
indirect call into a direct one. */
struct cgraph_node *new_callee = cgraph_node (decl);
- cgraph_make_edge_direct (e, new_callee, NULL);
+ cgraph_make_edge_direct (e, new_callee, 0);
}
push_cfun (DECL_STRUCT_FUNCTION (e->caller->decl));
@@ -1070,6 +1070,17 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee,
return edge;
}
+/* Allocate cgraph_indirect_call_info and set its fields to default values. */
+
+struct cgraph_indirect_call_info *
+cgraph_allocate_init_indirect_info (void)
+{
+ struct cgraph_indirect_call_info *ii;
+
+ ii = ggc_alloc_cleared_cgraph_indirect_call_info ();
+ ii->param_index = -1;
+ return ii;
+}
/* Create an indirect edge with a yet-undetermined callee where the call
statement destination is a formal parameter of the caller with index
@@ -1086,8 +1097,7 @@ cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt,
edge->indirect_unknown_callee = 1;
initialize_inline_failed (edge);
- edge->indirect_info = ggc_alloc_cleared_cgraph_indirect_call_info ();
- edge->indirect_info->param_index = -1;
+ edge->indirect_info = cgraph_allocate_init_indirect_info ();
edge->indirect_info->ecf_flags = ecf_flags;
edge->next_callee = caller->indirect_calls;
@@ -1195,12 +1205,12 @@ cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n)
}
/* Make an indirect EDGE with an unknown callee an ordinary edge leading to
- CALLEE. DELTA, if non-NULL, is an integer constant that is to be added to
- the this pointer (first parameter). */
+ CALLEE. DELTA is an integer constant that is to be added to the this
+ pointer (first parameter) to compensate for skipping a thunk adjustment. */
void
cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee,
- tree delta)
+ HOST_WIDE_INT delta)
{
edge->indirect_unknown_callee = 0;
edge->indirect_info->thunk_delta = delta;