summary refs log tree commit diff
path: root/lisc/spill.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-05 21:46:15 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commite5983ba1a2174fe7fd004692a427aae5bfc0dc4c (patch)
treeb763a06abb664a8a2b0a3c89818897d30e0837f4 /lisc/spill.c
parent7cb3e8587f7dbcbe795114f9ea5584009842ea29 (diff)
downloadroux-e5983ba1a2174fe7fd004692a427aae5bfc0dc4c.tar.gz
fix 2 bad bugs in rega and improve substraction
The substraction contrained the register allocator
to allocate a different register for the result and
the second operand, now, we use a neg trick to compile
it down.  The machinery that was setup is, regardless,
interesting and will have to be used for floating
point computations (division).

The first bug in rega made broke the explicited loop
invariant:  we were using register allocation unavailable
information from other blocks.  It's still unclear
how we got wrong results from that considering mappings
are all 0-initialized.

The second bug is a stupid one, one sizeof operator was
missing from a memcpy...
Diffstat (limited to 'lisc/spill.c')
-rw-r--r--lisc/spill.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/lisc/spill.c b/lisc/spill.c
index 8b7c67e..7361b11 100644
--- a/lisc/spill.c
+++ b/lisc/spill.c
@@ -361,22 +361,7 @@ spill(Fn *fn)
 			case -1:;
 			}
 			w = (Bits){{0}};
-			if (rtype(i->arg[1]) == RTmp
-			&& !req(i->to, R)
-			&& opdesc[i->op].comm == F) {
-				/* <arch>
-				 *   here we make sure that we
-				 *   will never have to compile
-				 *   say: eax = sub ebx, eax
-				 *   on a two-address machine
-				 */
-				BSET(w, i->to.val);
-				BSET(v, i->to.val);
-				setloc(&i->arg[1], &v, &w);
-				BCLR(v, i->to.val);
-				BCLR(w, i->to.val);
-			} else
-				setloc(&i->arg[1], &v, &w);
+			setloc(&i->arg[1], &v, &w);
 			setloc(&i->arg[0], &v, &w);
 			if (s)
 				emit(OStore, R, i->to, SLOT(s));