scc

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

commit 14390f9b8e3ae2871b6243adcddbdd3ea01eaf4f
parent cbf56869f601cec10f2e34496016b628352b5388
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 15 Feb 2015 08:42:02 +0100

Remove ADDR code generation

This was done only for inmediate generation, we are going to catch
full functions now, so the best option is to dump the label only
when we dump the full function.

Diffstat:
Mcc2/cc2.h | 2+-
Mcc2/cgen.c | 1-
Mcc2/code.c | 4----
Mcc2/parser.c | 2+-
4 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -101,7 +101,7 @@ enum nerrors { enum { - PUSH, POP, LD, ADD, RET, ADDI, LDI, ADDR, ADDX, ADCX, LDX, + PUSH, POP, LD, ADD, RET, ADDI, LDI, ADDX, ADCX, LDX, LDFX }; diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -196,7 +196,6 @@ generate(Symbol *fun) extern char odebug; char frame = fun->u.f.locals != 0 || odebug; - code(ADDR, fun->name); if (frame) { code(PUSH, IX); code(LD, IX, SP); diff --git a/cc2/code.c b/cc2/code.c @@ -34,7 +34,6 @@ static char *opfmt[] = { [ADCX] = "\to\tr,(r+i)", [LDFX] = "\to\tr,(r+i)", [LDX] = "\to\t(r+i),r", - [ADDR] = "a:" }; void @@ -55,9 +54,6 @@ code(char op, ...) case 'i': printf("%d", va_arg(va, int)); break; - case 'a': - fputs(va_arg(va, char *), stdout); - break; default: putchar(c); break; diff --git a/cc2/parser.c b/cc2/parser.c @@ -19,7 +19,7 @@ enum { LOCAL, GLOBAL, PARAMETER }; -static Symbol *curfun; +Symbol *curfun; static Node *stack[NR_STACKSIZ], **stackp; static Node *listexp[NR_EXPRESSIONS], **listp; static Node nodepool[NR_NODEPOOL], *newp;