scc

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

commit c6306509943c89def518bd6fadae6ef4439dc0a5
parent fb9f5ad8b79fff0c06cdef1b2a9e8fa729a95a15
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat,  9 Sep 2017 07:12:14 +0200

[as] Autogenerate list of formats

We already have that information, so it is better to take it from
the dat files.

Diffstat:
Mas/Makefile | 1-
Mas/ins.c | 1-
Das/ins.h | 2--
Mas/target/x86/gen.awk | 5++++-
4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/as/Makefile b/as/Makefile @@ -10,7 +10,6 @@ HDR = ../inc/scc.h as.h all: $(OBJ): $(HDR) -ins.o: ins.h as: $(OBJ) $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@ diff --git a/as/ins.c b/as/ins.c @@ -1,7 +1,6 @@ #include "../inc/scc.h" #include "as.h" -#include "ins.h" void direct(Op *op, Arg *args) diff --git a/as/ins.h b/as/ins.h @@ -1,2 +0,0 @@ - -Format direct, defb, defw, defd, defq; diff --git a/as/target/x86/gen.awk b/as/target/x86/gen.awk @@ -3,7 +3,6 @@ BEGIN { FS = "\t" printf "#include \"../../../inc/scc.h\"\n"\ "#include \"../../as.h\"\n"\ - "#include \"../../ins.h\"\n"\ "#include \"../x86/args.h\"\n"\ "#include \"ins.h\"\n\n" nop = 0; nvar = 0 @@ -20,8 +19,12 @@ BEGIN { opsize[nvar] = $3 opbytes[nvar] = ($4 == "none") ? "" : $4 opformat[nvar++] = $5 + formats[$5] = 1 } END { + for (i in formats) + printf "Format %s;\n", i + printf "int nr_ins = %d;\n\n", nop print "struct ins instab[] = {" for (i = 0; i < nop; i++) {