本文整理汇总了C++中OpArg::IsSimpleReg方法的典型用法代码示例。如果您正苦于以下问题:C++ OpArg::IsSimpleReg方法的具体用法?C++ OpArg::IsSimpleReg怎么用?C++ OpArg::IsSimpleReg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpArg
的用法示例。
在下文中一共展示了OpArg::IsSimpleReg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoSlowWrite
void JitSafeMem::DoSlowWrite(const void *safeFunc, const OpArg& src, int suboffset)
{
if (iaddr_ != (u32) -1)
jit_->MOV(32, R(EAX), Imm32((iaddr_ + suboffset) & alignMask_));
else
{
jit_->LEA(32, EAX, MDisp(xaddr_, offset_ + suboffset));
if (alignMask_ != 0xFFFFFFFF)
jit_->AND(32, R(EAX), Imm32(alignMask_));
}
#ifdef _M_IX86
jit_->PUSH(EDX);
#endif
if (!src.IsSimpleReg(EDX)) {
jit_->MOV(32, R(EDX), src);
}
if (!g_Config.bIgnoreBadMemAccess) {
jit_->MOV(32, M(&jit_->mips_->pc), Imm32(jit_->GetCompilerPC()));
}
// This is a special jit-ABI'd function.
jit_->CALL(safeFunc);
#ifdef _M_IX86
jit_->POP(EDX);
#endif
needsCheck_ = true;
}
示例2: CheckIfSafeAddress
FixupBranch EmuCodeBlock::CheckIfSafeAddress(const OpArg& reg_value, X64Reg reg_addr,
BitSet32 registers_in_use)
{
registers_in_use[reg_addr] = true;
if (reg_value.IsSimpleReg())
registers_in_use[reg_value.GetSimpleReg()] = true;
// Get ourselves two free registers
if (registers_in_use[RSCRATCH])
PUSH(RSCRATCH);
if (registers_in_use[RSCRATCH_EXTRA])
PUSH(RSCRATCH_EXTRA);
if (reg_addr != RSCRATCH_EXTRA)
MOV(32, R(RSCRATCH_EXTRA), R(reg_addr));
// Perform lookup to see if we can use fast path.
MOV(64, R(RSCRATCH), ImmPtr(&PowerPC::dbat_table[0]));
SHR(32, R(RSCRATCH_EXTRA), Imm8(PowerPC::BAT_INDEX_SHIFT));
TEST(32, MComplex(RSCRATCH, RSCRATCH_EXTRA, SCALE_4, 0), Imm32(PowerPC::BAT_PHYSICAL_BIT));
if (registers_in_use[RSCRATCH_EXTRA])
POP(RSCRATCH_EXTRA);
if (registers_in_use[RSCRATCH])
POP(RSCRATCH);
return J_CC(CC_Z, m_far_code.Enabled());
}
示例3: UnsafeLoadToReg
bool EmuCodeBlock::UnsafeLoadToReg(X64Reg reg_value, OpArg opAddress, int accessSize, s32 offset,
bool signExtend, MovInfo* info)
{
bool offsetAddedToAddress = false;
OpArg memOperand;
if (opAddress.IsSimpleReg())
{
// Deal with potential wraparound. (This is just a heuristic, and it would
// be more correct to actually mirror the first page at the end, but the
// only case where it probably actually matters is JitIL turning adds into
// offsets with the wrong sign, so whatever. Since the original code
// *could* try to wrap an address around, however, this is the correct
// place to address the issue.)
if ((u32)offset >= 0x1000)
{
// This method can potentially clobber the address if it shares a register
// with the load target. In this case we can just subtract offset from the
// register (see Jit64Base for this implementation).
offsetAddedToAddress = (reg_value == opAddress.GetSimpleReg());
LEA(32, reg_value, MDisp(opAddress.GetSimpleReg(), offset));
opAddress = R(reg_value);
offset = 0;
}
memOperand = MComplex(RMEM, opAddress.GetSimpleReg(), SCALE_1, offset);
}
else if (opAddress.IsImm())
{
MOV(32, R(reg_value), Imm32((u32)(opAddress.Imm32() + offset)));
memOperand = MRegSum(RMEM, reg_value);
}
else
{
MOV(32, R(reg_value), opAddress);
memOperand = MComplex(RMEM, reg_value, SCALE_1, offset);
}
LoadAndSwap(accessSize, reg_value, memOperand, signExtend, info);
return offsetAddedToAddress;
}
示例4: putReg
void DSPJitRegCache::putReg(int reg, bool dirty)
{
int real_reg = reg;
if (regs[reg].parentReg != DSP_REG_NONE)
real_reg = regs[reg].parentReg;
OpArg oparg = regs[real_reg].loc;
switch (reg)
{
case DSP_REG_ACH0:
case DSP_REG_ACH1:
if (dirty)
{
// no need to extend to full 64bit here until interpreter
// uses that
if (oparg.IsSimpleReg())
{
// register is already shifted correctly
// (if at all)
// sign extend from the bottom 8 bits.
emitter.MOVSX(16, 8, oparg.GetSimpleReg(), oparg);
}
else if (oparg.IsImm())
{
// TODO: Immediates?
}
else
{
// this works on the memory, so use reg instead
// of real_reg, since it has the right loc
X64Reg tmp;
getFreeXReg(tmp);
// sign extend from the bottom 8 bits.
emitter.MOVSX(16, 8, tmp, regs[reg].loc);
emitter.MOV(16, regs[reg].loc, R(tmp));
putXReg(tmp);
}
}
break;
case DSP_REG_ACC0_64:
case DSP_REG_ACC1_64:
if (dirty)
{
emitter.SHL(64, oparg, Imm8(64-40)); // sign extend
emitter.SAR(64, oparg, Imm8(64-40));
}
break;
default:
break;
}
regs[real_reg].used = false;
if (regs[real_reg].loc.IsSimpleReg())
{
regs[real_reg].dirty |= dirty;
regs[real_reg].last_use_ctr = use_ctr;
use_ctr++;
}
}