Make IR->A32 LocationDescriptor conversion explicit

This commit is contained in:
MerryMage 2018-01-05 19:12:13 +00:00
parent 9d15e0a8e1
commit 83022322d1
3 changed files with 6 additions and 5 deletions

View file

@ -119,11 +119,11 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
EmitX64::EmitTerminal(block.GetTerminal(), block.Location());
code->int3();
const A32::LocationDescriptor descriptor = block.Location();
const A32::LocationDescriptor descriptor{block.Location()};
Patch(descriptor, entrypoint);
const size_t size = static_cast<size_t>(code->getCurr() - entrypoint);
const A32::LocationDescriptor end_location = block.EndLocation();
const A32::LocationDescriptor end_location{block.EndLocation()};
const auto range = boost::icl::discrete_interval<u32>::closed(descriptor.PC(), end_location.PC() - 1);
A32EmitX64::BlockDescriptor block_desc{entrypoint, size, block.Location(), range};
block_descriptors.emplace(descriptor.UniqueHash(), block_desc);
@ -1087,7 +1087,8 @@ void A32EmitX64::EmitTerminalImpl(IR::Term::ReturnToDispatch, IR::LocationDescri
code->ReturnFromRunCode();
}
static u32 CalculateCpsr_et(const A32::LocationDescriptor& desc) {
static u32 CalculateCpsr_et(const IR::LocationDescriptor& arg) {
const A32::LocationDescriptor desc{arg};
u32 et = 0;
et |= desc.EFlag() ? 2 : 0;
et |= desc.TFlag() ? 1 : 0;

View file

@ -159,7 +159,7 @@ private:
PerformCacheInvalidation();
}
IR::Block ir_block = A32::Translate(descriptor, callbacks.memory.ReadCode);
IR::Block ir_block = A32::Translate(A32::LocationDescriptor{descriptor}, callbacks.memory.ReadCode);
Optimization::GetSetElimination(ir_block);
Optimization::DeadCodeElimination(ir_block);
Optimization::ConstantPropagation(ir_block, callbacks.memory);

View file

@ -32,7 +32,7 @@ public:
LocationDescriptor(u32 arm_pc, PSR cpsr, FPSCR fpscr)
: arm_pc(arm_pc), cpsr(cpsr.Value() & CPSR_MODE_MASK), fpscr(fpscr.Value() & FPSCR_MODE_MASK) {}
/*implict*/ LocationDescriptor(const IR::LocationDescriptor& o) {
explicit LocationDescriptor(const IR::LocationDescriptor& o) {
arm_pc = o.Value() >> 32;
cpsr.T(o.Value() & 1);
cpsr.E(o.Value() & 2);