emitCurIGsize += sz;
}
-void emitter::emitIns_R_AR(instruction ins, emitAttr attr, regNumber ireg, regNumber base, int disp)
+void emitter::emitIns_R_AR(instruction ins, emitAttr attr, regNumber reg, regNumber base, int disp)
{
- assert((CodeGen::instIsFP(ins) == false) && (EA_SIZE(attr) <= EA_32BYTE) && (ireg != REG_NA));
- noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), ireg));
-
- if (ins == INS_lea)
- {
- if (ireg == base && disp == 0)
- {
- // Maybe the emitter is not the common place for this optimization, but it's a better choke point
- // for all the emitIns(ins, tree), we would have to be analyzing at each call site
- //
- return;
- }
- }
-
- UNATIVE_OFFSET sz;
- instrDesc* id = emitNewInstrAmd(attr, disp);
- insFormat fmt = emitInsModeFormat(ins, IF_RRD_ARD);
-
- id->idIns(ins);
- id->idInsFmt(fmt);
- id->idReg1(ireg);
-
- id->idAddr()->iiaAddrMode.amBaseReg = base;
- id->idAddr()->iiaAddrMode.amIndxReg = REG_NA;
-
- assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
-
- sz = emitInsSizeAM(id, insCodeRM(ins));
- id->idCodeSize(sz);
-
- dispIns(id);
- emitCurIGsize += sz;
+ emitIns_R_ARX(ins, attr, reg, base, REG_NA, 1, disp);
}
void emitter::emitIns_R_AI(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp)
emitCurIGsize += sz;
}
-void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber ireg, regNumber base, int disp)
+void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, int disp)
{
- UNATIVE_OFFSET sz;
- instrDesc* id = emitNewInstrAmd(attr, disp);
- insFormat fmt;
-
- if (ireg == REG_NA)
- {
- fmt = emitInsModeFormat(ins, IF_ARD);
- }
- else
- {
- fmt = emitInsModeFormat(ins, IF_ARD_RRD);
-
- assert((CodeGen::instIsFP(ins) == false) && (EA_SIZE(attr) <= EA_32BYTE));
- noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), ireg));
-
- id->idReg1(ireg);
- }
-
- id->idIns(ins);
- id->idInsFmt(fmt);
-
- id->idAddr()->iiaAddrMode.amBaseReg = base;
- id->idAddr()->iiaAddrMode.amIndxReg = REG_NA;
-
- assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
-
- sz = emitInsSizeAM(id, insCodeMR(ins));
- id->idCodeSize(sz);
-
- dispIns(id);
- emitCurIGsize += sz;
-
- emitAdjustStackDepthPushPop(ins);
+ emitIns_ARX_R(ins, attr, reg, base, REG_NA, 1, disp);
}
//------------------------------------------------------------------------
emitCurIGsize += sz;
}
-void emitter::emitIns_R_ARR(instruction ins, emitAttr attr, regNumber ireg, regNumber base, regNumber index, int disp)
+void emitter::emitIns_R_ARR(instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, int disp)
{
- assert((CodeGen::instIsFP(ins) == false) && (EA_SIZE(attr) <= EA_8BYTE) && (ireg != REG_NA));
- noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), ireg));
-
- UNATIVE_OFFSET sz;
- instrDesc* id = emitNewInstrAmd(attr, disp);
- insFormat fmt = emitInsModeFormat(ins, IF_RRD_ARD);
-
- id->idIns(ins);
- id->idInsFmt(fmt);
- id->idReg1(ireg);
-
- id->idAddr()->iiaAddrMode.amBaseReg = base;
- id->idAddr()->iiaAddrMode.amIndxReg = index;
- id->idAddr()->iiaAddrMode.amScale = emitter::OPSZ1;
-
- assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
-
- sz = emitInsSizeAM(id, insCodeRM(ins));
- id->idCodeSize(sz);
-
- dispIns(id);
- emitCurIGsize += sz;
+ emitIns_R_ARX(ins, attr, reg, base, index, 1, disp);
}
-void emitter::emitIns_ARR_R(instruction ins, emitAttr attr, regNumber ireg, regNumber reg, regNumber index, int disp)
+void emitter::emitIns_ARR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, int disp)
{
- UNATIVE_OFFSET sz;
- instrDesc* id = emitNewInstrAmd(attr, disp);
- insFormat fmt;
-
- if (ireg == REG_NA)
- {
- fmt = emitInsModeFormat(ins, IF_ARD);
- }
- else
- {
- fmt = emitInsModeFormat(ins, IF_ARD_RRD);
-
- assert((CodeGen::instIsFP(ins) == false) && (EA_SIZE(attr) <= EA_8BYTE));
- noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), ireg));
-
- id->idReg1(ireg);
- }
-
- id->idIns(ins);
- id->idInsFmt(fmt);
-
- id->idAddr()->iiaAddrMode.amBaseReg = reg;
- id->idAddr()->iiaAddrMode.amIndxReg = index;
- id->idAddr()->iiaAddrMode.amScale = emitEncodeScale(1);
-
- assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
-
- sz = emitInsSizeAM(id, insCodeMR(ins));
- id->idCodeSize(sz);
-
- dispIns(id);
- emitCurIGsize += sz;
-
- emitAdjustStackDepthPushPop(ins);
+ emitIns_ARX_R(ins, attr, reg, base, index, 1, disp);
}
void emitter::emitIns_I_ARX(
}
void emitter::emitIns_R_ARX(
- instruction ins, emitAttr attr, regNumber ireg, regNumber base, regNumber index, unsigned mul, int disp)
+ instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp)
{
- assert((CodeGen::instIsFP(ins) == false) && (EA_SIZE(attr) <= EA_8BYTE) && (ireg != REG_NA));
- noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), ireg));
+ assert(!CodeGen::instIsFP(ins) && (EA_SIZE(attr) <= EA_32BYTE) && (reg != REG_NA));
+ noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), reg));
+
+ if ((ins == INS_lea) && (reg == base) && (index == REG_NA) && (disp == 0))
+ {
+ // Maybe the emitter is not the common place for this optimization, but it's a better choke point
+ // for all the emitIns(ins, tree), we would have to be analyzing at each call site
+ //
+ return;
+ }
UNATIVE_OFFSET sz;
instrDesc* id = emitNewInstrAmd(attr, disp);
id->idIns(ins);
id->idInsFmt(fmt);
- id->idReg1(ireg);
+ id->idReg1(reg);
id->idAddr()->iiaAddrMode.amBaseReg = base;
id->idAddr()->iiaAddrMode.amIndxReg = index;
- id->idAddr()->iiaAddrMode.amScale = emitEncodeScale(mul);
+ id->idAddr()->iiaAddrMode.amScale = emitEncodeScale(scale);
assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
}
void emitter::emitIns_ARX_R(
- instruction ins, emitAttr attr, regNumber ireg, regNumber base, regNumber index, unsigned mul, int disp)
+ instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp)
{
UNATIVE_OFFSET sz;
instrDesc* id = emitNewInstrAmd(attr, disp);
insFormat fmt;
- if (ireg == REG_NA)
+ if (reg == REG_NA)
{
fmt = emitInsModeFormat(ins, IF_ARD);
}
{
fmt = emitInsModeFormat(ins, IF_ARD_RRD);
- noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), ireg));
- assert((CodeGen::instIsFP(ins) == false) && (EA_SIZE(attr) <= EA_8BYTE));
+ noway_assert(emitVerifyEncodable(ins, EA_SIZE(attr), reg));
+ assert(!CodeGen::instIsFP(ins) && (EA_SIZE(attr) <= EA_32BYTE));
- id->idReg1(ireg);
+ id->idReg1(reg);
}
id->idIns(ins);
id->idAddr()->iiaAddrMode.amBaseReg = base;
id->idAddr()->iiaAddrMode.amIndxReg = index;
- id->idAddr()->iiaAddrMode.amScale = emitEncodeScale(mul);
+ id->idAddr()->iiaAddrMode.amScale = emitEncodeScale(scale);
assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
void emitIns_I_AI(instruction ins, emitAttr attr, int val, ssize_t disp);
-void emitIns_R_AR(instruction ins, emitAttr attr, regNumber ireg, regNumber reg, int offs);
+void emitIns_R_AR(instruction ins, emitAttr attr, regNumber reg, regNumber base, int disp);
void emitIns_R_AI(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp);
-void emitIns_AR_R(instruction ins, emitAttr attr, regNumber ireg, regNumber reg, int offs);
+void emitIns_AR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, int disp);
void emitIns_AI_R(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp);
void emitIns_I_ARR(instruction ins, emitAttr attr, int val, regNumber reg, regNumber rg2, int disp);
-void emitIns_R_ARR(instruction ins, emitAttr attr, regNumber ireg, regNumber reg, regNumber rg2, int disp);
+void emitIns_R_ARR(instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, int disp);
-void emitIns_ARR_R(instruction ins, emitAttr attr, regNumber ireg, regNumber reg, regNumber rg2, int disp);
+void emitIns_ARR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, int disp);
void emitIns_I_ARX(instruction ins, emitAttr attr, int val, regNumber reg, regNumber rg2, unsigned mul, int disp);
void emitIns_R_ARX(
- instruction ins, emitAttr attr, regNumber ireg, regNumber reg, regNumber rg2, unsigned mul, int disp);
+ instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp);
void emitIns_ARX_R(
- instruction ins, emitAttr attr, regNumber ireg, regNumber reg, regNumber rg2, unsigned mul, int disp);
+ instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp);
void emitIns_I_AX(instruction ins, emitAttr attr, int val, regNumber reg, unsigned mul, int disp);