aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm_ppc.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_asm_ppc.h97
1 files changed, 2 insertions, 95 deletions
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h
index d0feb43a..9c9c3ea4 100644
--- a/src/lj_asm_ppc.h
+++ b/src/lj_asm_ppc.h
@@ -329,15 +329,6 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
329 } 329 }
330} 330}
331 331
332static void asm_call(ASMState *as, IRIns *ir)
333{
334 IRRef args[CCI_NARGS_MAX];
335 const CCallInfo *ci = &lj_ir_callinfo[ir->op2];
336 asm_collectargs(as, ir, ci, args);
337 asm_setupresult(as, ir, ci);
338 asm_gencall(as, ci, args);
339}
340
341static void asm_callx(ASMState *as, IRIns *ir) 332static void asm_callx(ASMState *as, IRIns *ir)
342{ 333{
343 IRRef args[CCI_NARGS_MAX]; 334 IRRef args[CCI_NARGS_MAX];
@@ -361,16 +352,6 @@ static void asm_callx(ASMState *as, IRIns *ir)
361 asm_gencall(as, &ci, args); 352 asm_gencall(as, &ci, args);
362} 353}
363 354
364static void asm_callid(ASMState *as, IRIns *ir, IRCallID id)
365{
366 const CCallInfo *ci = &lj_ir_callinfo[id];
367 IRRef args[2];
368 args[0] = ir->op1;
369 args[1] = ir->op2;
370 asm_setupresult(as, ir, ci);
371 asm_gencall(as, ci, args);
372}
373
374/* -- Returns ------------------------------------------------------------- */ 355/* -- Returns ------------------------------------------------------------- */
375 356
376/* Return to lower frame. Guard that it goes to the right spot. */ 357/* Return to lower frame. Guard that it goes to the right spot. */
@@ -510,28 +491,6 @@ static void asm_conv(ASMState *as, IRIns *ir)
510 } 491 }
511} 492}
512 493
513#if LJ_HASFFI
514static void asm_conv64(ASMState *as, IRIns *ir)
515{
516 IRType st = (IRType)((ir-1)->op2 & IRCONV_SRCMASK);
517 IRType dt = (((ir-1)->op2 & IRCONV_DSTMASK) >> IRCONV_DSH);
518 IRCallID id;
519 const CCallInfo *ci;
520 IRRef args[2];
521 args[0] = ir->op1;
522 args[1] = (ir-1)->op1;
523 if (st == IRT_NUM || st == IRT_FLOAT) {
524 id = IRCALL_fp64_d2l + ((st == IRT_FLOAT) ? 2 : 0) + (dt - IRT_I64);
525 ir--;
526 } else {
527 id = IRCALL_fp64_l2d + ((dt == IRT_FLOAT) ? 2 : 0) + (st - IRT_I64);
528 }
529 ci = &lj_ir_callinfo[id];
530 asm_setupresult(as, ir, ci);
531 asm_gencall(as, ci, args);
532}
533#endif
534
535static void asm_strto(ASMState *as, IRIns *ir) 494static void asm_strto(ASMState *as, IRIns *ir)
536{ 495{
537 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_strscan_num]; 496 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_strscan_num];
@@ -550,6 +509,8 @@ static void asm_strto(ASMState *as, IRIns *ir)
550 emit_tai(as, PPCI_ADDI, ra_releasetmp(as, ASMREF_TMP1), RID_SP, ofs); 509 emit_tai(as, PPCI_ADDI, ra_releasetmp(as, ASMREF_TMP1), RID_SP, ofs);
551} 510}
552 511
512/* -- Memory references --------------------------------------------------- */
513
553/* Get pointer to TValue. */ 514/* Get pointer to TValue. */
554static void asm_tvptr(ASMState *as, Reg dest, IRRef ref) 515static void asm_tvptr(ASMState *as, Reg dest, IRRef ref)
555{ 516{
@@ -573,27 +534,6 @@ static void asm_tvptr(ASMState *as, Reg dest, IRRef ref)
573 } 534 }
574} 535}
575 536
576static void asm_tostr(ASMState *as, IRIns *ir)
577{
578 IRRef args[2];
579 args[0] = ASMREF_L;
580 as->gcsteps++;
581 if (irt_isnum(IR(ir->op1)->t) || (ir+1)->o == IR_HIOP) {
582 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_str_fromnum];
583 args[1] = ASMREF_TMP1; /* const lua_Number * */
584 asm_setupresult(as, ir, ci); /* GCstr * */
585 asm_gencall(as, ci, args);
586 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op1);
587 } else {
588 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_str_fromint];
589 args[1] = ir->op1; /* int32_t k */
590 asm_setupresult(as, ir, ci); /* GCstr * */
591 asm_gencall(as, ci, args);
592 }
593}
594
595/* -- Memory references --------------------------------------------------- */
596
597static void asm_aref(ASMState *as, IRIns *ir) 537static void asm_aref(ASMState *as, IRIns *ir)
598{ 538{
599 Reg dest = ra_dest(as, ir, RSET_GPR); 539 Reg dest = ra_dest(as, ir, RSET_GPR);
@@ -770,20 +710,6 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
770 } 710 }
771} 711}
772 712
773static void asm_newref(ASMState *as, IRIns *ir)
774{
775 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_tab_newkey];
776 IRRef args[3];
777 if (ir->r == RID_SINK)
778 return;
779 args[0] = ASMREF_L; /* lua_State *L */
780 args[1] = ir->op1; /* GCtab *t */
781 args[2] = ASMREF_TMP1; /* cTValue *key */
782 asm_setupresult(as, ir, ci); /* TValue * */
783 asm_gencall(as, ci, args);
784 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op2);
785}
786
787static void asm_uref(ASMState *as, IRIns *ir) 713static void asm_uref(ASMState *as, IRIns *ir)
788{ 714{
789 /* NYI: Check that UREFO is still open and not aliasing a slot. */ 715 /* NYI: Check that UREFO is still open and not aliasing a slot. */
@@ -1194,25 +1120,6 @@ static void asm_fpunary(ASMState *as, IRIns *ir, PPCIns pi)
1194 emit_fb(as, pi, dest, left); 1120 emit_fb(as, pi, dest, left);
1195} 1121}
1196 1122
1197static int asm_fpjoin_pow(ASMState *as, IRIns *ir)
1198{
1199 IRIns *irp = IR(ir->op1);
1200 if (irp == ir-1 && irp->o == IR_MUL && !ra_used(irp)) {
1201 IRIns *irpp = IR(irp->op1);
1202 if (irpp == ir-2 && irpp->o == IR_FPMATH &&
1203 irpp->op2 == IRFPM_LOG2 && !ra_used(irpp)) {
1204 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_pow];
1205 IRRef args[2];
1206 args[0] = irpp->op1;
1207 args[1] = irp->op2;
1208 asm_setupresult(as, ir, ci);
1209 asm_gencall(as, ci, args);
1210 return 1;
1211 }
1212 }
1213 return 0;
1214}
1215
1216static void asm_add(ASMState *as, IRIns *ir) 1123static void asm_add(ASMState *as, IRIns *ir)
1217{ 1124{
1218 if (irt_isnum(ir->t)) { 1125 if (irt_isnum(ir->t)) {