summary refs log tree commit diff
path: root/lisc/emit.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-20 11:51:59 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:32 -0400
commitfd31290dd37cfd8f7ba765eb330d719bafba42f0 (patch)
treecebcbcb82fc538d64ab2e48d54937c422b187ec6 /lisc/emit.c
parent328cdc448ca7ab6dd7efbf595472a0d49da3651a (diff)
downloadroux-fd31290dd37cfd8f7ba765eb330d719bafba42f0.tar.gz
fix emit(OCopy) and use pointers in max.ssa
Diffstat (limited to 'lisc/emit.c')
-rw-r--r--lisc/emit.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index b8b65d6..59b439b 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -195,14 +195,16 @@ eins(Ins i, Fn *fn, FILE *f)
 	case OCopy:
 		if (req(i.to, R))
 			break;
-		if (i.to.val < EAX && rtype(i.arg[0]) == RCon) {
-			val = fn->con[i.arg[0].val].val;
-			if (0 <= val && val <= UINT32_MAX) {
-				fprintf(f, "\tmov $%"PRId64", %%%s\n",
-					val, rsub[i.to.val][SWord]);
-				break;
-			}
-		} else if (!req(i.arg[0], i.to))
+		if (i.to.val < EAX
+		&& rtype(i.arg[0]) == RCon
+		&& fn->con[i.arg[0].val].type == CNum
+		&& (val = fn->con[i.arg[0].val].val) >= 0
+		&& val <= UINT32_MAX) {
+			fprintf(f, "\tmov $%"PRId64", %%%s\n",
+				val, rsub[i.to.val][SWord]);
+			break;
+		}
+		if (!req(i.arg[0], i.to))
 			eop("mov", i.arg[0], i.to, fn, f);
 		break;
 	case OStorel: