diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-08-16 12:12:19 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:31 -0400 |
commit | ca8c320dec82df1700216a5a040768bfc2d81632 (patch) | |
tree | d913fcc9b98ecc3b884099eada8cbd4012c57694 /lisc/emit.c | |
parent | 16fe5c13668d9ccc8f3b14c6c20565dfe5a26d57 (diff) | |
download | roux-ca8c320dec82df1700216a5a040768bfc2d81632.tar.gz |
replace RMem refs with an OAddr opertation
Diffstat (limited to 'lisc/emit.c')
-rw-r--r-- | lisc/emit.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lisc/emit.c b/lisc/emit.c index 3e03a81..22e9073 100644 --- a/lisc/emit.c +++ b/lisc/emit.c @@ -81,7 +81,6 @@ eref(Ref r, Fn *fn, FILE *f) assert(r.val < Tmp0); fprintf(f, "%%%s", rtoa(r.val)); break; - case RMem: case RSlot: fprintf(f, "-%d(%%rbp)", 4 * r.val); break; @@ -106,7 +105,6 @@ emem(Ref r, Fn *fn, FILE *f) switch (rtype(r)) { default: diag("emit: invalid memory reference"); - case RMem: case RSlot: eref(r, fn, f); break; @@ -186,10 +184,6 @@ eins(Ins i, Fn *fn, FILE *f) val, rsub[i.to.val][SWord]); break; } - } - if (rtype(i.arg[0]) == RMem) { - assert(rtype(i.to)==RTmp && i.to.val<EAX); - eop("lea", i.arg[0], i.to, fn, f); } else if (!req(i.arg[0], i.to)) eop("mov", i.arg[0], i.to, fn, f); break; @@ -228,6 +222,11 @@ eins(Ins i, Fn *fn, FILE *f) if (!req(i.to, R)) eop("mov", TMP(RSP), i.to, fn ,f); break; + case OAddr: + if (rtype(i.arg[0]) != RSlot) + diag("emit: invalid addr instruction"); + eop("lea", i.arg[0], i.to, fn, f); + break; case OSwap: eop("xchg", i.arg[0], i.arg[1], fn, f); break; |