scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 22e4887dcf0da5a1325087e01067dcb3fc57128e
parent 50a4ad2d4feb63a231fffbe2d3cf7958052ae1f4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 15 Dec 2017 16:29:04 +0000

[as] Fix ASYM argument

The problem of this argument type is that it
has to use AIMM addr type, because a symbol is
an inmediate address, but it also has to export
that it is a symbol. This can be checked looking
in the parser opcode of the node, but it wasn't
published.

Diffstat:
Mas/as.h | 12++++++++++++
Mas/expr.c | 12------------
Mas/target/z80/proc.c | 2+-
3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/as/as.h b/as/as.h @@ -42,6 +42,18 @@ enum common_args { AREP = 128 }; +enum tokens { + EOS = -1, + IDEN = 1, + NUMBER, + REG, + STRING, + SHL, + SHR, + GE, + LE, +}; + #define MAXSYM 63 typedef struct reloc Reloc; diff --git a/as/expr.c b/as/expr.c @@ -10,18 +10,6 @@ static char sccsid[] = "@(#) ./as/node.c"; #define NNODES 10 -enum tokens { - EOS = -1, - IDEN = 1, - NUMBER, - REG, - STRING, - SHL, - SHR, - GE, - LE, -}; - union yylval { TUINT val; Symbol *sym; diff --git a/as/target/z80/proc.c b/as/target/z80/proc.c @@ -109,7 +109,7 @@ match(Op *op, Node **args) error("overflow in immediate operand"); break; case ASYM: - if (np->op != ASYM) + if (np->addr != AIMM || np->op != IDEN) return 0; break; default: