summaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-03 13:06:54 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-03 13:06:54 +0000
commit9bab6a7004187addfae6852c402f4d1b36e6cc54 (patch)
treea0198b9cc6e29df5e3c9c571f5a99db84117cc75 /gcc/lto-cgraph.c
parent250aef672e1268e8f502b6d93a0d7fd88100b216 (diff)
downloadgcc-9bab6a7004187addfae6852c402f4d1b36e6cc54.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168420 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 76597a000ee..96697e4ecdc 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1605,6 +1605,18 @@ output_cgraph_opt_summary_p (struct cgraph_node *node)
|| node->clone.combined_args_to_skip);
}
+/* Output optimization summary for EDGE to OB. */
+static void
+output_edge_opt_summary (struct output_block *ob,
+ struct cgraph_edge *edge)
+{
+ if (edge->indirect_info)
+ lto_output_sleb128_stream (ob->main_stream,
+ edge->indirect_info->thunk_delta);
+ else
+ lto_output_sleb128_stream (ob->main_stream, 0);
+}
+
/* Output optimization summary for NODE to OB. */
static void
@@ -1616,6 +1628,7 @@ output_node_opt_summary (struct output_block *ob,
struct ipa_replace_map *map;
struct bitpack_d bp;
int i;
+ struct cgraph_edge *e;
lto_output_uleb128_stream (ob->main_stream,
bitmap_count_bits (node->clone.args_to_skip));
@@ -1646,6 +1659,10 @@ output_node_opt_summary (struct output_block *ob,
bp_pack_value (&bp, map->ref_p, 1);
lto_output_bitpack (&bp);
}
+ for (e = node->callees; e; e = e->next_callee)
+ output_edge_opt_summary (ob, e);
+ for (e = node->indirect_calls; e; e = e->next_callee)
+ output_edge_opt_summary (ob, e);
}
/* Output optimization summaries stored in callgraph.
@@ -1680,7 +1697,23 @@ output_cgraph_opt_summary (void)
destroy_output_block (ob);
}
-/* Input optimiation summary of NODE. */
+/* Input optimisation summary of EDGE. */
+
+static void
+input_edge_opt_summary (struct cgraph_edge *edge,
+ struct lto_input_block *ib_main)
+{
+ HOST_WIDE_INT thunk_delta;
+ thunk_delta = lto_input_sleb128 (ib_main);
+ if (thunk_delta != 0)
+ {
+ gcc_assert (!edge->indirect_info);
+ edge->indirect_info = cgraph_allocate_init_indirect_info ();
+ edge->indirect_info->thunk_delta = thunk_delta;
+ }
+}
+
+/* Input optimisation summary of NODE. */
static void
input_node_opt_summary (struct cgraph_node *node,
@@ -1691,6 +1724,7 @@ input_node_opt_summary (struct cgraph_node *node,
int count;
int bit;
struct bitpack_d bp;
+ struct cgraph_edge *e;
count = lto_input_uleb128 (ib_main);
if (count)
@@ -1726,6 +1760,10 @@ input_node_opt_summary (struct cgraph_node *node,
map->replace_p = bp_unpack_value (&bp, 1);
map->ref_p = bp_unpack_value (&bp, 1);
}
+ for (e = node->callees; e; e = e->next_callee)
+ input_edge_opt_summary (e, ib_main);
+ for (e = node->indirect_calls; e; e = e->next_callee)
+ input_edge_opt_summary (e, ib_main);
}
/* Read section in file FILE_DATA of length LEN with data DATA. */