History

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.

Stefan committed 1 year ago

Commit 95d184c1 parent 5aebf101 file · +7 −6Browse files

Unified · Split

i386-asm.c+7−6
@@ -1233,8 +1233,8 @@ static const char *skip_constraint_modifiers(const char *p) · 1232 unmodified lines
12331233 return p;
12341234 }
12351235
1236−/* If T (a token) is of the form "%reg" returns the register
1237− number and type, otherwise return -1. */
1236+/* If t (a token) is of the form "%reg" or "reg" return the register number and
1237+ type, otherwise return -1. With GCC the % is optional, too. */
12381238 ST_FUNC int asm_parse_regvar (int t)
12391239 {
12401240 const char *s;
@@ -1242,13 +1242,14 @@ ST_FUNC int asm_parse_regvar (int t) · 1 unmodified line
12421242 if (t < TOK_IDENT || (t & SYM_FIELD))
12431243 return -1;
12441244 s = table_ident[t - TOK_IDENT]->str;
1245− if (s[0] != '%')
1246− return -1;
1247− t = tok_alloc_const(s + 1);
1245+ if (s[0] == '%')
1246+ ++s;
1247+ t = tok_alloc_const(s);
12481248 unget_tok(t);
1249+ /* Internally the % prefix is required. */
12491250 unget_tok('%');
12501251 parse_operand(tcc_state, &op);
1251− /* Accept only integer regs for now. */
1252+ /* Accept only integer regs for now. */
12521253 if (op.type & OP_REG)
12531254 return op.reg;
12541255 else

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t