scc

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

commit 382b2e36815f494dd95bba35651907da248ffd97
parent ad4c75716e7da7fb0c247f8a71fd4e7511c19778
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 29 Dec 2017 11:55:47 +0000

[as-z80] Remove argtype field form symbols

These field could be integrated in the value field.

Diffstat:
Mas/as.h | 1-
Mas/symbol.c | 2+-
Mas/target/i386/proc.c | 2+-
Mas/target/x80/ins.c | 18+++++++++---------
Mas/target/z80/proc.c | 8++++----
5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/as/as.h b/as/as.h @@ -124,7 +124,6 @@ struct symbol { String type; unsigned char flags; unsigned char pass; - unsigned char argtype; TUINT value; TUINT size; Section *section; diff --git a/as/symbol.c b/as/symbol.c @@ -34,7 +34,7 @@ dumpstab(char *msg) fprintf(stderr, "[%d]", (int) (bp - hashtbl)); for (sym = *bp; sym; sym = sym->hash) { fprintf(stderr, " -> %s:%0X:%0X", - sym->name.buf, sym->flags, sym->argtype); + sym->name.buf, sym->flags, sym->value); } putc('\n', stderr); } diff --git a/as/target/i386/proc.c b/as/target/i386/proc.c @@ -94,7 +94,7 @@ iarch(void) for (bp = regs; bp->name; ++bp) { Symbol *sym = lookup(bp->name); sym->flags = FREG; - sym->argtype = bp->type; + sym->value = bp->type; } } diff --git a/as/target/x80/ins.c b/as/target/x80/ins.c @@ -203,9 +203,9 @@ ld8(Op *op, Node **args) memcpy(buf, op->bytes, n); if (par1->addr == AREG) - regval |= reg2int(par1->sym->argtype) << 3; + regval |= reg2int(par1->sym->value) << 3; if (par2->addr == AREG) - regval |= reg2int(par2->sym->argtype); + regval |= reg2int(par2->sym->value); else if (par2->addr == AIMM) buf[--i] = par2->sym->value; @@ -222,7 +222,7 @@ alu16(Op *op, Node **args) unsigned char buf[4]; par = (args[1]) ? args[1] : args[0]; - val = reg2int(par->sym->argtype); + val = reg2int(par->sym->value); memcpy(buf, op->bytes, n); buf[n-1] |= val << 4; emit(buf, n); @@ -255,7 +255,7 @@ ld16(Op *op, Node **args) val = src->sym->value; buf[n-1] = val >> 8; buf[n-2] = val; - buf[n-3] |= reg2int(dst->sym->argtype) << 4; + buf[n-3] |= reg2int(dst->sym->value) << 4; emit(buf, n); } @@ -280,7 +280,7 @@ alu8(Op *op, Node **args) val = par->sym->value; break; case AREG: - val = reg2int(par->sym->argtype) << shift; + val = reg2int(par->sym->value) << shift; break; case AINDEX: val = par->left->right->sym->value; @@ -324,7 +324,7 @@ idx(Op *op, Node **args) buf[--i] = imm->sym->value; buf[--i] = idx->sym->value; if (reg) - buf[--i] |= reg2int(reg->sym->argtype) << shift; + buf[--i] |= reg2int(reg->sym->value) << shift; emit(buf, n); } @@ -347,7 +347,7 @@ inout(Op *op, Node **args) if (port->addr == ADIRECT) val = port->left->sym->value; else if (value->addr == AREG) - val = reg2int(value->sym->argtype) << 3; + val = reg2int(value->sym->value) << 3; else val = 0; @@ -380,7 +380,7 @@ rot_bit(Op *op, Node **args) if (!par) break; case AREG: - val = reg2int(par->sym->argtype); + val = reg2int(par->sym->value); buf[n-1] |= val; break; case AINDIR: @@ -430,7 +430,7 @@ branch(Op *op, Node **args) buf[--i] = val; } if (flag) - buf[--i] |= flag2int(flag->sym->argtype) << 3; + buf[--i] |= flag2int(flag->sym->value) << 3; emit(buf, n); } diff --git a/as/target/z80/proc.c b/as/target/z80/proc.c @@ -56,7 +56,7 @@ iarch(void) for (bp = regs; bp->name; ++bp) { Symbol *sym = lookup(bp->name); sym->flags = FREG; - sym->argtype = bp->type; + sym->value = bp->type; } } @@ -115,7 +115,7 @@ match(Op *op, Node **args) case AREG_SP: case AREG_AF: case AREG_AF_: - if (np->addr != AREG || np->sym->argtype != arg) + if (np->addr != AREG || np->sym->value != arg) return 0; break; case AREG_RCLASS: @@ -144,7 +144,7 @@ match(Op *op, Node **args) register_class: if (np->addr != AREG) return 0; - if (!(*class)(np->sym->argtype)) + if (!(*class)(np->sym->value)) return 0; break; case AINDEX_IY: @@ -155,7 +155,7 @@ match(Op *op, Node **args) index_address: if (np->addr != AINDEX) return 0; - if (np->left->left->sym->argtype != arg) + if (np->left->left->sym->value != arg) return 0; if (toobig(np, arg)) error("overflow in index");