diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-10 22:55:03 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:33 -0400 |
commit | 8201c6161e215e4716f3305e3dcb1e6b3de15ea9 (patch) | |
tree | 92596cdc92b02bb1039d41ff46002f855c8e607c /lisc/emit.c | |
parent | 7e86fc39fcee98595a723daac39aa8a4ee3dfc96 (diff) | |
download | roux-8201c6161e215e4716f3305e3dcb1e6b3de15ea9.tar.gz |
start function call lowering (wip)
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; |