commit 4b0a865fee969e27598f90ea1a091066f3f88d61
parent 1721fe43137e54e05a62663235a5a8cebb7f4761
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sat, 8 Aug 2015 00:31:52 -0400
forbid two memory operands for comparisons
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git 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));