* sparc.c (sparc_flat_compute_frame_size): Correctly calc args_size
authorscox <scox@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Nov 1998 11:04:17 +0000 (11:04 +0000)
committerscox <scox@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Nov 1998 11:04:17 +0000 (11:04 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23634 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/sparc/sparc.c

index daeb7e9..f627228 100644 (file)
@@ -1,3 +1,8 @@
+Fri Nov 13 11:02:11 1998  Stan Cox  <scox@cygnus.com>
+
+       * sparc.c (sparc_flat_compute_frame_size): Correctly calc args_size
+       in a leaf function.  Clarify total_size/extra_size relationship.
+
 Thu Nov 12 19:20:57 1998  Geoffrey Noer  <noer@cygnus.com>
 
        * i386/cygwin32.asm: Delete.
index 686350b..f3e48c8 100644 (file)
@@ -5630,18 +5630,23 @@ sparc_flat_compute_frame_size (size)
 
   /* This is the size of the 16 word reg save area, 1 word struct addr
      area, and 4 word fp/alu register copy area.  */
-  extra_size    = -STARTING_FRAME_OFFSET + FIRST_PARM_OFFSET(0);
-  var_size      = size;
-  /* Also include the size needed for the 6 parameter registers.  */
-  args_size     = current_function_outgoing_args_size + 24;
-  total_size    = var_size + args_size + extra_size;
-  gp_reg_size   = 0;
-  fp_reg_size   = 0;
-  gmask                 = 0;
-  fmask                 = 0;
-  reg_offset    = 0;
+  extra_size = -STARTING_FRAME_OFFSET + FIRST_PARM_OFFSET(0);
+  var_size = size;
+  gp_reg_size = 0;
+  fp_reg_size = 0;
+  gmask = 0;
+  fmask = 0;
+  reg_offset = 0;
   need_aligned_p = 0;
 
+  args_size = 0;
+  if (!leaf_function_p ())
+    {
+      /* Also include the size needed for the 6 parameter registers.  */
+      args_size = current_function_outgoing_args_size + 24;
+    }
+  total_size = var_size + args_size;
+
   /* Calculate space needed for gp registers.  */
   for (regno = 1; regno <= 31; regno++)
     {
@@ -5690,9 +5695,13 @@ sparc_flat_compute_frame_size (size)
       total_size += gp_reg_size + fp_reg_size;
     }
 
-  /* ??? This looks a little suspicious.  Clarify.  */
-  if (total_size == extra_size)
-    total_size = extra_size = 0;
+  /* If we must allocate a stack frame at all, we must also allocate 
+     room for register window spillage, so as to be binary compatible
+     with libraries and operating systems that do not use -mflat.  */
+  if (total_size > 0)
+    total_size += extra_size;
+  else
+    extra_size = 0;
 
   total_size = SPARC_STACK_ALIGN (total_size);