This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [m68k] Fix and improve ColdFire function prologue/epilogue generation (respin)
- From: Richard Henderson <rth at redhat dot com>
- To: Bernardo Innocenti <bernie at develer dot com>
- Cc: gcc-patches at gcc dot gnu dot org, peter at baradas dot org, gni at gecko dot de
- Date: Wed, 3 Sep 2003 16:06:12 -0700
- Subject: Re: [m68k] Fix and improve ColdFire function prologue/epilogue generation (respin)
- References: <3F565E0A.9060303@develer.com>
On Wed, Sep 03, 2003 at 11:32:58PM +0200, Bernardo Innocenti wrote:
> + if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
> + return 0;
Intuitively, this is wrong. I can see how it worked before, but
not after your change. To wit:
m68k.h:#define FIRST_PARM_OFFSET(FNDECL) 8
That says that the offset from ARG_POINTER_REGNUM to the first
actual argument is 8. Which, when you have a frame pointer, is
exactly right for m68k -- four bytes for saved frame pointer,
and four bytes for saved return address.
With -fomit-frame-pointer, however, things get screwy. The fact
that we have a hard-coded 8 above is arguably a bug. It appears
as if things were worked around by adding magic constants,
> - asm_fprintf (stream, "\tsubq.w %I%wd,%Rsp\n", fsize + 4);
like so.
You've not preserved this bit of, ahem, style, and so as far as
I can see, you've broken parameter passing without a frame pointer.
The correct way to do this is to make the argument pointer point
to the arguments. Then you do
if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
return 8;
if (from == ARG_POINTER_REGNUM && to == STACK_FRAME_POINTER_REGNUM)
return stack_size + 4;
r~