scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 1361aa0b0a2a65bc002d6d6625416162fec0d3fd
parent 5cbeab763413495a5fe611fcfb2f7c2d6333e649
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Sat, 23 Apr 2016 17:25:30 +0200

[cc2] Break dependency between O and S codes

Until now, codes like OAUTO were forced to be equal to codes like SAUTO.
This commit break this dependency.

Diffstat:
cc2/code.c | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/cc2/code.c b/cc2/code.c @@ -29,16 +29,25 @@ nextpc(void) static void addr(Node *np, Addr *addr) { - switch (addr->kind = np->op) { - case SREG: + switch (np->op) { + case OREG: + addr->kind = SREG; addr->u.reg = np->u.reg; break; - case SCONST: + case OCONST: + addr->kind = OCONST; addr->u.i = np->u.i; break; - case SLABEL: - case SAUTO: - case STMP: + case OJMP: + case OLABEL: + addr->kind = SLABEL; + goto symbol; + case OAUTO: + addr->kind = SAUTO; + goto symbol; + case OTMP: + addr->kind = STMP;; + symbol: addr->u.sym = np->u.sym; break; default: