scc

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

commit 642bd886398e144a79c311d31c9ce7381e675f10
parent dcb13199b1122210a423fa1e7db218ea7e05ab31
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 16 Dec 2017 20:56:04 +0100

[as] Add type pseudo instruction

This instruction generates a type annotation for the symbol.

Diffstat:
Mas/as.h | 1+
Mas/ins.c | 10++++++++++
Mas/target/x80/x80.dat | 2++
3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/as/as.h b/as/as.h @@ -121,6 +121,7 @@ struct section { struct symbol { String name; + String type; unsigned char flags; unsigned char pass; unsigned char argtype; diff --git a/as/ins.c b/as/ins.c @@ -13,6 +13,7 @@ enum { SIZE, XSTRING, ASCII, + TYPE, }; char * @@ -140,6 +141,9 @@ symexp(int which, Op *op, Node **args) case SIZE: sym->size = exp->value; break; + case TYPE: + sym->type.buf = xstrdup(exp->name.buf); + break; } } @@ -162,6 +166,12 @@ size(Op *op, Node **args) } void +type(Op *op, Node **args) +{ + symexp(TYPE, op, args); +} + +void section(Op *op, Node **args) { Symbol *sym = args[0]->sym; diff --git a/as/target/x80/x80.dat b/as/target/x80/x80.dat @@ -24,6 +24,8 @@ .SIZE imm16 0 none size Z80,R800,GB80 .COMM sym,imm16 0 none common Z80,R800,GB80 .COMM imm16 0 none common Z80,R800,GB80 +.TYPE sym,imm16 0 none type Z80,R800,GB80 +.TYPE imm16 0 none type Z80,R800,GB80 .GLOBL sym+ 0 none global Z80,R800,GB80 .EXTERN sym+ 0 none extrn Z80,R800,GB80 .STRING string+ 0 none string Z80,R800,GB80