OSDN Git Service

(patch by Richard Guenther)
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Nov 2009 20:57:20 +0000 (20:57 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Nov 2009 20:57:20 +0000 (20:57 +0000)
* lto-streamer-out.c (output_function): Output head of argument list
earlier.
* lto-streamer-in.c (input_function): Re-map arguments into merged
declaration.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154105 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/lto-streamer-in.c
gcc/lto-streamer-out.c

index d3cf195..3e4d5be 100644 (file)
@@ -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.
index 7e1559c..59784a4 100644 (file)
@@ -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)
index fee2372..1c5f910 100644 (file)
@@ -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