summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-08 00:31:52 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commit4b0a865fee969e27598f90ea1a091066f3f88d61 (patch)
treee7fd9fece8ec8ef525dd2ff25133dea5dcadc198
parent1721fe43137e54e05a62663235a5a8cebb7f4761 (diff)
downloadroux-4b0a865fee969e27598f90ea1a091066f3f88d61.tar.gz
forbid two memory operands for comparisons
-rw-r--r--lisc/spill.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisc/spill.c b/lisc/spill.c
index ca7d962..3ca297a 100644
--- a/lisc/spill.c
+++ b/lisc/spill.c
@@ -362,6 +362,16 @@ spill(Fn *fn)
 			}
 			w = (Bits){{0}};
 			setloc(&i->arg[0], &v, &w);
+			if (i->op == OXCmpw || i->op == OXCmpl)
+			if (rtype(i->arg[0]) == RSlot) {
+				/* <arch>
+				 * we make sure that comparisons
+				 * do not get their two operands
+				 * in memory slots
+				 */
+				assert(rtype(i->arg[1]) == RTmp);
+				BSET(w, i->arg[1].val);
+			}
 			setloc(&i->arg[1], &v, &w);
 			if (s)
 				emit(OStore, R, i->to, SLOT(s));