OSDN Git Service

* function.c (assign_parms): For a struct value address passed as
authorhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Mar 2003 16:23:50 +0000 (16:23 +0000)
committerhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Mar 2003 16:23:50 +0000 (16:23 +0000)
first argument, delay the function's result RTL setup code until
after the emission of parameter conversions.

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

gcc/ChangeLog
gcc/function.c

index d8f49d0..905cb24 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-17  Olivier Hainque  <hainque@act-europe.fr>
+
+       * function.c (assign_parms): For a struct value address passed as
+       first argument, delay the function's result RTL setup code until
+       after the emission of parameter conversions.
+       
 2003-03-17  Dave Love  <fx@gnu.org>
            Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
index 4df1800..0828969 100644 (file)
@@ -5009,30 +5009,32 @@ assign_parms (fndecl)
 
          SET_DECL_RTL (parm, stack_parm);
        }
-
-      /* If this "parameter" was the place where we are receiving the
-        function's incoming structure pointer, set up the result.  */
-      if (parm == function_result_decl)
-       {
-         tree result = DECL_RESULT (fndecl);
-         rtx addr = DECL_RTL (parm);
-         rtx x;
-
-#ifdef POINTERS_EXTEND_UNSIGNED
-         if (GET_MODE (addr) != Pmode)
-           addr = convert_memory_address (Pmode, addr);
-#endif
-
-         x = gen_rtx_MEM (DECL_MODE (result), addr);
-         set_mem_attributes (x, result, 1);
-         SET_DECL_RTL (result, x);
-       }
     }
 
   /* Output all parameter conversion instructions (possibly including calls)
      now that all parameters have been copied out of hard registers.  */
   emit_insn (conversion_insns);
 
+  /* If we are receiving a struct value address as the first argument, set up
+     the RTL for the function result. As this might require code to convert
+     the transmitted address to Pmode, we do this here to ensure that possible
+     preliminary conversions of the address have been emitted already.  */
+  if (function_result_decl)
+    {
+      tree result = DECL_RESULT (fndecl);
+      rtx addr = DECL_RTL (function_result_decl);
+      rtx x;
+      
+#ifdef POINTERS_EXTEND_UNSIGNED
+      if (GET_MODE (addr) != Pmode)
+       addr = convert_memory_address (Pmode, addr);
+#endif
+      
+      x = gen_rtx_MEM (DECL_MODE (result), addr);
+      set_mem_attributes (x, result, 1);
+      SET_DECL_RTL (result, x);
+    }
+
   last_parm_insn = get_last_insn ();
 
   current_function_args_size = stack_args_size.constant;