function arguments offset computation with -fomit-frame-pointer
Hans-Peter Nilsson
hp@bitrange.com
Wed Jul 9 05:17:00 GMT 2003
On Mon, 7 Jul 2003, Jim Wilson wrote:
> Bernardo Innocenti wrote:
> > I also have a more m68k-specific question: the code path for creating
> > room for the frame when no frame pointer always adds 4 bytes to the
> > required frame size. Is that done to get the same offset that
> > link/unlink would have done? Why is that necessary?
>
> Probably nobody knows anymore, it has been there for well over a decard,
> but link/unlink space for the return address is the obvious guess.
> Maybe the problem is that INITIAL_FRAME_POINTER_OFFSET isn't checking
> frame_pointer_needed, and thus we always need to add the 4 bytes to make
> INITIAL_FRAME_POINTER_OFFSET work? If so, then fixing that macro would
> let you get rid of the extra 4 bytes in the prologue code.
Having faced that problem myself for two other ports, I thought
I should mention that I agree with your guess, but I don't think
the solution was that simple (though I've forgotten the details;
maybe it was only complicated on targets that don't have to save
the return address for leaf-functions).
Anyway IIRC the correct solution is to use ELIMINATE_REGS rather
than INITIAL_FRAME_POINTER_OFFSET. (Hmm, that'd indicate the
problem being related to eliminating the argument pointer in
favor of the stack pointer and missing an offset between fp and
ap or something.)
brgds, H-P
More information about the Gcc
mailing list