summaryrefslogtreecommitdiff
path: root/src/lj_asm_ppc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_asm_ppc.h')
-rw-r--r--src/lj_asm_ppc.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h
index 166cf2e4..196ca2ed 100644
--- a/src/lj_asm_ppc.h
+++ b/src/lj_asm_ppc.h
@@ -284,6 +284,8 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
284 ofs += 4; 284 ofs += 4;
285 } 285 }
286 } 286 }
287 if ((ci->flags & CCI_VARARG)) /* Vararg calls need to know about FPR use. */
288 emit_tab(as, fpr == REGARG_FIRSTFPR ? PPCI_CRXOR : PPCI_CREQV, 6, 6, 6);
287} 289}
288 290
289/* Setup result reg/sp for call. Evict scratch regs. */ 291/* Setup result reg/sp for call. Evict scratch regs. */
@@ -336,14 +338,18 @@ static void asm_callx(ASMState *as, IRIns *ir)
336{ 338{
337 IRRef args[CCI_NARGS_MAX]; 339 IRRef args[CCI_NARGS_MAX];
338 CCallInfo ci; 340 CCallInfo ci;
341 IRRef func;
342 IRIns *irf;
339 ci.flags = asm_callx_flags(as, ir); 343 ci.flags = asm_callx_flags(as, ir);
340 asm_collectargs(as, ir, &ci, args); 344 asm_collectargs(as, ir, &ci, args);
341 asm_setupresult(as, ir, &ci); 345 asm_setupresult(as, ir, &ci);
342 if (irref_isk(ir->op2)) { /* Call to constant address. */ 346 func = ir->op2; irf = IR(func);
343 ci.func = (ASMFunction)(void *)(IR(ir->op2)->i); 347 if (irf->o == IR_CARG) { func = irf->op1; irf = IR(func); }
348 if (irref_isk(func)) { /* Call to constant address. */
349 ci.func = (ASMFunction)(void *)(irf->i);
344 } else { /* Need a non-argument register for indirect calls. */ 350 } else { /* Need a non-argument register for indirect calls. */
345 RegSet allow = RSET_GPR & ~RSET_RANGE(RID_R0, REGARG_LASTGPR+1); 351 RegSet allow = RSET_GPR & ~RSET_RANGE(RID_R0, REGARG_LASTGPR+1);
346 Reg freg = ra_alloc1(as, ir->op2, allow); 352 Reg freg = ra_alloc1(as, func, allow);
347 *--as->mcp = PPCI_BCTRL; 353 *--as->mcp = PPCI_BCTRL;
348 *--as->mcp = PPCI_MTCTR | PPCF_T(freg); 354 *--as->mcp = PPCI_MTCTR | PPCF_T(freg);
349 ci.func = (ASMFunction)(void *)0; 355 ci.func = (ASMFunction)(void *)0;