summaryrefslogtreecommitdiffstats
path: root/gcc/function.c
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-04 06:20:17 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-04 06:20:17 +0000
commit256f9b655aae2e1280a1e9eca87223e52d2d6260 (patch)
treee9ac290e5315d76e0df2d32ccb321c9164e8fd9a /gcc/function.c
parenta736566f6da4d5e366059e372dbef48109fce7e7 (diff)
downloadppe42-gcc-256f9b655aae2e1280a1e9eca87223e52d2d6260.tar.gz
ppe42-gcc-256f9b655aae2e1280a1e9eca87223e52d2d6260.zip
* function.c (STACK_ALIGNMENT_NEEDED): New macro. Default to 1.
(assign_stack_local_1): Perform overall stack alignment only when STACK_ALIGNMENT_NEEDED is non-zero. * doc/tm.texi (STACK_ALIGNMENT_NEEDED): Document. * pa.c (compute_frame_size): Rename fsize to size. Account for alignment to a word boundary before general register save block. Only account for double-word alignment before floating point register save block if one or more are saved. Don't allocate space for %r3 when frame pointer is needed. (hppa_expand_prologue): Include alignment to word boundary in local frame size. * pa.h (STARTING_FRAME_OFFSET): Define to 8 on both 32 and 64-bit ports. (STACK_ALIGNMENT_NEEDED): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63771 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 851dd246ee9..73527bc037e 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -70,6 +70,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT
#endif
+#ifndef STACK_ALIGNMENT_NEEDED
+#define STACK_ALIGNMENT_NEEDED 1
+#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
@@ -566,16 +570,27 @@ assign_stack_local_1 (mode, size, align, function)
frame_off = STARTING_FRAME_OFFSET % frame_alignment;
frame_phase = frame_off ? frame_alignment - frame_off : 0;
- /* Round frame offset to that alignment.
- We must be careful here, since FRAME_OFFSET might be negative and
- division with a negative dividend isn't as well defined as we might
- like. So we instead assume that ALIGNMENT is a power of two and
- use logical operations which are unambiguous. */
+ /* Round the frame offset to the specified alignment. The default is
+ to always honor requests to align the stack but a port may choose to
+ do its own stack alignment by defining STACK_ALIGNMENT_NEEDED. */
+ if (STACK_ALIGNMENT_NEEDED
+ || mode != BLKmode
+ || size != 0)
+ {
+ /* We must be careful here, since FRAME_OFFSET might be negative and
+ division with a negative dividend isn't as well defined as we might
+ 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 - frame_phase, alignment) + frame_phase;
+ function->x_frame_offset
+ = (FLOOR_ROUND (function->x_frame_offset - frame_phase, alignment)
+ + frame_phase);
#else
- function->x_frame_offset = CEIL_ROUND (function->x_frame_offset - frame_phase, alignment) + frame_phase;
+ function->x_frame_offset
+ = (CEIL_ROUND (function->x_frame_offset - frame_phase, alignment)
+ + frame_phase);
#endif
+ }
/* On a big-endian machine, if we are allocating more space than we will use,
use the least significant bytes of those that are allocated. */
OpenPOWER on IntegriCloud