summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-19 03:06:55 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-19 03:06:55 +0000
commit0d83ba3e214cf978ca56d64885dcb3b629aa32e3 (patch)
tree57f9b0ff876cce6890a9cbd4f22cfe7d8b273f21 /gcc/function.c
parente53d227a989c449a7020fe467b144ba66633abee (diff)
downloadgcc-0d83ba3e214cf978ca56d64885dcb3b629aa32e3.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49006 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 4cff6bb7e77..cd397579865 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;