summaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-21 09:03:18 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-21 09:03:18 +0000
commit65e83e609ed2a9a4247780f645bba240b7a848d6 (patch)
treed16ac4c285b07d9272716d077f44f7d69f5968b5 /gcc/reload1.c
parentf28bdbe8146354159c0e41f8f7ff91870a700fb0 (diff)
downloadgcc-65e83e609ed2a9a4247780f645bba240b7a848d6.tar.gz
gcc/
PR target/28966 PR target/29248 * reload1.c (reload): Realign stack after it changes size. gcc/testsuite/ PR target/28966 PR target/29248 * gcc.dg/rs6000-leaf.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 454383581e8..efa1a397212 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -888,16 +888,8 @@ reload (rtx first, int global)
{
int something_changed;
int did_spill;
-
HOST_WIDE_INT starting_frame_size;
- /* Round size of stack frame to stack_alignment_needed. This must be done
- here because the stack size may be a part of the offset computation
- for register elimination, and there might have been new stack slots
- created in the last iteration of this loop. */
- if (cfun->stack_alignment_needed)
- assign_stack_local (BLKmode, 0, cfun->stack_alignment_needed);
-
starting_frame_size = get_frame_size ();
set_initial_elim_offsets ();
@@ -964,6 +956,20 @@ reload (rtx first, int global)
/* If we allocated another stack slot, redo elimination bookkeeping. */
if (starting_frame_size != get_frame_size ())
continue;
+ if (starting_frame_size && cfun->stack_alignment_needed)
+ {
+ /* If we have a stack frame, we must align it now. The
+ stack size may be a part of the offset computation for
+ register elimination. So if this changes the stack size,
+ then repeat the elimination bookkeeping. We don't
+ realign when there is no stack, as that will cause a
+ stack frame when none is needed should
+ STARTING_FRAME_OFFSET not be already aligned to
+ STACK_BOUNDARY. */
+ assign_stack_local (BLKmode, 0, cfun->stack_alignment_needed);
+ if (starting_frame_size != get_frame_size ())
+ continue;
+ }
if (caller_save_needed)
{