scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 9b361f53cda590cb1dc5645301f600dac17d1c5d
parent 96e6976155ca954ce9abeb308640e28901211479
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 20 Mar 2015 13:01:04 -0400

Merge MEM and AUTO cases of assign()

They are exactly the same, only a movement between an address
and a register. If the address is indexed, then is better for us,
in other case is the same.

Diffstat:
Mcc2/cgen.c | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -333,6 +333,7 @@ assign(Node *np) switch (np->type.size) { case 1: switch (lp->op) { + case MEM: case AUTO: code(LDL, lp, rp); break; @@ -340,11 +341,6 @@ assign(Node *np) /* TODO: what happens with the previous register? */ code(MOV, lp, rp); break; - case MEM: - /* TODO: check if the variable is indexed */ - index(lp); - code(LDL, lp, rp); - break; default: abort(); }