Refactor IR_VLOAD to take an offset.

This commit is contained in:
Mike Pall
2021-09-19 17:18:16 +02:00
parent f2d333c1ac
commit 9211f0b03b
9 changed files with 19 additions and 13 deletions

View File

@@ -227,9 +227,6 @@ static void asm_fuseahuref(ASMState *as, IRRef ref, RegSet allow)
#endif
return;
default:
lj_assertA(ir->o == IR_HREF || ir->o == IR_NEWREF || ir->o == IR_UREFO ||
ir->o == IR_KKPTR,
"bad IR op %d", ir->o);
break;
}
}
@@ -490,6 +487,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
}
} else if (ir->o == IR_VLOAD && !(LJ_GC64 && irt_isaddr(ir->t))) {
asm_fuseahuref(as, ir->op1, xallow);
as->mrm.ofs += 8 * ir->op2;
return RID_MRM;
}
}
@@ -1550,6 +1548,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
Reg dest = asm_load_lightud64(as, ir, 1);
if (ra_hasreg(dest)) {
asm_fuseahuref(as, ir->op1, RSET_GPR);
if (ir->o == IR_VLOAD) as->mrm.ofs += 8 * ir->op2;
emit_mrm(as, XO_MOV, dest|REX_64, RID_MRM);
}
return;
@@ -1559,6 +1558,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR;
Reg dest = ra_dest(as, ir, allow);
asm_fuseahuref(as, ir->op1, RSET_GPR);
if (ir->o == IR_VLOAD) as->mrm.ofs += 8 * ir->op2;
#if LJ_GC64
if (irt_isaddr(ir->t)) {
emit_shifti(as, XOg_SHR|REX_64, dest, 17);
@@ -1586,6 +1586,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
}
#endif
asm_fuseahuref(as, ir->op1, gpr);
if (ir->o == IR_VLOAD) as->mrm.ofs += 8 * ir->op2;
}
/* Always do the type check, even if the load result is unused. */
as->mrm.ofs += 4;