mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-02 04:34:43 +01:00
callbacks: Factorize memory callbacks into inner structure
This commit is contained in:
parent
642ccb0f66
commit
2447f2f360
9 changed files with 74 additions and 72 deletions
|
|
@ -124,56 +124,56 @@ void BlockOfCode::GenMemoryAccessors() {
|
|||
align();
|
||||
read_memory_8 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryRead8);
|
||||
CallFunction(cb.memory.Read8);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
read_memory_16 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryRead16);
|
||||
CallFunction(cb.memory.Read16);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
read_memory_32 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryRead32);
|
||||
CallFunction(cb.memory.Read32);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
read_memory_64 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryRead64);
|
||||
CallFunction(cb.memory.Read64);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
write_memory_8 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryWrite8);
|
||||
CallFunction(cb.memory.Write8);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
write_memory_16 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryWrite16);
|
||||
CallFunction(cb.memory.Write16);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
write_memory_32 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryWrite32);
|
||||
CallFunction(cb.memory.Write32);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
|
||||
align();
|
||||
write_memory_64 = getCurr<const void*>();
|
||||
ABI_PushCallerSaveRegistersAndAdjustStack(this);
|
||||
CallFunction(cb.MemoryWrite64);
|
||||
CallFunction(cb.memory.Write64);
|
||||
ABI_PopCallerSaveRegistersAndAdjustStack(this);
|
||||
ret();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2866,35 +2866,35 @@ static void WriteMemory(BlockOfCode* code, RegAlloc& reg_alloc, IR::Inst* inst,
|
|||
}
|
||||
|
||||
void EmitX64::EmitReadMemory8(IR::Block&, IR::Inst* inst) {
|
||||
ReadMemory(code, reg_alloc, inst, cb, 8, cb.MemoryRead8);
|
||||
ReadMemory(code, reg_alloc, inst, cb, 8, cb.memory.Read8);
|
||||
}
|
||||
|
||||
void EmitX64::EmitReadMemory16(IR::Block&, IR::Inst* inst) {
|
||||
ReadMemory(code, reg_alloc, inst, cb, 16, cb.MemoryRead16);
|
||||
ReadMemory(code, reg_alloc, inst, cb, 16, cb.memory.Read16);
|
||||
}
|
||||
|
||||
void EmitX64::EmitReadMemory32(IR::Block&, IR::Inst* inst) {
|
||||
ReadMemory(code, reg_alloc, inst, cb, 32, cb.MemoryRead32);
|
||||
ReadMemory(code, reg_alloc, inst, cb, 32, cb.memory.Read32);
|
||||
}
|
||||
|
||||
void EmitX64::EmitReadMemory64(IR::Block&, IR::Inst* inst) {
|
||||
ReadMemory(code, reg_alloc, inst, cb, 64, cb.MemoryRead64);
|
||||
ReadMemory(code, reg_alloc, inst, cb, 64, cb.memory.Read64);
|
||||
}
|
||||
|
||||
void EmitX64::EmitWriteMemory8(IR::Block&, IR::Inst* inst) {
|
||||
WriteMemory(code, reg_alloc, inst, cb, 8, cb.MemoryWrite8);
|
||||
WriteMemory(code, reg_alloc, inst, cb, 8, cb.memory.Write8);
|
||||
}
|
||||
|
||||
void EmitX64::EmitWriteMemory16(IR::Block&, IR::Inst* inst) {
|
||||
WriteMemory(code, reg_alloc, inst, cb, 16, cb.MemoryWrite16);
|
||||
WriteMemory(code, reg_alloc, inst, cb, 16, cb.memory.Write16);
|
||||
}
|
||||
|
||||
void EmitX64::EmitWriteMemory32(IR::Block&, IR::Inst* inst) {
|
||||
WriteMemory(code, reg_alloc, inst, cb, 32, cb.MemoryWrite32);
|
||||
WriteMemory(code, reg_alloc, inst, cb, 32, cb.memory.Write32);
|
||||
}
|
||||
|
||||
void EmitX64::EmitWriteMemory64(IR::Block&, IR::Inst* inst) {
|
||||
WriteMemory(code, reg_alloc, inst, cb, 64, cb.MemoryWrite64);
|
||||
WriteMemory(code, reg_alloc, inst, cb, 64, cb.memory.Write64);
|
||||
}
|
||||
|
||||
template <typename FunctionPointer>
|
||||
|
|
@ -2920,15 +2920,15 @@ static void ExclusiveWrite(BlockOfCode* code, RegAlloc& reg_alloc, IR::Inst* ins
|
|||
}
|
||||
|
||||
void EmitX64::EmitExclusiveWriteMemory8(IR::Block&, IR::Inst* inst) {
|
||||
ExclusiveWrite(code, reg_alloc, inst, cb.MemoryWrite8);
|
||||
ExclusiveWrite(code, reg_alloc, inst, cb.memory.Write8);
|
||||
}
|
||||
|
||||
void EmitX64::EmitExclusiveWriteMemory16(IR::Block&, IR::Inst* inst) {
|
||||
ExclusiveWrite(code, reg_alloc, inst, cb.MemoryWrite16);
|
||||
ExclusiveWrite(code, reg_alloc, inst, cb.memory.Write16);
|
||||
}
|
||||
|
||||
void EmitX64::EmitExclusiveWriteMemory32(IR::Block&, IR::Inst* inst) {
|
||||
ExclusiveWrite(code, reg_alloc, inst, cb.MemoryWrite32);
|
||||
ExclusiveWrite(code, reg_alloc, inst, cb.memory.Write32);
|
||||
}
|
||||
|
||||
void EmitX64::EmitExclusiveWriteMemory64(IR::Block&, IR::Inst* inst) {
|
||||
|
|
@ -2952,7 +2952,7 @@ void EmitX64::EmitExclusiveWriteMemory64(IR::Block&, IR::Inst* inst) {
|
|||
code->mov(value.cvt32(), value.cvt32()); // zero extend to 64-bits
|
||||
code->shl(value_hi, 32);
|
||||
code->or_(value, value_hi);
|
||||
code->CallFunction(cb.MemoryWrite64);
|
||||
code->CallFunction(cb.memory.Write64);
|
||||
code->xor_(passed, passed);
|
||||
code->L(end);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ private:
|
|||
if (block)
|
||||
return *block;
|
||||
|
||||
IR::Block ir_block = Arm::Translate(descriptor, callbacks.MemoryReadCode);
|
||||
IR::Block ir_block = Arm::Translate(descriptor, callbacks.memory.ReadCode);
|
||||
Optimization::GetSetElimination(ir_block);
|
||||
Optimization::DeadCodeElimination(ir_block);
|
||||
Optimization::VerificationPass(ir_block);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue