diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-08-20 11:51:59 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:32 -0400 |
commit | fd31290dd37cfd8f7ba765eb330d719bafba42f0 (patch) | |
tree | cebcbcb82fc538d64ab2e48d54937c422b187ec6 /lisc/emit.c | |
parent | 328cdc448ca7ab6dd7efbf595472a0d49da3651a (diff) | |
download | roux-fd31290dd37cfd8f7ba765eb330d719bafba42f0.tar.gz |
fix emit(OCopy) and use pointers in max.ssa
Diffstat (limited to 'lisc/emit.c')
-rw-r--r-- | lisc/emit.c | 18 |
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: |