ref: 8d0d2c097a87b8d96e107bab9b0c9176e75f89ef
parent: 78ccf13a90596a1c132707c46679d62e2a18207b
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Mar 20 23:20:08 EDT 2015
Improve assign() in cc2 Once a value is assigned, left and righ nodes contain the same content, so both nodes (and the parent) contain a correct value for the symbol (if any), so any of them can be used instead of the symbol.
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -333,6 +333,7 @@
case AUTO:
if (rp->op != REG)
move(rp, np);
+ lp->reg = rp->reg;
code(LDL, lp, rp);
break;
case REG:
@@ -346,10 +347,10 @@
abort();
}
- lp->used = 1;
np->op = REG;
- np->reg = rp->reg;
- np->sym = lp->sym;
+ np->reg = lp->reg;
+ np->sym = rp->sym = lp->sym;
+ np->used = rp->used = lp->used = 1;
}
static void