JIT: Make compilation functions a part of the JIT classes
This commit is contained in:
parent
96e83b5d54
commit
5da7d700ca
|
@ -874,7 +874,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
|
|||
fpr.BindToRegister(reg, true, false);
|
||||
}
|
||||
|
||||
Jit64Tables::CompileInstruction(*this, ops[i]);
|
||||
CompileInstruction(ops[i]);
|
||||
|
||||
if (jo.memcheck && (opinfo->flags & FL_LOADSTORE))
|
||||
{
|
||||
|
|
|
@ -31,22 +31,6 @@
|
|||
|
||||
class Jit64 : public Jitx86Base
|
||||
{
|
||||
private:
|
||||
void AllocStack();
|
||||
void FreeStack();
|
||||
|
||||
GPRRegCache gpr{*this};
|
||||
FPURegCache fpr{*this};
|
||||
|
||||
// The default code buffer. We keep it around to not have to alloc/dealloc a
|
||||
// large chunk of memory for each recompiled block.
|
||||
PPCAnalyst::CodeBuffer code_buffer;
|
||||
Jit64AsmRoutineManager asm_routines;
|
||||
|
||||
bool m_enable_blr_optimization;
|
||||
bool m_cleanup_after_stackfault;
|
||||
u8* m_stack;
|
||||
|
||||
public:
|
||||
Jit64() : code_buffer(32000) {}
|
||||
~Jit64() {}
|
||||
|
@ -248,4 +232,22 @@ public:
|
|||
void dcbx(UGeckoInstruction inst);
|
||||
|
||||
void eieio(UGeckoInstruction inst);
|
||||
|
||||
private:
|
||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||
|
||||
void AllocStack();
|
||||
void FreeStack();
|
||||
|
||||
GPRRegCache gpr{*this};
|
||||
FPURegCache fpr{*this};
|
||||
|
||||
// The default code buffer. We keep it around to not have to alloc/dealloc a
|
||||
// large chunk of memory for each recompiled block.
|
||||
PPCAnalyst::CodeBuffer code_buffer;
|
||||
Jit64AsmRoutineManager asm_routines;
|
||||
|
||||
bool m_enable_blr_optimization;
|
||||
bool m_cleanup_after_stackfault;
|
||||
u8* m_stack;
|
||||
};
|
||||
|
|
|
@ -358,25 +358,26 @@ static GekkoOPTemplate table63_2[] = {
|
|||
{31, &Jit64::fmaddXX}, // fnmaddx
|
||||
};
|
||||
|
||||
namespace Jit64Tables
|
||||
void Jit64::CompileInstruction(PPCAnalyst::CodeOp& op)
|
||||
{
|
||||
void CompileInstruction(Jit64& jit, PPCAnalyst::CodeOp& op)
|
||||
{
|
||||
(jit.*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
(this->*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
|
||||
GekkoOPInfo* info = op.opinfo;
|
||||
if (info)
|
||||
{
|
||||
#ifdef OPLOG
|
||||
if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs"
|
||||
{
|
||||
rsplocations.push_back(jit.js.compilerPC);
|
||||
rsplocations.push_back(js.compilerPC);
|
||||
}
|
||||
#endif
|
||||
info->compileCount++;
|
||||
info->lastUse = jit.js.compilerPC;
|
||||
info->lastUse = js.compilerPC;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Jit64Tables
|
||||
{
|
||||
void InitTables()
|
||||
{
|
||||
// once initialized, tables are read-only
|
||||
|
|
|
@ -13,6 +13,5 @@ struct CodeOp;
|
|||
|
||||
namespace Jit64Tables
|
||||
{
|
||||
void CompileInstruction(Jit64& jit, PPCAnalyst::CodeOp& op);
|
||||
void InitTables();
|
||||
}
|
||||
|
|
|
@ -640,7 +640,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
|
|||
ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address));
|
||||
}
|
||||
|
||||
JitILTables::CompileInstruction(*this, ops[i]);
|
||||
CompileInstruction(ops[i]);
|
||||
|
||||
if (jo.memcheck && (opinfo->flags & FL_LOADSTORE))
|
||||
{
|
||||
|
|
|
@ -77,4 +77,7 @@ public:
|
|||
void DynaRunTable31(UGeckoInstruction _inst) override;
|
||||
void DynaRunTable59(UGeckoInstruction _inst) override;
|
||||
void DynaRunTable63(UGeckoInstruction _inst) override;
|
||||
|
||||
private:
|
||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||
};
|
||||
|
|
|
@ -376,30 +376,31 @@ static GekkoOPTemplate table63_2[] = {
|
|||
{31, &JitIL::fmaddXX}, //"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}},
|
||||
};
|
||||
|
||||
namespace JitILTables
|
||||
void JitIL::CompileInstruction(PPCAnalyst::CodeOp& op)
|
||||
{
|
||||
void CompileInstruction(JitIL& jit, PPCAnalyst::CodeOp& op)
|
||||
{
|
||||
(jit.*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
(this->*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
|
||||
GekkoOPInfo* info = op.opinfo;
|
||||
if (info)
|
||||
{
|
||||
#ifdef OPLOG
|
||||
if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs"
|
||||
{
|
||||
rsplocations.push_back(jit.js.compilerPC);
|
||||
rsplocations.push_back(js.compilerPC);
|
||||
}
|
||||
#endif
|
||||
info->compileCount++;
|
||||
info->lastUse = jit.js.compilerPC;
|
||||
info->lastUse = js.compilerPC;
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", op.inst.hex,
|
||||
jit.js.compilerPC);
|
||||
js.compilerPC);
|
||||
}
|
||||
}
|
||||
|
||||
namespace JitILTables
|
||||
{
|
||||
void InitTables()
|
||||
{
|
||||
// once initialized, tables are read-only
|
||||
|
|
|
@ -13,6 +13,5 @@ struct CodeOp;
|
|||
|
||||
namespace JitILTables
|
||||
{
|
||||
void CompileInstruction(JitIL& jit, PPCAnalyst::CodeOp& op);
|
||||
void InitTables();
|
||||
}
|
||||
|
|
|
@ -846,7 +846,7 @@ void JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock*
|
|||
js.firstFPInstructionFound = true;
|
||||
}
|
||||
|
||||
JitArm64Tables::CompileInstruction(*this, ops[i]);
|
||||
CompileInstruction(ops[i]);
|
||||
if (!MergeAllowedNextInstructions(1) || js.op[1].opinfo->type != OPTYPE_INTEGER)
|
||||
FlushCarry();
|
||||
|
||||
|
|
|
@ -172,29 +172,7 @@ private:
|
|||
const u8* slowmem_code;
|
||||
};
|
||||
|
||||
// <Fastmem fault location, slowmem handler location>
|
||||
std::map<const u8*, FastmemArea> m_fault_to_handler;
|
||||
std::map<SlowmemHandler, const u8*> m_handler_to_loc;
|
||||
Arm64GPRCache gpr;
|
||||
Arm64FPRCache fpr;
|
||||
|
||||
JitArm64BlockCache blocks{*this};
|
||||
|
||||
PPCAnalyst::CodeBuffer code_buffer;
|
||||
|
||||
ARM64FloatEmitter m_float_emit;
|
||||
|
||||
Arm64Gen::ARM64CodeBlock farcode;
|
||||
u8* nearcode; // Backed up when we switch to far code.
|
||||
|
||||
// Do we support cycle counter profiling?
|
||||
bool m_supports_cycle_counter;
|
||||
|
||||
bool m_enable_blr_optimization;
|
||||
bool m_cleanup_after_stackfault = false;
|
||||
u8* m_stack_base = nullptr;
|
||||
u8* m_stack_pointer = nullptr;
|
||||
u8* m_saved_stack_pointer = nullptr;
|
||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||
|
||||
void EmitResetCycleCounters();
|
||||
void EmitGetCycles(Arm64Gen::ARM64Reg reg);
|
||||
|
@ -260,4 +238,28 @@ private:
|
|||
|
||||
void reg_imm(u32 d, u32 a, u32 value, u32 (*do_op)(u32, u32),
|
||||
void (ARM64XEmitter::*op)(ARM64Reg, ARM64Reg, u64, ARM64Reg), bool Rc = false);
|
||||
|
||||
// <Fastmem fault location, slowmem handler location>
|
||||
std::map<const u8*, FastmemArea> m_fault_to_handler;
|
||||
std::map<SlowmemHandler, const u8*> m_handler_to_loc;
|
||||
Arm64GPRCache gpr;
|
||||
Arm64FPRCache fpr;
|
||||
|
||||
JitArm64BlockCache blocks{*this};
|
||||
|
||||
PPCAnalyst::CodeBuffer code_buffer;
|
||||
|
||||
ARM64FloatEmitter m_float_emit;
|
||||
|
||||
Arm64Gen::ARM64CodeBlock farcode;
|
||||
u8* nearcode; // Backed up when we switch to far code.
|
||||
|
||||
// Do we support cycle counter profiling?
|
||||
bool m_supports_cycle_counter;
|
||||
|
||||
bool m_enable_blr_optimization;
|
||||
bool m_cleanup_after_stackfault = false;
|
||||
u8* m_stack_base = nullptr;
|
||||
u8* m_stack_pointer = nullptr;
|
||||
u8* m_saved_stack_pointer = nullptr;
|
||||
};
|
||||
|
|
|
@ -367,25 +367,26 @@ static GekkoOPTemplate table63_2[] = {
|
|||
{31, &JitArm64::fp_arith}, // fnmaddx
|
||||
};
|
||||
|
||||
namespace JitArm64Tables
|
||||
void JitArm64::CompileInstruction(PPCAnalyst::CodeOp& op)
|
||||
{
|
||||
void CompileInstruction(JitArm64& jit, PPCAnalyst::CodeOp& op)
|
||||
{
|
||||
(jit.*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
(this->*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
|
||||
GekkoOPInfo* info = op.opinfo;
|
||||
if (info)
|
||||
{
|
||||
#ifdef OPLOG
|
||||
if (!strcmp(info->opname, OP_TO_LOG))
|
||||
{ ///"mcrfs"
|
||||
rsplocations.push_back(jit.js.compilerPC);
|
||||
rsplocations.push_back(js.compilerPC);
|
||||
}
|
||||
#endif
|
||||
info->compileCount++;
|
||||
info->lastUse = jit.js.compilerPC;
|
||||
info->lastUse = js.compilerPC;
|
||||
}
|
||||
}
|
||||
|
||||
namespace JitArm64Tables
|
||||
{
|
||||
void InitTables()
|
||||
{
|
||||
// once initialized, tables are read-only
|
||||
|
|
|
@ -13,6 +13,5 @@ struct CodeOp;
|
|||
|
||||
namespace JitArm64Tables
|
||||
{
|
||||
void CompileInstruction(JitArm64& jit, PPCAnalyst::CodeOp& op);
|
||||
void InitTables();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue