diff options
Diffstat (limited to 'lisc/emit.c')
-rw-r--r-- | lisc/emit.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lisc/emit.c b/lisc/emit.c index 449824c..8f370d9 100644 --- a/lisc/emit.c +++ b/lisc/emit.c @@ -221,11 +221,8 @@ eins(Ins i, Fn *fn, FILE *f) emitf(fn, f, "\t%s%w %M, %R\n", otoa[i.op], i.wide, i.arg[0], i.to); break; - case OAlloc: - emitf(fn, f, "\tsub%w %R, %R\n", - 1, i.arg[0], TMP(RSP)); - emitf(fn, f, "\tmov%w %R, %R\n", - 1, TMP(RSP), i.to); + case OCall: + emitf(fn, f, "\tcall%w %R\n", 1, i.arg[0]); break; case OAddr: emitf(fn, f, "\tlea%w %M, %R\n", @@ -244,6 +241,19 @@ eins(Ins i, Fn *fn, FILE *f) } else diag("emit: unhandled instruction (2)"); break; + case OSAlloc: + emitf(fn, f, "\tsub%w %R, %R\n", + 1, i.arg[0], TMP(RSP)); + if (!req(i.to, R)) + emitf(fn, f, "\tmov%w %R, %R\n", + 1, TMP(RSP), i.to); + break; + case OXPush: + emitf(fn, f, "\tpush%w %R\n", 1, i.arg[0]); + break; + case OXMovs: + emitf(fn, f, "\trep movsb\n"); + break; case OXDiv: emitf(fn, f, "\tidiv%w %R\n", i.wide, i.arg[0]); break; |