diff options
| author | Joe Soroka <gits@joesoroka.com> | 2011-02-01 15:53:48 -0800 |
|---|---|---|
| committer | Joe Soroka <gits@joesoroka.com> | 2011-02-01 15:53:48 -0800 |
| commit | 0d9376da70d984c2a6d60838ec07075a3e6504e3 (patch) | |
| tree | 65c317c4875855acefa226957efe1f4c6c9acbd4 | |
| parent | 47b4cf22cda4f46b2e2be031260618fd0b07d70a (diff) | |
| download | tinycc-0d9376da70d984c2a6d60838ec07075a3e6504e3.tar.gz tinycc-0d9376da70d984c2a6d60838ec07075a3e6504e3.tar.bz2 | |
tccasm: accept bracketed offset expressions
| -rw-r--r-- | i386-asm.c | 16 | ||||
| -rw-r--r-- | tests/asmtest.S | 1 |
2 files changed, 15 insertions, 2 deletions
@@ -376,8 +376,20 @@ static void parse_operand(TCCState *s1, Operand *op) op->e.v = e.v; op->e.sym = e.sym; } else { - op->e.v = 0; - op->e.sym = NULL; + next(); + if (tok == '%') { + unget_tok('('); + op->e.v = 0; + op->e.sym = NULL; + } else { + /* bracketed offset expression */ + asm_expr(s1, &e); + if (tok != ')') + expect(")"); + next(); + op->e.v = e.v; + op->e.sym = e.sym; + } } if (tok == '(') { next(); diff --git a/tests/asmtest.S b/tests/asmtest.S index 5bc8950..7f204cf 100644 --- a/tests/asmtest.S +++ b/tests/asmtest.S @@ -122,6 +122,7 @@ addl $0x123, 0x100 addl $0x123, 0x100(%ebx) addl $0x123, 0x100(%ebx,%edx,2) addl $0x123, 0x100(%esp) +addl $0x123, (3*8)(%esp) addl $0x123, (%ebp) addl $0x123, (%esp) cmpl $0x123, (%esp) |
