Extending constraints using register subclasses
Jamie Prescott
jpresss@yahoo.com
Sun May 17 09:09:00 GMT 2009
> From: Andrew Pinski <pinskia@gmail.com>
> To: Jamie Prescott <jpresss@yahoo.com>
> Cc: gcc@gcc.gnu.org
> Sent: Saturday, May 16, 2009 8:04:59 AM
> Subject: Re: Extending constraints using register subclasses
>
> On Sat, May 16, 2009 at 7:57 AM, Jamie Prescott wrote:
> > Now I managed to have the approach based on register subclasses working. The
> above
> > works too, but I somehow found it less clear and more "global" than inline
> assembly
> > constraints.
>
> It is not global as the register variables don't escape out of the
> scope. If you use them in inline functions, it makes them less global
> and also easier to read too.
And how would you cleanly solve a case like this?
int swi_open_file(char const *path, int mode)
{
int error;
asm ("swi 32\n\t" : "=r0" (error) : "r0" (path), "r1" (mode));
return error;
}
- Jamie
More information about the Gcc
mailing list