EmitX64: JitState type as template parameter

This commit is contained in:
MerryMage 2018-01-02 17:45:39 +00:00
parent 2d164d9345
commit 455757d7b6
4 changed files with 307 additions and 293 deletions

View file

@ -34,7 +34,7 @@ struct A32EmitContext final : public EmitContext {
bool FPSCR_DN() const override; bool FPSCR_DN() const override;
}; };
class A32EmitX64 final : public EmitX64<u32> { class A32EmitX64 final : public EmitX64<A32JitState> {
public: public:
A32EmitX64(BlockOfCode* code, UserCallbacks cb, Jit* jit_interface); A32EmitX64(BlockOfCode* code, UserCallbacks cb, Jit* jit_interface);
~A32EmitX64(); ~A32EmitX64();

View file

@ -23,6 +23,8 @@ constexpr size_t SpillCount = 64;
#endif #endif
struct A32JitState { struct A32JitState {
using ProgramCounterType = u32;
A32JitState() { ResetRSB(); } A32JitState() { ResetRSB(); }
std::array<u32, 16> Reg{}; // Current register file. std::array<u32, 16> Reg{}; // Current register file.

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@
#include "backend_x64/reg_alloc.h" #include "backend_x64/reg_alloc.h"
#include "common/address_range.h" #include "common/address_range.h"
#include "dynarmic/callbacks.h" #include "dynarmic/callbacks.h"
#include "frontend/A32/location_descriptor.h" #include "frontend/ir/location_descriptor.h"
#include "frontend/ir/terminal.h" #include "frontend/ir/terminal.h"
namespace Dynarmic { namespace Dynarmic {
@ -47,14 +47,16 @@ struct EmitContext {
IR::Block& block; IR::Block& block;
}; };
template <typename ProgramCounterType> template <typename JitStateType>
class EmitX64 { class EmitX64 {
public: public:
using ProgramCounterType = typename JitStateType::ProgramCounterType;
struct BlockDescriptor { struct BlockDescriptor {
CodePtr entrypoint; // Entrypoint of emitted code CodePtr entrypoint; // Entrypoint of emitted code
size_t size; // Length in bytes of emitted code size_t size; // Length in bytes of emitted code
A32::LocationDescriptor start_location; IR::LocationDescriptor start_location;
boost::icl::discrete_interval<ProgramCounterType> range; boost::icl::discrete_interval<ProgramCounterType> range;
}; };