shithub: scc

Download patch

ref: a06ccd18deaeedf0f3cb0da8fa3531fa89e6f177
parent: 89fc1db118a0ab6e3b65f29074db76085a1587cc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Apr 23 13:25:30 EDT 2016

[cc2] Break dependency between O and S codes

Until now, codes like OAUTO were forced to be equal to codes like SAUTO.
This commit break this dependency.

--- a/cc2/code.c
+++ b/cc2/code.c
@@ -29,16 +29,25 @@
 static void
 addr(Node *np, Addr *addr)
 {
-	switch (addr->kind = np->op) {
-	case SREG:
+	switch (np->op) {
+	case OREG:
+		addr->kind = SREG;
 		addr->u.reg = np->u.reg;
 		break;
-	case SCONST:
+	case OCONST:
+		addr->kind = OCONST;
 		addr->u.i = np->u.i;
 		break;
-	case SLABEL:
-	case SAUTO:
-	case STMP:
+	case OJMP:
+	case OLABEL:
+		addr->kind = SLABEL;
+		goto symbol;
+	case OAUTO:
+		addr->kind = SAUTO;
+		goto symbol;
+	case OTMP:
+		addr->kind = STMP;;
+	symbol:
 		addr->u.sym = np->u.sym;
 		break;
 	default: