From 4b0a865fee969e27598f90ea1a091066f3f88d61 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sat, 8 Aug 2015 00:31:52 -0400 Subject: forbid two memory operands for comparisons --- lisc/spill.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) { + /* + * 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)); -- cgit 1.4.1