aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2009-11-11 21:57:20 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2009-11-11 20:57:20 +0000
commit811232fe06c205ffaab2f41c8701d974947ac05d (patch)
tree008149a3f7f77ef2ec3b2c71d9baf2eebe63aa85
parent5fae76b1004f5f6d195b000d5866703a4d2faf91 (diff)
downloadgcc-811232fe06c205ffaab2f41c8701d974947ac05d.zip
gcc-811232fe06c205ffaab2f41c8701d974947ac05d.tar.gz
gcc-811232fe06c205ffaab2f41c8701d974947ac05d.tar.bz2
(patch by Richard Guenther)
(patch by Richard Guenther) * lto-streamer-out.c (output_function): Output head of argument list earlier. * lto-streamer-in.c (input_function): Re-map arguments into merged declaration. From-SVN: r154105
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/lto-streamer-in.c20
-rw-r--r--gcc/lto-streamer-out.c6
3 files changed, 28 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d3cf1951..3e4d5be 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2009-11-11 Jan Hubicka <jh@suse.cz>
+ (patch by Richard Guenther)
+ * lto-streamer-out.c (output_function): Output head of argument list
+ earlier.
+ * lto-streamer-in.c (input_function): Re-map arguments into merged
+ declaration.
+
+2009-11-11 Jan Hubicka <jh@suse.cz>
+
* lto-cgraph.c: Include gcov-io.h
(output_profile_summary): New function.
(output_cgraph): Use it.
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 7e1559c..59784a4 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1262,6 +1262,7 @@ input_function (tree fn_decl, struct data_in *data_in,
basic_block bb;
struct bitpack_d *bp;
struct cgraph_node *node;
+ tree args, narg, oarg;
fn = DECL_STRUCT_FUNCTION (fn_decl);
tag = input_record_start (ib);
@@ -1296,6 +1297,22 @@ input_function (tree fn_decl, struct data_in *data_in,
/* Read all the local symbols. */
fn->local_decls = lto_input_tree (ib, data_in);
+ /* Read all function arguments. We need to re-map them here to the
+ arguments of the merged function declaration. */
+ args = lto_input_tree (ib, data_in);
+ for (oarg = args, narg = DECL_ARGUMENTS (fn_decl);
+ oarg && narg;
+ oarg = TREE_CHAIN (oarg), narg = TREE_CHAIN (narg))
+ {
+ int ix;
+ bool res;
+ res = lto_streamer_cache_lookup (data_in->reader_cache, oarg, &ix);
+ gcc_assert (res);
+ /* Replace the argument in the streamer cache. */
+ lto_streamer_cache_insert_at (data_in->reader_cache, narg, ix);
+ }
+ gcc_assert (!oarg && !narg);
+
/* Read all the SSA names. */
input_ssa_names (ib, data_in, fn);
@@ -1307,9 +1324,6 @@ input_function (tree fn_decl, struct data_in *data_in,
gcc_assert (DECL_INITIAL (fn_decl));
DECL_SAVED_TREE (fn_decl) = NULL_TREE;
- /* Read all function arguments. */
- DECL_ARGUMENTS (fn_decl) = lto_input_tree (ib, data_in);
-
/* Read all the basic blocks. */
tag = input_record_start (ib);
while (tag)
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index fee2372..1c5f910 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1870,6 +1870,9 @@ output_function (struct cgraph_node *node)
/* Output all the local variables in the function. */
lto_output_tree_ref (ob, fn->local_decls);
+ /* Output the head of the arguments list. */
+ lto_output_tree_ref (ob, DECL_ARGUMENTS (function));
+
/* Output all the SSA names used in the function. */
output_ssa_names (ob, fn);
@@ -1880,9 +1883,6 @@ output_function (struct cgraph_node *node)
lexical scopes. */
lto_output_tree (ob, DECL_INITIAL (function), true);
- /* Output the head of the arguments list. */
- lto_output_tree_ref (ob, DECL_ARGUMENTS (function));
-
/* We will renumber the statements. The code that does this uses
the same ordering that we use for serializing them so we can use
the same code on the other end and not have to write out the