shithub: scc

Download patch

ref: 6c32e2dc143c56ea0187f19add3b543eae988c06
parent: 4fafd289207621b7b95e606825acfe80404c5017
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Mar 16 14:14:38 EDT 2015

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

--- 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 @@
 } 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 @@
 	Type type;
 	uint8_t complex;
 	uint8_t addable;
-	uint8_t kind;
 	union {
 		Symbol *sym;
 		/* TODO: Admit inmediate of other type */
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -159,7 +159,6 @@
 		abort();
 	}
 	np->op = REG;
-	sym->reg = np->u.reg = reg;
 }
 
 static void
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -92,6 +92,8 @@
             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 @@
 	['\177'] = NULL
 };
 
-
 static void
 prnode(Node *np)
 {
@@ -445,7 +446,6 @@
 	if (!curfun)
 		error(ESYNTAX);
 	sym = local(token);
-	sym->type = LABEL;
 	sym->u.l.addr = listp - listexp;
 }
 
@@ -457,7 +457,6 @@
 
 	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 @@
 	if (curfun)
 		error(ESYNTAX);
 
-	sym->type = FUN;
 	curfun = sym;
 	sym->u.f.body = listp = listexp;
 	newp = nodepool;