This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: function arguments offset computation with -fomit-frame-pointer
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Jim Wilson <wilson at tuliptree dot org>
- Cc: Bernardo Innocenti <bernie at develer dot com>, <gcc at gcc dot gnu dot org>
- Date: Wed, 9 Jul 2003 00:48:00 -0400 (EDT)
- Subject: Re: function arguments offset computation with -fomit-frame-pointer
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