aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm_arm.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_asm_arm.h102
1 files changed, 3 insertions, 99 deletions
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h
index 57c2dd81..37cbb5be 100644
--- a/src/lj_asm_arm.h
+++ b/src/lj_asm_arm.h
@@ -453,15 +453,6 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
453 UNUSED(ci); 453 UNUSED(ci);
454} 454}
455 455
456static void asm_call(ASMState *as, IRIns *ir)
457{
458 IRRef args[CCI_NARGS_MAX];
459 const CCallInfo *ci = &lj_ir_callinfo[ir->op2];
460 asm_collectargs(as, ir, ci, args);
461 asm_setupresult(as, ir, ci);
462 asm_gencall(as, ci, args);
463}
464
465static void asm_callx(ASMState *as, IRIns *ir) 456static void asm_callx(ASMState *as, IRIns *ir)
466{ 457{
467 IRRef args[CCI_NARGS_MAX]; 458 IRRef args[CCI_NARGS_MAX];
@@ -600,31 +591,6 @@ static void asm_conv(ASMState *as, IRIns *ir)
600 } 591 }
601} 592}
602 593
603#if !LJ_SOFTFP && LJ_HASFFI
604static void asm_conv64(ASMState *as, IRIns *ir)
605{
606 IRType st = (IRType)((ir-1)->op2 & IRCONV_SRCMASK);
607 IRType dt = (((ir-1)->op2 & IRCONV_DSTMASK) >> IRCONV_DSH);
608 IRCallID id;
609 CCallInfo ci;
610 IRRef args[2];
611 args[0] = (ir-1)->op1;
612 args[1] = ir->op1;
613 if (st == IRT_NUM || st == IRT_FLOAT) {
614 id = IRCALL_fp64_d2l + ((st == IRT_FLOAT) ? 2 : 0) + (dt - IRT_I64);
615 ir--;
616 } else {
617 id = IRCALL_fp64_l2d + ((dt == IRT_FLOAT) ? 2 : 0) + (st - IRT_I64);
618 }
619 ci = lj_ir_callinfo[id];
620#if !LJ_ABI_SOFTFP
621 ci.flags |= CCI_VARARG; /* These calls don't use the hard-float ABI! */
622#endif
623 asm_setupresult(as, ir, &ci);
624 asm_gencall(as, &ci, args);
625}
626#endif
627
628static void asm_strto(ASMState *as, IRIns *ir) 594static void asm_strto(ASMState *as, IRIns *ir)
629{ 595{
630 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_strscan_num]; 596 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_strscan_num];
@@ -688,6 +654,8 @@ static void asm_strto(ASMState *as, IRIns *ir)
688 emit_opk(as, ARMI_ADD, tmp, RID_SP, ofs, RSET_GPR); 654 emit_opk(as, ARMI_ADD, tmp, RID_SP, ofs, RSET_GPR);
689} 655}
690 656
657/* -- Memory references --------------------------------------------------- */
658
691/* Get pointer to TValue. */ 659/* Get pointer to TValue. */
692static void asm_tvptr(ASMState *as, Reg dest, IRRef ref) 660static void asm_tvptr(ASMState *as, Reg dest, IRRef ref)
693{ 661{
@@ -713,7 +681,7 @@ static void asm_tvptr(ASMState *as, Reg dest, IRRef ref)
713 Reg src = ra_alloc1(as, ref, allow); 681 Reg src = ra_alloc1(as, ref, allow);
714 emit_lso(as, ARMI_STR, src, RID_SP, 0); 682 emit_lso(as, ARMI_STR, src, RID_SP, 0);
715 } 683 }
716 if ((ir+1)->o == IR_HIOP) 684 if (LJ_SOFTFP && (ir+1)->o == IR_HIOP)
717 type = ra_alloc1(as, ref+1, allow); 685 type = ra_alloc1(as, ref+1, allow);
718 else 686 else
719 type = ra_allock(as, irt_toitype(ir->t), allow); 687 type = ra_allock(as, irt_toitype(ir->t), allow);
@@ -721,27 +689,6 @@ static void asm_tvptr(ASMState *as, Reg dest, IRRef ref)
721 } 689 }
722} 690}
723 691
724static void asm_tostr(ASMState *as, IRIns *ir)
725{
726 IRRef args[2];
727 args[0] = ASMREF_L;
728 as->gcsteps++;
729 if (irt_isnum(IR(ir->op1)->t) || (ir+1)->o == IR_HIOP) {
730 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_str_fromnum];
731 args[1] = ASMREF_TMP1; /* const lua_Number * */
732 asm_setupresult(as, ir, ci); /* GCstr * */
733 asm_gencall(as, ci, args);
734 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op1);
735 } else {
736 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_str_fromint];
737 args[1] = ir->op1; /* int32_t k */
738 asm_setupresult(as, ir, ci); /* GCstr * */
739 asm_gencall(as, ci, args);
740 }
741}
742
743/* -- Memory references --------------------------------------------------- */
744
745static void asm_aref(ASMState *as, IRIns *ir) 692static void asm_aref(ASMState *as, IRIns *ir)
746{ 693{
747 Reg dest = ra_dest(as, ir, RSET_GPR); 694 Reg dest = ra_dest(as, ir, RSET_GPR);
@@ -959,20 +906,6 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
959 emit_opk(as, ARMI_ADD, dest, node, ofs, RSET_GPR); 906 emit_opk(as, ARMI_ADD, dest, node, ofs, RSET_GPR);
960} 907}
961 908
962static void asm_newref(ASMState *as, IRIns *ir)
963{
964 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_tab_newkey];
965 IRRef args[3];
966 if (ir->r == RID_SINK)
967 return;
968 args[0] = ASMREF_L; /* lua_State *L */
969 args[1] = ir->op1; /* GCtab *t */
970 args[2] = ASMREF_TMP1; /* cTValue *key */
971 asm_setupresult(as, ir, ci); /* TValue * */
972 asm_gencall(as, ci, args);
973 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op2);
974}
975
976static void asm_uref(ASMState *as, IRIns *ir) 909static void asm_uref(ASMState *as, IRIns *ir)
977{ 910{
978 /* NYI: Check that UREFO is still open and not aliasing a slot. */ 911 /* NYI: Check that UREFO is still open and not aliasing a slot. */
@@ -1391,25 +1324,6 @@ static void asm_fpunary(ASMState *as, IRIns *ir, ARMIns ai)
1391 Reg left = ra_hintalloc(as, ir->op1, dest, RSET_FPR); 1324 Reg left = ra_hintalloc(as, ir->op1, dest, RSET_FPR);
1392 emit_dm(as, ai, (dest & 15), (left & 15)); 1325 emit_dm(as, ai, (dest & 15), (left & 15));
1393} 1326}
1394
1395static int asm_fpjoin_pow(ASMState *as, IRIns *ir)
1396{
1397 IRIns *irp = IR(ir->op1);
1398 if (irp == ir-1 && irp->o == IR_MUL && !ra_used(irp)) {
1399 IRIns *irpp = IR(irp->op1);
1400 if (irpp == ir-2 && irpp->o == IR_FPMATH &&
1401 irpp->op2 == IRFPM_LOG2 && !ra_used(irpp)) {
1402 const CCallInfo *ci = &lj_ir_callinfo[IRCALL_pow];
1403 IRRef args[2];
1404 args[0] = irpp->op1;
1405 args[1] = irp->op2;
1406 asm_setupresult(as, ir, ci);
1407 asm_gencall(as, ci, args);
1408 return 1;
1409 }
1410 }
1411 return 0;
1412}
1413#endif 1327#endif
1414 1328
1415static int asm_swapops(ASMState *as, IRRef lref, IRRef rref) 1329static int asm_swapops(ASMState *as, IRRef lref, IRRef rref)
@@ -1561,16 +1475,6 @@ static void asm_neg(ASMState *as, IRIns *ir)
1561 asm_intneg(as, ir, ARMI_RSB); 1475 asm_intneg(as, ir, ARMI_RSB);
1562} 1476}
1563 1477
1564static void asm_callid(ASMState *as, IRIns *ir, IRCallID id)
1565{
1566 const CCallInfo *ci = &lj_ir_callinfo[id];
1567 IRRef args[2];
1568 args[0] = ir->op1;
1569 args[1] = ir->op2;
1570 asm_setupresult(as, ir, ci);
1571 asm_gencall(as, ci, args);
1572}
1573
1574#if !LJ_SOFTFP 1478#if !LJ_SOFTFP
1575static void asm_callround(ASMState *as, IRIns *ir, int id) 1479static void asm_callround(ASMState *as, IRIns *ir, int id)
1576{ 1480{