diff options
Diffstat (limited to 'arm64/isel.c')
-rw-r--r-- | arm64/isel.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arm64/isel.c b/arm64/isel.c index f064321..c80e481 100644 --- a/arm64/isel.c +++ b/arm64/isel.c @@ -156,6 +156,22 @@ selcmp(Ref arg[2], int k, Fn *fn) return swap; } +static int +callable(Ref r, Fn *fn) +{ + Con *c; + + if (rtype(r) == RTmp) + return 1; + if (rtype(r) == RCon) { + c = &fn->con[r.val]; + if (c->type == CAddr) + if (c->bits.i == 0) + return 1; + } + return 0; +} + static void sel(Ins i, Fn *fn) { @@ -178,6 +194,11 @@ sel(Ins i, Fn *fn) i0->op += cc; return; } + if (i.op == Ocall) + if (callable(i.arg[0], fn)) { + emiti(i); + return; + } if (i.op != Onop) { emiti(i); iarg = curi->arg; /* fixarg() can change curi */ |