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: [PATCH] diagnose unsupported uses of hardware register variables (PR 88000)


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).

	Jakub


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