scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 6c32e2dc143c56ea0187f19add3b543eae988c06
parent 4fafd289207621b7b95e606825acfe80404c5017
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 16 Mar 2015 18:14:38 +0000

Remove FUN VAR EFUN in cc2

These values were not ready used. It is possible we will have to
insert them again, but in a better way.
Add some additional TODOs in cc2

Diffstat:
Mcc2/cc2.h | 8+-------
Mcc2/cgen.c | 1-
Mcc2/parser.c | 6++----
3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -3,9 +3,6 @@ #define INTF 2 #define NONE 0 -#define FUN 0 -#define VAR 1 -#define EFUN 2 #define AUTO 'A' #define REG 'R' #define MEM 'T' @@ -54,12 +51,10 @@ typedef struct { } Type; struct symbol { + unsigned short id; char *name; bool public : 1; bool extrn : 1; - char type; - unsigned short id; - uint8_t reg; union { struct { Type type; @@ -83,7 +78,6 @@ struct node { Type type; uint8_t complex; uint8_t addable; - uint8_t kind; union { Symbol *sym; /* TODO: Admit inmediate of other type */ diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -159,7 +159,6 @@ moveto(Node *np, uint8_t reg) abort(); } np->op = REG; - sym->reg = np->u.reg = reg; } static void diff --git a/cc2/parser.c b/cc2/parser.c @@ -92,6 +92,8 @@ static void cast(char *), operator(char *), assignment(char *), increment(char * globvar(char *), localvar(char *), paramvar(char *), label(char *), immediate(char *), unary(char *); +/*TODO: Remove hardcoded symbols */ + static void (*optbl[])(char *) = { [L_INT8] = cast, [L_INT16] = cast, @@ -144,7 +146,6 @@ static void (*optbl[])(char *) = { ['\177'] = NULL }; - static void prnode(Node *np) { @@ -445,7 +446,6 @@ deflabel(char *token) if (!curfun) error(ESYNTAX); sym = local(token); - sym->type = LABEL; sym->u.l.addr = listp - listexp; } @@ -457,7 +457,6 @@ declaration(uint8_t t, char class, char *token) free(sym->name); memset(sym, 0, sizeof(*sym)); - sym->type = VAR; sym->u.v.sclass = class; if ((s = strtok(NULL, "\t")) == NULL) @@ -489,7 +488,6 @@ globdcl(char *token) if (curfun) error(ESYNTAX); - sym->type = FUN; curfun = sym; sym->u.f.body = listp = listexp; newp = nodepool;