shithub: scc

Download patch

ref: c40ce09e945f1f7fae5347518f85796fb038d053
parent: b1235747c1c0b59be05f56a068a2d0f912b10227
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Mar 20 12:52:46 EDT 2015

Change allocreg to receive only a num

These function only returns the number of the register which
is ready to be used, so it is a non sense to pass it the
pointer to the node.

--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -82,13 +82,13 @@
 };
 
 static uint8_t
-allocreg(Node *np)
+allocreg(uint8_t size)
 {
 	static uint8_t reg8[] = {A, B, C, D, E, H, L, IYL, IY, 0};
 	static uint8_t reg16[] = {BC, DE, IY, 0};
 	uint8_t *bp, c;
 
-	switch (np->type.size) {
+	switch (size) {
 	case 1:
 		bp = reg8;
 		break;
@@ -128,7 +128,7 @@
 			np->op = sym->kind;
 			sym->dirty = 0;
 		} else {
-			new = allocreg(np);
+			new = allocreg(1);
 			moveto(np, new);
 		}
 		break;