This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [m68k] Fix and improve ColdFire function prologue/epilogue generation (respin)


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]