On Thu, Mar 27, 2014 at 11:20:09AM +0000, Renato Golin wrote:
> On 27 March 2014 10:44, Jakub Jelinek <ja...@redhat.com> wrote:
> > I don't see what is wrong with this, this isn't inline asm, it is
> > the local register var GNU extension,
> 
> The argument I remember hearing of is the joint of:
>  1. The "register" specifier is not guaranteed to keep variables'
> values in registers (C99, 6.7.1p4)

Sure, normally register keyword is just a hint, that e.g. GCC I think
ignores whenever optimizing (for -O0 it means a variable doesn't have to
be allocated on the stack), but when it is part of the GNU global/local register
variable extension (i.e. there is both register keyword and
asm ("<registername>"), then register is not a mere hint, but a requirement.
Without this extension, it is e.g. hard to force some input or output
arguments of inline asm into specific machine registers, the only other way
is to use constraints, but most targets don't have constraints for every
specific register (e.g. on x86_64/i?86, there are constraints for say
eax/ebx/ecx/edx/edi/esi, but e.g. if you want to force something into r8,
local register variable extension is the only way to express that, unless
you want in the inline asm to add lots of useless movs and extra clobbers.
E.g. glibc uses such inline asms for inline syscalls heavily, other projects
similarly.

        Jakub

Reply via email to