#endif
#if !LJ_TARGET_X86ORX64
-/* Force a RID_RET/RID_RETHI destination register pair (marked as free). */
+/* Force a RID_RETLO/RID_RETHI destination register pair (marked as free). */
static void ra_destpair(ASMState *as, IRIns *ir)
{
Reg destlo = ir->r, desthi = (ir+1)->r;
/* First spill unrelated refs blocking the destination registers. */
- if (!rset_test(as->freeset, RID_RET) &&
- destlo != RID_RET && desthi != RID_RET)
- ra_restore(as, regcost_ref(as->cost[RID_RET]));
+ if (!rset_test(as->freeset, RID_RETLO) &&
+ destlo != RID_RETLO && desthi != RID_RETLO)
+ ra_restore(as, regcost_ref(as->cost[RID_RETLO]));
if (!rset_test(as->freeset, RID_RETHI) &&
destlo != RID_RETHI && desthi != RID_RETHI)
ra_restore(as, regcost_ref(as->cost[RID_RETHI]));
ra_free(as, destlo);
ra_modified(as, destlo);
} else {
- destlo = RID_RET;
+ destlo = RID_RETLO;
}
if (ra_hasreg(desthi)) {
ra_free(as, desthi);
}
/* Check for conflicts and shuffle the registers as needed. */
if (destlo == RID_RETHI) {
- if (desthi == RID_RET) {
+ if (desthi == RID_RETLO) {
emit_movrr(as, ir, RID_RETHI, RID_TMP);
- emit_movrr(as, ir, RID_RET, RID_RETHI);
- emit_movrr(as, ir, RID_TMP, RID_RET);
+ emit_movrr(as, ir, RID_RETLO, RID_RETHI);
+ emit_movrr(as, ir, RID_TMP, RID_RETLO);
} else {
- emit_movrr(as, ir, RID_RETHI, RID_RET);
+ emit_movrr(as, ir, RID_RETHI, RID_RETLO);
if (desthi != RID_RETHI) emit_movrr(as, ir, desthi, RID_RETHI);
}
- } else if (desthi == RID_RET) {
- emit_movrr(as, ir, RID_RET, RID_RETHI);
- if (destlo != RID_RET) emit_movrr(as, ir, destlo, RID_RET);
+ } else if (desthi == RID_RETLO) {
+ emit_movrr(as, ir, RID_RETLO, RID_RETHI);
+ if (destlo != RID_RETLO) emit_movrr(as, ir, destlo, RID_RETLO);
} else {
if (desthi != RID_RETHI) emit_movrr(as, ir, desthi, RID_RETHI);
- if (destlo != RID_RET) emit_movrr(as, ir, destlo, RID_RET);
+ if (destlo != RID_RETLO) emit_movrr(as, ir, destlo, RID_RETLO);
}
/* Restore spill slots (if any). */
if (ra_hasspill((ir+1)->s)) ra_save(as, ir+1, RID_RETHI);
- if (ra_hasspill(ir->s)) ra_save(as, ir, RID_RET);
+ if (ra_hasspill(ir->s)) ra_save(as, ir, RID_RETLO);
}
#endif
case IR_CALLN: case IR_CALLXS:
#if LJ_SOFTFP
case IR_MIN: case IR_MAX:
+#endif
+#if LJ_BE
+ (ir-1)->prev = REGSP_HINT(RID_RETLO);
#endif
ir->prev = REGSP_HINT(RID_RETHI);
continue;
int destused = ra_used(ir);
Reg dest = ra_dest(as, ir, allow);
Reg tab = ra_alloc1(as, ir->op1, rset_clear(allow, dest));
- Reg key = 0, keyhi = 0, keynumhi = RID_NONE, tmp = RID_LR;
+ Reg key = 0, keyhi = 0, keynumhi = RID_NONE, tmp = RID_TMP;
IRRef refkey = ir->op2;
IRIns *irkey = IR(refkey);
IRType1 kt = irkey->t;
ra_evictset(as, drop);
ra_destpair(as, ir);
emit_dm(as, ARMF_CC(ARMI_MOV, cc), RID_RETHI, RID_R3);
- emit_dm(as, ARMF_CC(ARMI_MOV, cc), RID_RET, RID_R2);
+ emit_dm(as, ARMF_CC(ARMI_MOV, cc), RID_RETLO, RID_R2);
emit_call(as, (void *)ci->func);
for (r = RID_R0; r <= RID_R3; r++)
ra_leftov(as, r, args[r-RID_R0]);
case IR_CALLS:
case IR_CALLXS:
if (!uselo)
- ra_allocref(as, ir->op1, RID2RSET(RID_RET)); /* Mark lo op as used. */
+ ra_allocref(as, ir->op1, RID2RSET(RID_RETLO)); /* Mark lo op as used. */
break;
case IR_ASTORE: case IR_HSTORE: case IR_USTORE:
case IR_TOSTR: case IR_CNEWI:
dest, RID_ESP, ofs);
}
if ((ci->flags & CCI_CASTU64)) {
- emit_movtomro(as, RID_RET, RID_ESP, ofs);
+ emit_movtomro(as, RID_RETLO, RID_ESP, ofs);
emit_movtomro(as, RID_RETHI, RID_ESP, ofs+4);
} else {
emit_rmro(as, irt_isnum(ir->t) ? XO_FSTPq : XO_FSTPd,
case IR_CALLXS:
ra_destreg(as, ir, RID_RETHI);
if (!uselo)
- ra_allocref(as, ir->op1, RID2RSET(RID_RET)); /* Mark call as used. */
+ ra_allocref(as, ir->op1, RID2RSET(RID_RETLO)); /* Mark call as used. */
break;
case IR_CNEWI:
/* Nothing to do here. Handled by CNEWI itself. */