On Wed, 14 Nov 2018, Jakub Jelinek wrote:
> On Wed, Nov 14, 2018 at 06:22:51AM -0600, Segher Boessenkool wrote:
> > Btw, if you just add
> >
> > void *
> > retsp (void)
> > {
> > register void *sp __asm ("sp");
> > asm ("" : "+g" (sp)); // <-- this line
> > return sp;
> > }
> >
> > everything works fine.
>
> Even in what you are proposing, i.e. handle the var as any other var
> in SSA form and only copy into the hard register right before asm and out of
> it after it?
> Because
> {
> void *sp;
> asm ("" : "+g" (sp));
> return sp;
> }
> would store into the register default definition of the SSA_NAME (the var
> has no initializer).
I think with "=g" rather than "+g" this example is ok.
Alexander