On Wed, Nov 14, 2018 at 05:50:39AM -0600, Segher Boessenkool wrote:
> > You mean for all local hard register variables living across function calls
> > save them into temporary and restore them around the calls?
> > One issue is that those variables aren't in SSA form, so liveness analysis
> > is harder.  And, would we want to have an exception for the stack pointer?
> > I mean there is no need for register void *sp __asm ("rsp"); to be
> > saved/restored that way, it shouldn't change value across function calls.
> > Plus, as has been mentioned, function calls aren't the only issue here,
> > e.g. division/modulo etc. that require specific hard registers might clobber
> > them too.
> 
> I was thinking put them in pseudos always, just copy them to the hard reg
> right before the asm statements that use them (and the other way around,
> for outputs).

Wouldn't that break all the code that does:
void *
retsp (void)
{
  register void *sp __asm ("sp");
  return sp;
}
(or any other (usually fixed) reg, where the user code expects to just
read the value of that register)?
Storing uninitialized value into it would break the program miserably.

        Jakub

Reply via email to