This is the mail archive of the gcc@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]

Re: alpha return address patch


> 
> | > I don't think using RETURN_ADDR_RTX should force the return address into
> | > the stack; the current code should be able to handle having the return
> | > address in a register just fine.
> | 
> | Except that it is very difficult to handle writing to that value
> | and having it be seen by the epilogue.
> | 
> | If you can suggest, perhaps, a way to do elimination such that
> | one way we have a (mem (plus (reg FP) (const ofs))) and the
> | other a (reg RA), I'd be delighted to use it.
> 
> Well there is always the hack I used in the rs6000 for the memory used to
> convert between fp and ints.  I created a new fixed 'register' (at least the
> rest of the compiler thinks it is a register) that really represents a storage
> location (this is due to bad interactions between inlining and allocating
> storage by hand).

I can't see how this (or a varient) would help any.  If I just
want to poke memory, I can do that via elimination.  But if I
want this value to (maybe) hang out in a hard reg, I need to 
know which one, and when.  

The Ideal, I think, is to be able to treat the return address as
an extra argument and an extra output.  Before function start, it
gets copied to a pseudo, and it gets copied back to $ra just before
the epilogue.  In the middle, we can reference it, modify it, 
whatever.

Oh, there's one other requirement -- it needs to get dropped in a
designated stack slot, not something random like other pseudos.

Anyway, I'd previously had the first part, copy to pseudo, working.
Only I didn't take care to copy it back, which is fine for everything
except the current no-sjlj-exceptions.  Well, it wasn't perfect, as
it confused the prologue into thinking $ra was live, which made it
drop the value on the stack even when it didn't need to.

I have no idea how to do the second and third parts, copying the
value back on exit, and making sure it lives in the right stack slot.


r~


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