[cfe-dev] [LLVMdev] Named register variables GNU-style

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Mar 27 19:06:42 PDT 2014


> I don't think that works. Per the GCC documentation, a global register
> variable reserves the register entirely for use with that name in a
> translation unit. We don't seem to want exactly that model, but the approach
> you're suggesting doesn't seem to capture the semantics. For instance:
>
> register long a asm("r12");
> void f(long n) {
>   n *= 3;
>   a += n;
> }
>
> ... could do the wrong thing if the multiplication happens to use r12.

Correct. The proposed solution would work for all non allocatable
registers. We should probably still err if someone tries to use an
allocatable one.

Cheers,
Rafael



More information about the cfe-dev mailing list