summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-21 19:28:10 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-21 19:28:10 -0400
commitff607f1a1e4d8f15adb075e427b4b9ea0ad34c03 (patch)
tree4fa18f52970909a30e8fa6836da5a53b65cf2143
parentfb0803ec1301575bb334a1199da0c88e95364333 (diff)
downloadroux-ff607f1a1e4d8f15adb075e427b4b9ea0ad34c03.tar.gz
emit syntactically valid calls
-rw-r--r--lisc/emit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index ad46289..820e2c4 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -224,7 +224,16 @@ eins(Ins i, Fn *fn, FILE *f)
i.wide, i.arg[0], i.to);
break;
case OCall:
- emitf(fn, f, "call%w %R", 1, i.arg[0]);
+ switch (rtype(i.arg[0])) {
+ default:
+ diag("emit: invalid call instruction");
+ case RCon:
+ emitf(fn, f, "callq %M", i.arg[0]);
+ break;
+ case RTmp:
+ emitf(fn, f, "call%w *%R", 1, i.arg[0]);
+ break;
+ }
break;
case OAddr:
emitf(fn, f, "lea%w %M, %R", i.wide, i.arg[0], i.to);