Support local register variables

Similar to GCC a local asm register variable enforces the use of a
specified register in asm operands (and doesn't otherwise
matter).  Works only if the variable is directly mentioned as
operand.  For that we now generally store a backpointer from
an SValue to a Sym when the SValue was the result of unary()
parsing a symbol identifier.
This commit is contained in:
Michael Matz
2016-10-06 04:05:30 +02:00
parent 3bc9c325c5
commit f081acbfba
4 changed files with 58 additions and 6 deletions

View File

@ -2939,6 +2939,7 @@ void asm_test(void)
void override_func3 (void);
unsigned long asmret;
#ifdef BOOL_ISOC99
_Bool somebool;
#endif
register int regvar asm("%esi");
@ -3001,6 +3002,8 @@ void asm_test(void)
fancy_copy (&val, &val2);
printf ("fancycpy(%d)=%d\n", val, val2);
val = 44;
fancy_copy2 (&val, &val2);
printf ("fancycpy2(%d)=%d\n", val, val2);
asm volatile ("mov $0x4243, %%esi" : "=r" (regvar));
printf ("regvar=%x\n", regvar);
return;