mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-28 23:58:41 +08:00
i386-asm.c: Optional % for variables in specific registers
Handle 'register long r10 __asm__("%r10")' without %, too. Using GCC
the % is optional. The musl source code does not use the % prefix.
The GCC source code uses both variants.
This commit is contained in:
parent
5aebf106e8
commit
95d184cba1
13
i386-asm.c
13
i386-asm.c
@ -1233,8 +1233,8 @@ static const char *skip_constraint_modifiers(const char *p)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If T (a token) is of the form "%reg" returns the register
|
/* If t (a token) is of the form "%reg" or "reg" return the register number and
|
||||||
number and type, otherwise return -1. */
|
type, otherwise return -1. With GCC the % is optional, too. */
|
||||||
ST_FUNC int asm_parse_regvar (int t)
|
ST_FUNC int asm_parse_regvar (int t)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
@ -1242,13 +1242,14 @@ ST_FUNC int asm_parse_regvar (int t)
|
|||||||
if (t < TOK_IDENT || (t & SYM_FIELD))
|
if (t < TOK_IDENT || (t & SYM_FIELD))
|
||||||
return -1;
|
return -1;
|
||||||
s = table_ident[t - TOK_IDENT]->str;
|
s = table_ident[t - TOK_IDENT]->str;
|
||||||
if (s[0] != '%')
|
if (s[0] == '%')
|
||||||
return -1;
|
++s;
|
||||||
t = tok_alloc_const(s + 1);
|
t = tok_alloc_const(s);
|
||||||
unget_tok(t);
|
unget_tok(t);
|
||||||
|
/* Internally the % prefix is required. */
|
||||||
unget_tok('%');
|
unget_tok('%');
|
||||||
parse_operand(tcc_state, &op);
|
parse_operand(tcc_state, &op);
|
||||||
/* Accept only integer regs for now. */
|
/* Accept only integer regs for now. */
|
||||||
if (op.type & OP_REG)
|
if (op.type & OP_REG)
|
||||||
return op.reg;
|
return op.reg;
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user