]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* function.c (assign_parms): Don't count pretend args for alignment.
authorPaul Brook <paul@codesourcery.com>
Fri, 27 Feb 2004 12:02:55 +0000 (12:02 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Fri, 27 Feb 2004 12:02:55 +0000 (12:02 +0000)
From-SVN: r78563

gcc/ChangeLog
gcc/function.c

index 75a5453bb95b4d9f05c62d4e67fd186a2fc1e368..5a7723e24a068c4a4ff0d4cbd20767dce11ca018 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-27  Paul Brook  <paul@codesourcery.com>
+
+       * function.c (assign_parms): Don't count pretend args for alignment.
+
 2004-02-27  Richard Henderson  <rth@redhat.com>
 
        * passes.c: New file.
index b811f3d0e18e4ea891ed528fb29e9aad7ca5f30f..84f0e853d7e564e85f748d04c98da61c52fddabe 100644 (file)
@@ -4285,6 +4285,7 @@ assign_parms (tree fndecl)
   /* Total space needed so far for args on the stack,
      given as a constant and a tree-expression.  */
   struct args_size stack_args_size;
+  HOST_WIDE_INT extra_pretend_bytes = 0;
   tree fntype = TREE_TYPE (fndecl);
   tree fnargs = DECL_ARGUMENTS (fndecl), orig_fnargs;
   /* This is used for the arg pointer when referring to stack args.  */
@@ -4569,15 +4570,19 @@ assign_parms (tree fndecl)
                 bits.  We must preserve this invariant by rounding
                 CURRENT_FUNCTION_PRETEND_ARGS_SIZE up to a stack
                 boundary.  */
+
+             /* We assume at most one partial arg, and it must be the first
+                argument on the stack.  */
+             if (extra_pretend_bytes || current_function_pretend_args_size)
+               abort ();
+
              pretend_bytes = partial * UNITS_PER_WORD;
              current_function_pretend_args_size
                = CEIL_ROUND (pretend_bytes, STACK_BYTES);
 
-             /* If PRETEND_BYTES != CURRENT_FUNCTION_PRETEND_ARGS_SIZE,
-                insert the padding before the start of the first pretend
-                argument.  */
-             stack_args_size.constant
-               = (current_function_pretend_args_size - pretend_bytes);
+             /* We want to align relative to the actual stack pointer, so
+                don't include this in the stack size until later.  */
+             extra_pretend_bytes = current_function_pretend_args_size;
            }
        }
 #endif
@@ -4586,6 +4591,13 @@ assign_parms (tree fndecl)
       locate_and_pad_parm (promoted_mode, passed_type, in_regs,
                           entry_parm ? partial : 0, fndecl,
                           &stack_args_size, &locate);
+      /* Adjust offsets to include pretend args, unless this is the
+         split arg.  */
+      if (pretend_bytes == 0)
+       {
+         locate.slot_offset.constant += extra_pretend_bytes;
+         locate.offset.constant += extra_pretend_bytes;
+       }
 
       {
        rtx offset_rtx;
@@ -4661,7 +4673,7 @@ assign_parms (tree fndecl)
 #endif
          )
        {
-         stack_args_size.constant += pretend_bytes + locate.size.constant;
+         stack_args_size.constant += locate.size.constant;
          if (locate.size.var)
            ADD_PARM_SIZE (stack_args_size, locate.size.var);
        }
@@ -5273,6 +5285,8 @@ assign_parms (tree fndecl)
 
   last_parm_insn = get_last_insn ();
 
+  /* We have aligned all the args, so add space for the pretend args.  */
+  stack_args_size.constant += extra_pretend_bytes;
   current_function_args_size = stack_args_size.constant;
 
   /* Adjust function incoming argument size for alignment and