scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 64ae09c9fd264a51ac2e8ccf18d37ba5e80be09b
parent 54e5f131aa340b2ad1ff8bf2cc23024029fa8b50
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 17 Mar 2015 15:05:02 +0000

Move reguse update to moveto()

This function is going to be used for all the register transfer,
so it is the best place where update the registers.

Diffstat:
cc2/cgen.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -102,10 +102,8 @@ allocreg(Node *np) for (bp = reg8; (c = *bp); ++bp) { if (reguse[c]) continue; - reguse[c] = np; return c; } - /* TODO: Move variable to stack using PUSH/POP */ break; case 2: for (bp = reg16; (c = *bp); ++bp) { @@ -113,10 +111,8 @@ allocreg(Node *np) if (reguse[u] || reguse[l]) continue; - reguse[u] = reguse[l] = np; return c; } - /* TODO: Move variable to stack using PUSH/POP */ break; } abort(); @@ -140,6 +136,7 @@ moveto(Node *np, uint8_t reg) default: abort(); } + reguse[reg] = np; break; case 2: switch (op) { @@ -153,6 +150,7 @@ moveto(Node *np, uint8_t reg) default: abort(); } + reguse[upper[reg]] = reguse[lower[reg]] = np; break; default: abort();