diff options
| author | Michael Matz <matz@suse.de> | 2016-07-11 16:28:48 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:07 +0100 |
| commit | f9423ff3fa5ac2374ed1a36c2d93475539f63f35 (patch) | |
| tree | 6b09ef5d2f6b24207eda841c9957aceee2c2fc90 | |
| parent | 10c351488901667059181cf034dd500354f352ed (diff) | |
| download | tinycc-f9423ff3fa5ac2374ed1a36c2d93475539f63f35.tar.gz tinycc-f9423ff3fa5ac2374ed1a36c2d93475539f63f35.tar.bz2 | |
inline asm: Fix 'P' and accept some r<nr> registers
A 'P' template modifier should avoid adding a '$' to literal
arguments. Also accept the numbered r8+ registers in an inline
asm clobber list (ignoring them for now).
| -rw-r--r-- | i386-asm.c | 10 | ||||
| -rw-r--r-- | tccasm.c | 8 |
2 files changed, 13 insertions, 5 deletions
@@ -1285,7 +1285,8 @@ ST_FUNC void subst_asm_operand(CString *add_str, r = sv->r; if ((r & VT_VALMASK) == VT_CONST) { - if (!(r & VT_LVAL) && modifier != 'c' && modifier != 'n') + if (!(r & VT_LVAL) && modifier != 'c' && modifier != 'n' && + modifier != 'P') cstr_ccat(add_str, '$'); if (r & VT_SYM) { cstr_cat(add_str, get_tok_str(sv->sym->v, NULL), -1); @@ -1489,9 +1490,16 @@ ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) #ifdef TCC_TARGET_X86_64 } else if (reg >= TOK_ASM_rax && reg <= TOK_ASM_rdi) { reg -= TOK_ASM_rax; + } else if (1 && str[0] == 'r' && + (((str[1] == '8' || str[1] == '9') && str[2] == 0) || + (str[1] == '1' && str[2] >= '0' && str[2] <= '5' && + str[3] == 0))) { + /* Do nothing for now. We can't parse the high registers. */ + goto end; #endif } else { tcc_error("invalid clobber register '%s'", str); } clobber_regs[reg] = 1; +end:; } @@ -1043,10 +1043,10 @@ static void subst_asm_operands(ASMOperand *operands, int nb_operands, } modifier = 0; if (*str == 'c' || *str == 'n' || - *str == 'b' || *str == 'w' || - *str == 'h' || *str == 'k' || *str == 'q' || - /* P in GCC would add "@PLT" to symbol refs in PIC mode - Ignore this in TCC. */ + *str == 'b' || *str == 'w' || *str == 'h' || *str == 'k' || + *str == 'q' || + /* P in GCC would add "@PLT" to symbol refs in PIC mode, + and make literal operands not be decorated with '$'. */ *str == 'P') modifier = *str++; index = find_constraint(operands, nb_operands, str, &str); |
