shithub: scc

Download patch

ref: 348cbf56cdf4a39bf18b451ecd32e2df57b86fb1
parent: 7c88dc7a0c96e24b53b0aeea66d74b3a757be2d4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 12 07:47:55 EST 2015

Mark the node with the correct register in add

When an operation is performed and the result is stored in some
register, then we have to update the node to register, because in
other case it is not possible to know where is located the result.

--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -138,6 +138,8 @@
 				code(LD, A, lp->u.reg);
 			}
 			code(ADD, A, rp->u.reg);
+			np->op = REG;
+			np->u.reg = A;
 			break;
 		case 2:
 			if (rp->u.reg == HL || rp->u.reg == IY) {
--