commit ff607f1a1e4d8f15adb075e427b4b9ea0ad34c03
parent fb0803ec1301575bb334a1199da0c88e95364333
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Mon, 21 Sep 2015 19:28:10 -0400
emit syntactically valid calls
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git 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);