aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amd64/isel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 73e0860..889c647 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -96,6 +96,14 @@ fixarg(Ref *r, int k, Ins *i, Fn *fn)
a.offset.sym.id = intern(buf);
fn->mem[fn->nmem-1] = a;
}
+ else if (op == Ocall && r == &i->arg[0]
+ && rtype(r0) == RCon && fn->con[r0.val].type != CAddr) {
+ /* use a temporary register so that we
+ * produce an indirect call
+ */
+ r1 = newtmp("isel", Kl, fn);
+ emit(Ocopy, Kl, r1, r0, R);
+ }
else if (op != Ocopy && k == Kl && noimm(r0, fn)) {
/* load constants that do not fit in
* a 32bit signed integer into a