Make IR->A32 LocationDescriptor conversion explicit
This commit is contained in:
parent
9d15e0a8e1
commit
83022322d1
3 changed files with 6 additions and 5 deletions
|
@ -119,11 +119,11 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
|
||||||
EmitX64::EmitTerminal(block.GetTerminal(), block.Location());
|
EmitX64::EmitTerminal(block.GetTerminal(), block.Location());
|
||||||
code->int3();
|
code->int3();
|
||||||
|
|
||||||
const A32::LocationDescriptor descriptor = block.Location();
|
const A32::LocationDescriptor descriptor{block.Location()};
|
||||||
Patch(descriptor, entrypoint);
|
Patch(descriptor, entrypoint);
|
||||||
|
|
||||||
const size_t size = static_cast<size_t>(code->getCurr() - 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);
|
const auto range = boost::icl::discrete_interval<u32>::closed(descriptor.PC(), end_location.PC() - 1);
|
||||||
A32EmitX64::BlockDescriptor block_desc{entrypoint, size, block.Location(), range};
|
A32EmitX64::BlockDescriptor block_desc{entrypoint, size, block.Location(), range};
|
||||||
block_descriptors.emplace(descriptor.UniqueHash(), block_desc);
|
block_descriptors.emplace(descriptor.UniqueHash(), block_desc);
|
||||||
|
@ -1087,7 +1087,8 @@ void A32EmitX64::EmitTerminalImpl(IR::Term::ReturnToDispatch, IR::LocationDescri
|
||||||
code->ReturnFromRunCode();
|
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;
|
u32 et = 0;
|
||||||
et |= desc.EFlag() ? 2 : 0;
|
et |= desc.EFlag() ? 2 : 0;
|
||||||
et |= desc.TFlag() ? 1 : 0;
|
et |= desc.TFlag() ? 1 : 0;
|
||||||
|
|
|
@ -159,7 +159,7 @@ private:
|
||||||
PerformCacheInvalidation();
|
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::GetSetElimination(ir_block);
|
||||||
Optimization::DeadCodeElimination(ir_block);
|
Optimization::DeadCodeElimination(ir_block);
|
||||||
Optimization::ConstantPropagation(ir_block, callbacks.memory);
|
Optimization::ConstantPropagation(ir_block, callbacks.memory);
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
LocationDescriptor(u32 arm_pc, PSR cpsr, FPSCR fpscr)
|
LocationDescriptor(u32 arm_pc, PSR cpsr, FPSCR fpscr)
|
||||||
: arm_pc(arm_pc), cpsr(cpsr.Value() & CPSR_MODE_MASK), fpscr(fpscr.Value() & FPSCR_MODE_MASK) {}
|
: 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;
|
arm_pc = o.Value() >> 32;
|
||||||
cpsr.T(o.Value() & 1);
|
cpsr.T(o.Value() & 1);
|
||||||
cpsr.E(o.Value() & 2);
|
cpsr.E(o.Value() & 2);
|
||||||
|
|
Loading…
Reference in a new issue