diff options
| author | 2025-11-22 19:40:43 +0100 | |
|---|---|---|
| committer | 2025-11-22 19:54:46 +0100 | |
| commit | f381c0854a02aad57f887f335fb84c0e5de32ec5 (patch) | |
| tree | 71d9f559378b7b945abdda7141335a94864c108e /amd64 | |
| parent | d030198aea96012b635b559fc6021fd954205395 (diff) | |
amd64/isel: indirect call arg must be memaddr
Diffstat (limited to 'amd64')
| -rw-r--r-- | amd64/isel.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/amd64/isel.c b/amd64/isel.c index 26ee6e0..9606c87 100644 --- a/amd64/isel.c +++ b/amd64/isel.c @@ -115,6 +115,8 @@ fixarg(union ref *r, struct instr *ins, struct block *blk, int *curi) picfixsym(r, blk, curi); } +#define isimm32(r) (iscon(r) && concls(r) == KI32) + static void selcall(struct function *fn, struct instr *ins, struct block *blk, int *curi) { @@ -147,6 +149,11 @@ selcall(struct function *fn, struct instr *ins, struct block *blk, int *curi) ++*curi; insertinstr(blk, *curi+1, (struct instr){Oadd, KPTR, .keep=1, .reg = RSP+1, .l=mkref(RREG,RSP), disp}); } + if (isimm32(ins->l)) + ins->l = mkaddr((struct addr){.base = ins->l}); + else if (isintcon(ins->l)) + ins->l = insertinstr(blk, (*curi)++, mkinstr(Ocopy, KPTR, ins->l)); + if (call->vararg >= 0 && ins->l.t == RTMP) { /* variadic calls write number of sse regs used to AL, so mark it as clobbered such that * the function pointer of an indirect calls does not get allocated to RAX by regalloc */ @@ -166,8 +173,6 @@ selcall(struct function *fn, struct instr *ins, struct block *blk, int *curi) } } -#define isimm32(r) (iscon(r) && concls(r) == KI32) - static bool aimm(struct addr *addr, int disp) { |