aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Cox <scox@cygnus.com>1998-11-13 11:04:17 +0000
committerStan Cox <scox@gcc.gnu.org>1998-11-13 11:04:17 +0000
commit8c64be75d3c74fe73d7a681fac4bc81b5af5919d (patch)
tree9f3c54976b59315c467ecf2ec2adcc46633b2f10
parenta49fb37af28600b3586a7332342bb88c53d42a98 (diff)
downloadgcc-8c64be75d3c74fe73d7a681fac4bc81b5af5919d.zip
gcc-8c64be75d3c74fe73d7a681fac4bc81b5af5919d.tar.gz
gcc-8c64be75d3c74fe73d7a681fac4bc81b5af5919d.tar.bz2
* sparc.c (sparc_flat_compute_frame_size): Correctly calc args_size
From-SVN: r23634
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/sparc/sparc.c35
2 files changed, 27 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index daeb7e9..f627228 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 686350b..f3e48c8 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -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);