On Wed, Nov 14, 2018 at 01:27:26PM +0100, 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?
Yes, *only* in that: with current trunk sp lives in the "sp" hard register at the "return sp", which cannot work reliably (what value is returned? It is unspecified). > 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'm more concerned about what it looks like in RTL, but sure :-) What *should* it do before RTL? Not much at all I think, just keep track that this var is a register asm and that's that? Segher