mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-04 21:55:06 +01:00
A32: Change UserCallbacks to be similar to A64's interface
This commit is contained in:
parent
b9ce660113
commit
98ec9c5f90
21 changed files with 472 additions and 622 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* General Public License version 2 or any later version.
|
||||
*/
|
||||
|
||||
#include <dynarmic/A32/callbacks.h>
|
||||
#include <dynarmic/A32/config.h>
|
||||
|
||||
#include "frontend/ir/basic_block.h"
|
||||
#include "frontend/ir/opcodes.h"
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Dynarmic::Optimization {
|
||||
|
||||
void A32ConstantMemoryReads(IR::Block& block, const A32::UserCallbacks::Memory& memory_callbacks) {
|
||||
void A32ConstantMemoryReads(IR::Block& block, A32::UserCallbacks* cb) {
|
||||
for (auto& inst : block) {
|
||||
switch (inst.GetOpcode()) {
|
||||
case IR::Opcode::A32SetCFlag: {
|
||||
|
|
@ -27,8 +27,8 @@ void A32ConstantMemoryReads(IR::Block& block, const A32::UserCallbacks::Memory&
|
|||
break;
|
||||
|
||||
u32 vaddr = inst.GetArg(0).GetU32();
|
||||
if (memory_callbacks.IsReadOnlyMemory(vaddr)) {
|
||||
u8 value_from_memory = memory_callbacks.Read8(vaddr);
|
||||
if (cb->IsReadOnlyMemory(vaddr)) {
|
||||
u8 value_from_memory = cb->MemoryRead8(vaddr);
|
||||
inst.ReplaceUsesWith(IR::Value{value_from_memory});
|
||||
}
|
||||
break;
|
||||
|
|
@ -38,8 +38,8 @@ void A32ConstantMemoryReads(IR::Block& block, const A32::UserCallbacks::Memory&
|
|||
break;
|
||||
|
||||
u32 vaddr = inst.GetArg(0).GetU32();
|
||||
if (memory_callbacks.IsReadOnlyMemory(vaddr)) {
|
||||
u16 value_from_memory = memory_callbacks.Read16(vaddr);
|
||||
if (cb->IsReadOnlyMemory(vaddr)) {
|
||||
u16 value_from_memory = cb->MemoryRead16(vaddr);
|
||||
inst.ReplaceUsesWith(IR::Value{value_from_memory});
|
||||
}
|
||||
break;
|
||||
|
|
@ -49,8 +49,8 @@ void A32ConstantMemoryReads(IR::Block& block, const A32::UserCallbacks::Memory&
|
|||
break;
|
||||
|
||||
u32 vaddr = inst.GetArg(0).GetU32();
|
||||
if (memory_callbacks.IsReadOnlyMemory(vaddr)) {
|
||||
u32 value_from_memory = memory_callbacks.Read32(vaddr);
|
||||
if (cb->IsReadOnlyMemory(vaddr)) {
|
||||
u32 value_from_memory = cb->MemoryRead32(vaddr);
|
||||
inst.ReplaceUsesWith(IR::Value{value_from_memory});
|
||||
}
|
||||
break;
|
||||
|
|
@ -60,8 +60,8 @@ void A32ConstantMemoryReads(IR::Block& block, const A32::UserCallbacks::Memory&
|
|||
break;
|
||||
|
||||
u32 vaddr = inst.GetArg(0).GetU32();
|
||||
if (memory_callbacks.IsReadOnlyMemory(vaddr)) {
|
||||
u64 value_from_memory = memory_callbacks.Read64(vaddr);
|
||||
if (cb->IsReadOnlyMemory(vaddr)) {
|
||||
u64 value_from_memory = cb->MemoryRead64(vaddr);
|
||||
inst.ReplaceUsesWith(IR::Value{value_from_memory});
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue