diff options
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) { |