shithub: scc

Download patch

ref: 14390f9b8e3ae2871b6243adcddbdd3ea01eaf4f
parent: cbf56869f601cec10f2e34496016b628352b5388
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Feb 15 03:42:02 EST 2015

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.

--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -101,7 +101,7 @@
 
 
 enum {
-	PUSH, POP, LD, ADD, RET, ADDI, LDI, ADDR, ADDX, ADCX, LDX,
+	PUSH, POP, LD, ADD, RET, ADDI, LDI, ADDX, ADCX, LDX,
 	LDFX
 };
 
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -196,7 +196,6 @@
 	extern char odebug;
 	char frame = fun->u.f.locals != 0 || odebug;
 
-	code(ADDR, fun->name);
 	if (frame) {
 		code(PUSH, IX);
 		code(LD, IX, SP);
--- a/cc2/code.c
+++ b/cc2/code.c
@@ -34,7 +34,6 @@
 	[ADCX] = "\to\tr,(r+i)",
 	[LDFX] = "\to\tr,(r+i)",
 	[LDX]  = "\to\t(r+i),r",
-	[ADDR] = "a:"
 };
 
 void
@@ -54,9 +53,6 @@
 			break;
 		case 'i':
 			printf("%d", va_arg(va, int));
-			break;
-		case 'a':
-			fputs(va_arg(va, char *), stdout);
 			break;
 		default:
 			putchar(c);
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -19,7 +19,7 @@
 	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;