aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2002-01-19 03:06:55 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2002-01-19 03:06:55 +0000
commit1d690052f818dea19fd407678d19375b3de1253c (patch)
tree57f9b0ff876cce6890a9cbd4f22cfe7d8b273f21
parent4dd8c0932b7e2561fd5cc1bb95dbb1462b505c08 (diff)
downloadgcc-1d690052f818dea19fd407678d19375b3de1253c.zip
gcc-1d690052f818dea19fd407678d19375b3de1253c.tar.gz
gcc-1d690052f818dea19fd407678d19375b3de1253c.tar.bz2
20020118-1.c: New.
2002-01-18 Aldy Hernandez <aldyh@redhat.com> * gcc.dg/20020118-1.c: New. * tm.texi (STARTING_FRAME_PHASE): Document. * function.c (assign_stack_local_1): Adjust x_frame_offset with STARTING_FRAME_PHASE. (STARTING_FRAME_PHASE): New. (instantiate_virtual_regs): Check saneness of STARTING_FRAME_PHASE. * rs6000.h (STARTING_FRAME_PHASE): New. From-SVN: r49006
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/rs6000/rs6000.h5
-rw-r--r--gcc/doc/tm.texi12
-rw-r--r--gcc/function.c23
4 files changed, 50 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8601b2d..20612cc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2002-01-18 Aldy Hernandez <aldyh@redhat.com>
+
+ * doc/tm.texi (STARTING_FRAME_PHASE): Document.
+
+ * function.c (assign_stack_local_1): Adjust x_frame_offset with
+ STARTING_FRAME_PHASE.
+ (STARTING_FRAME_PHASE): New.
+ (instantiate_virtual_regs): Check saneness of
+ STARTING_FRAME_PHASE.
+
+ * config/rs6000/rs6000.h (STARTING_FRAME_PHASE): New.
+
2002-01-19 Alexandre Oliva <aoliva@redhat.com>
* config/sh/sh.md (movdf_i4 split): Fix alter_subreg calls.
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 589dc9d..d00b7ed 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1399,6 +1399,11 @@ typedef struct rs6000_stack {
+ RS6000_VARARGS_AREA \
+ RS6000_SAVE_AREA)
+/* How far (in bytes) is the start of the frame from the stack
+ alignment. For ppc 32bits, the stack is aligned to 128 bits, but
+ the frame starts 64bits later. */
+#define STARTING_FRAME_PHASE (TARGET_32BIT ? 8 : 0)
+
/* Offset from the stack pointer register to an item dynamically
allocated on the stack, e.g., by `alloca'.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index c81461d..bb296ee 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -2598,6 +2598,18 @@ value @code{STARTING_FRAME_OFFSET}.
@c i'm not sure if the above is still correct.. had to change it to get
@c rid of an overfull. --mew 2feb93
+@findex STARTING_FRAME_PHASE
+@item STARTING_FRAME_PHASE
+This option species how many bytes the frame is out of phase from the
+stack alignment.
+
+For example, some ports assume a stack alignment of 128 bits, but the
+start of the frame is 64 bits displaced from this alignment. In this
+case, you would define @code{STARTING_FRAME_PHASE} to be 8.
+
+This macro defaults to 0, so there is no need to define it if the start
+of the frame maintains the stack alignment.
+
@findex STACK_POINTER_OFFSET
@item STACK_POINTER_OFFSET
Offset from the stack pointer register to the first location at which
diff --git a/gcc/function.c b/gcc/function.c
index 4cff6bb..cd39757 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -68,6 +68,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT
#endif
+#ifndef STARTING_FRAME_PHASE
+#define STARTING_FRAME_PHASE 0
+#endif
+
/* Some systems use __main in a way incompatible with its use in gcc, in these
cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
give the same symbol without quotes for an alternative entry point. You
@@ -567,9 +571,9 @@ assign_stack_local_1 (mode, size, align, function)
like. So we instead assume that ALIGNMENT is a power of two and
use logical operations which are unambiguous. */
#ifdef FRAME_GROWS_DOWNWARD
- function->x_frame_offset = FLOOR_ROUND (function->x_frame_offset, alignment);
+ function->x_frame_offset = FLOOR_ROUND (function->x_frame_offset - STARTING_FRAME_PHASE, alignment) + STARTING_FRAME_PHASE;
#else
- function->x_frame_offset = CEIL_ROUND (function->x_frame_offset, alignment);
+ function->x_frame_offset = CEIL_ROUND (function->x_frame_offset - STARTING_FRAME_PHASE, alignment) + STARTING_FRAME_PHASE;
#endif
/* On a big-endian machine, if we are allocating more space than we will use,
@@ -3477,6 +3481,21 @@ instantiate_virtual_regs (fndecl, insns)
rtx insn;
unsigned int i;
+ if (STARTING_FRAME_PHASE > 0)
+ {
+ /* Make sure the frame offset and phase displacement are aligned as
+ advertised.
+
+ Only do the sanity check if we have a STARTING_FRAME_PHASE,
+ else we might trigger this abort on ports who claim to have
+ STARTING_FRAME_OFFSET aligned properly, but don't. I suppose
+ we could enable this and fix those ports. */
+
+ if ((STARTING_FRAME_OFFSET + STARTING_FRAME_PHASE)
+ % (STACK_BOUNDARY / BITS_PER_UNIT))
+ abort ();
+ }
+
/* Compute the offsets to use for this function. */
in_arg_offset = FIRST_PARM_OFFSET (fndecl);
var_offset = STARTING_FRAME_OFFSET;