commit 99a8fb67ac30242d4792296c716568b96240db33
parent 2db68eed1297fdaabd1a5d513f03f17faf7b25b6
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sat, 22 Aug 2015 21:19:50 -0400
fix invalid test in emit
It could be that the destination of the copy is
a spill location, so we have to check the type
of i.to first.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisc/emit.c b/lisc/emit.c
@@ -195,7 +195,8 @@ eins(Ins i, Fn *fn, FILE *f)
case OCopy:
if (req(i.to, R))
break;
- if (i.to.val < EAX
+ if (rtype(i.to) == RTmp
+ && 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