This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Stack alignment
"John David Anglin" <dave@hiauly1.hia.nrc.ca> writes:
> > > When STACK_BOUNDARY is set to 64, there is one fill word in the frame
> > > as a result of the starting frame offset and the need to align it to a
> > > STACK_BOUNDARY. If STACK_BOUNDARY were set to 512, we would have 15
> > > fill words.
> >
> > Eh? Is the stack pointer aligned or not?
>
> This turned out to be totally wrong. Here is the actual problem.
>
> Reload aligns the stack in each iteration. It uses a default alignment
> value of BIGGEST_ALIGNMENT. If STARTING_FRAME_OFFSET % BIGGEST_ALIGNMENT
> is not zero, the rounding in assign_stack_temp_for_type will cause the
> frame size to be non-zero. As a result, you will never have a non-empty
> frame and code for doing the stack adjustments needs to be emitted in
> the prologue and epilogue.
Right. This is because you need to keep the stack aligned, so you can
never have an empty frame. Which brings us back to a variant of the
previous poster's question: is the stack pointer supposed to be
aligned, or not?
--
- Geoffrey Keating <geoffk@geoffk.org>