mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-10 10:56:27 +00:00
Label A32 specific code appropriately
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@
|
||||
#include "backend_x64/reg_alloc.h"
|
||||
#include "common/address_range.h"
|
||||
#include "dynarmic/callbacks.h"
|
||||
#include "frontend/ir/location_descriptor.h"
|
||||
#include "frontend/A32/location_descriptor.h"
|
||||
#include "frontend/ir/terminal.h"
|
||||
|
||||
namespace Dynarmic {
|
||||
@@ -34,17 +34,17 @@ namespace BackendX64 {
|
||||
|
||||
class BlockOfCode;
|
||||
|
||||
class EmitX64 final {
|
||||
class A32EmitX64 final {
|
||||
public:
|
||||
struct BlockDescriptor {
|
||||
CodePtr entrypoint; // Entrypoint of emitted code
|
||||
size_t size; // Length in bytes of emitted code
|
||||
|
||||
IR::LocationDescriptor start_location;
|
||||
u32 end_location_pc;
|
||||
A32::LocationDescriptor start_location;
|
||||
boost::icl::discrete_interval<u32> range;
|
||||
};
|
||||
|
||||
EmitX64(BlockOfCode* code, UserCallbacks cb, Jit* jit_interface);
|
||||
A32EmitX64(BlockOfCode* code, UserCallbacks cb, Jit* jit_interface);
|
||||
|
||||
/**
|
||||
* Emit host machine code for a basic block with intermediate representation `ir`.
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
BlockDescriptor Emit(IR::Block& ir);
|
||||
|
||||
/// Looks up an emitted host block in the cache.
|
||||
boost::optional<BlockDescriptor> GetBasicBlock(IR::LocationDescriptor descriptor) const;
|
||||
boost::optional<BlockDescriptor> GetBasicBlock(A32::LocationDescriptor descriptor) const;
|
||||
|
||||
/// Empties the entire cache.
|
||||
void ClearCache();
|
||||
@@ -76,14 +76,14 @@ private:
|
||||
void PushRSBHelper(Xbyak::Reg64 loc_desc_reg, Xbyak::Reg64 index_reg, u64 target_hash);
|
||||
|
||||
// Terminal instruction emitters
|
||||
void EmitTerminal(IR::Terminal terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::Interpret terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::ReturnToDispatch terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::LinkBlock terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::LinkBlockFast terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::PopRSBHint terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::If terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::CheckHalt terminal, IR::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Terminal terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::Interpret terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::ReturnToDispatch terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::LinkBlock terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::LinkBlockFast terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::PopRSBHint terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::If terminal, A32::LocationDescriptor initial_location);
|
||||
void EmitTerminal(IR::Term::CheckHalt terminal, A32::LocationDescriptor initial_location);
|
||||
|
||||
// Patching
|
||||
struct PatchInformation {
|
||||
@@ -91,16 +91,16 @@ private:
|
||||
std::vector<CodePtr> jmp;
|
||||
std::vector<CodePtr> mov_rcx;
|
||||
};
|
||||
void Patch(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr);
|
||||
void Unpatch(const IR::LocationDescriptor& target_desc);
|
||||
void EmitPatchJg(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
||||
void EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
||||
void Patch(const A32::LocationDescriptor& target_desc, CodePtr target_code_ptr);
|
||||
void Unpatch(const A32::LocationDescriptor& target_desc);
|
||||
void EmitPatchJg(const A32::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
||||
void EmitPatchJmp(const A32::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
||||
void EmitPatchMovRcx(CodePtr target_code_ptr = nullptr);
|
||||
|
||||
// State
|
||||
BlockOfCode* code;
|
||||
UserCallbacks cb;
|
||||
boost::icl::interval_map<u32, std::set<IR::LocationDescriptor>> block_ranges;
|
||||
boost::icl::interval_map<u32, std::set<A32::LocationDescriptor>> block_ranges;
|
||||
Jit* jit_interface;
|
||||
std::unordered_map<u64, BlockDescriptor> block_descriptors;
|
||||
std::unordered_map<u64, PatchInformation> patch_information;
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include "common/scope_exit.h"
|
||||
#include "dynarmic/context.h"
|
||||
#include "dynarmic/dynarmic.h"
|
||||
#include "frontend/A32/translate/translate.h"
|
||||
#include "frontend/ir/basic_block.h"
|
||||
#include "frontend/ir/location_descriptor.h"
|
||||
#include "frontend/translate/translate.h"
|
||||
#include "ir_opt/passes.h"
|
||||
|
||||
namespace Dynarmic {
|
||||
@@ -42,7 +42,7 @@ struct Jit::Impl {
|
||||
|
||||
BlockOfCode block_of_code;
|
||||
JitState jit_state;
|
||||
EmitX64 emitter;
|
||||
A32EmitX64 emitter;
|
||||
const UserCallbacks callbacks;
|
||||
|
||||
// Requests made during execution to invalidate the cache are queued up here.
|
||||
@@ -131,14 +131,14 @@ private:
|
||||
JitState& jit_state = this_.jit_state;
|
||||
|
||||
u32 pc = jit_state.Reg[15];
|
||||
Arm::PSR cpsr{jit_state.Cpsr()};
|
||||
Arm::FPSCR fpscr{jit_state.FPSCR_mode};
|
||||
IR::LocationDescriptor descriptor{pc, cpsr, fpscr};
|
||||
A32::PSR cpsr{jit_state.Cpsr()};
|
||||
A32::FPSCR fpscr{jit_state.FPSCR_mode};
|
||||
A32::LocationDescriptor descriptor{pc, cpsr, fpscr};
|
||||
|
||||
return this_.GetBasicBlock(descriptor).entrypoint;
|
||||
}
|
||||
|
||||
EmitX64::BlockDescriptor GetBasicBlock(IR::LocationDescriptor descriptor) {
|
||||
A32EmitX64::BlockDescriptor GetBasicBlock(IR::LocationDescriptor descriptor) {
|
||||
auto block = emitter.GetBasicBlock(descriptor);
|
||||
if (block)
|
||||
return *block;
|
||||
@@ -149,7 +149,7 @@ private:
|
||||
PerformCacheInvalidation();
|
||||
}
|
||||
|
||||
IR::Block ir_block = Arm::Translate(descriptor, callbacks.memory.ReadCode);
|
||||
IR::Block ir_block = A32::Translate(descriptor, callbacks.memory.ReadCode);
|
||||
Optimization::GetSetElimination(ir_block);
|
||||
Optimization::DeadCodeElimination(ir_block);
|
||||
Optimization::ConstantPropagation(ir_block, callbacks.memory);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_util.h"
|
||||
#include "common/common_types.h"
|
||||
#include "frontend/ir/location_descriptor.h"
|
||||
#include "frontend/A32/location_descriptor.h"
|
||||
|
||||
namespace Dynarmic {
|
||||
namespace BackendX64 {
|
||||
@@ -150,7 +150,7 @@ void JitState::ResetRSB() {
|
||||
*/
|
||||
|
||||
// NZCV; QC (ASMID only), AHP; DN, FZ, RMode, Stride; SBZP; Len; trap enables; cumulative bits
|
||||
constexpr u32 FPSCR_MODE_MASK = IR::LocationDescriptor::FPSCR_MODE_MASK;
|
||||
constexpr u32 FPSCR_MODE_MASK = A32::LocationDescriptor::FPSCR_MODE_MASK;
|
||||
constexpr u32 FPSCR_NZCV_MASK = 0xF0000000;
|
||||
|
||||
u32 JitState::Fpscr() const {
|
||||
|
||||
Reference in New Issue
Block a user