CPU Backends: Make each CPU backend responsible for initializing its own
instruction tables Previously, all of the internals that handled how the instruction tables are initialized were exposed externally. However, this can all be made private to each CPU backend. If each backend has an Init() function, then this is where the instruction tables should be initialized, it shouldn't be the responsibility of external code to ensure internal validity. This allows for getting rid of all the table initialization shenanigans within JitInterface and PPCTables.
This commit is contained in:
parent
5da7d700ca
commit
1ce1304d0f
|
@ -459,13 +459,10 @@
|
||||||
<ClInclude Include="PowerPC\CachedInterpreter\InterpreterBlockCache.h" />
|
<ClInclude Include="PowerPC\CachedInterpreter\InterpreterBlockCache.h" />
|
||||||
<ClInclude Include="PowerPC\Interpreter\Interpreter.h" />
|
<ClInclude Include="PowerPC\Interpreter\Interpreter.h" />
|
||||||
<ClInclude Include="PowerPC\Interpreter\Interpreter_FPUtils.h" />
|
<ClInclude Include="PowerPC\Interpreter\Interpreter_FPUtils.h" />
|
||||||
<ClInclude Include="PowerPC\Interpreter\Interpreter_Tables.h" />
|
|
||||||
<ClInclude Include="PowerPC\Jit64IL\JitIL.h" />
|
<ClInclude Include="PowerPC\Jit64IL\JitIL.h" />
|
||||||
<ClInclude Include="PowerPC\Jit64IL\JitIL_Tables.h" />
|
|
||||||
<ClInclude Include="PowerPC\Jit64\FPURegCache.h" />
|
<ClInclude Include="PowerPC\Jit64\FPURegCache.h" />
|
||||||
<ClInclude Include="PowerPC\Jit64\GPRRegCache.h" />
|
<ClInclude Include="PowerPC\Jit64\GPRRegCache.h" />
|
||||||
<ClInclude Include="PowerPC\Jit64\Jit.h" />
|
<ClInclude Include="PowerPC\Jit64\Jit.h" />
|
||||||
<ClInclude Include="PowerPC\Jit64\Jit64_Tables.h" />
|
|
||||||
<ClInclude Include="PowerPC\Jit64\JitAsm.h" />
|
<ClInclude Include="PowerPC\Jit64\JitAsm.h" />
|
||||||
<ClInclude Include="PowerPC\Jit64\JitRegCache.h" />
|
<ClInclude Include="PowerPC\Jit64\JitRegCache.h" />
|
||||||
<ClInclude Include="PowerPC\JitILCommon\IR.h" />
|
<ClInclude Include="PowerPC\JitILCommon\IR.h" />
|
||||||
|
|
|
@ -931,15 +931,9 @@
|
||||||
<ClInclude Include="PowerPC\Interpreter\Interpreter_FPUtils.h">
|
<ClInclude Include="PowerPC\Interpreter\Interpreter_FPUtils.h">
|
||||||
<Filter>PowerPC\Interpreter</Filter>
|
<Filter>PowerPC\Interpreter</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="PowerPC\Interpreter\Interpreter_Tables.h">
|
|
||||||
<Filter>PowerPC\Interpreter</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="PowerPC\Jit64\Jit.h">
|
<ClInclude Include="PowerPC\Jit64\Jit.h">
|
||||||
<Filter>PowerPC\Jit64</Filter>
|
<Filter>PowerPC\Jit64</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="PowerPC\Jit64\Jit64_Tables.h">
|
|
||||||
<Filter>PowerPC\Jit64</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="HW\AudioInterface.h">
|
<ClInclude Include="HW\AudioInterface.h">
|
||||||
<Filter>HW %28Flipper/Hollywood%29\AI - Audio Interface</Filter>
|
<Filter>HW %28Flipper/Hollywood%29\AI - Audio Interface</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1252,9 +1246,6 @@
|
||||||
<ClInclude Include="PowerPC\Jit64IL\JitIL.h">
|
<ClInclude Include="PowerPC\Jit64IL\JitIL.h">
|
||||||
<Filter>PowerPC\JitIL</Filter>
|
<Filter>PowerPC\JitIL</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="PowerPC\Jit64IL\JitIL_Tables.h">
|
|
||||||
<Filter>PowerPC\JitIL</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="PowerPC\Jit64\FPURegCache.h">
|
<ClInclude Include="PowerPC\Jit64\FPURegCache.h">
|
||||||
<Filter>PowerPC\Jit64</Filter>
|
<Filter>PowerPC\Jit64</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -63,6 +63,7 @@ void Interpreter::RunTable63(UGeckoInstruction inst)
|
||||||
|
|
||||||
void Interpreter::Init()
|
void Interpreter::Init()
|
||||||
{
|
{
|
||||||
|
InitializeInstructionTables();
|
||||||
m_reserve = false;
|
m_reserve = false;
|
||||||
m_end_block = false;
|
m_end_block = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,8 @@ public:
|
||||||
static u32 Helper_Carry(u32 value1, u32 value2);
|
static u32 Helper_Carry(u32 value1, u32 value2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void InitializeInstructionTables();
|
||||||
|
|
||||||
// flag helper
|
// flag helper
|
||||||
static void Helper_UpdateCR0(u32 value);
|
static void Helper_UpdateCR0(u32 value);
|
||||||
static void Helper_UpdateCR1();
|
static void Helper_UpdateCR1();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "Core/PowerPC/Gekko.h"
|
#include "Core/PowerPC/Gekko.h"
|
||||||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||||
#include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
|
|
||||||
#include "Core/PowerPC/PPCTables.h"
|
#include "Core/PowerPC/PPCTables.h"
|
||||||
|
|
||||||
struct GekkoOPTemplate
|
struct GekkoOPTemplate
|
||||||
|
@ -355,8 +354,6 @@ static std::array<GekkoOPTemplate, 10> table63_2 =
|
||||||
}};
|
}};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
namespace InterpreterTables
|
|
||||||
{
|
|
||||||
constexpr size_t TotalInstructionFunctionCount()
|
constexpr size_t TotalInstructionFunctionCount()
|
||||||
{
|
{
|
||||||
return primarytable.size() + table4_2.size() + table4_3.size() + table4.size() + table31.size() +
|
return primarytable.size() + table4_2.size() + table4_3.size() + table4.size() + table31.size() +
|
||||||
|
@ -366,7 +363,7 @@ constexpr size_t TotalInstructionFunctionCount()
|
||||||
static_assert(TotalInstructionFunctionCount() < m_allInstructions.size(),
|
static_assert(TotalInstructionFunctionCount() < m_allInstructions.size(),
|
||||||
"m_allInstructions is too small");
|
"m_allInstructions is too small");
|
||||||
|
|
||||||
void InitTables()
|
void Interpreter::InitializeInstructionTables()
|
||||||
{
|
{
|
||||||
// once initialized, tables are read-only
|
// once initialized, tables are read-only
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
@ -376,22 +373,22 @@ void InitTables()
|
||||||
// clear
|
// clear
|
||||||
for (int i = 0; i < 64; i++)
|
for (int i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
Interpreter::m_op_table[i] = Interpreter::unknown_instruction;
|
m_op_table[i] = Interpreter::unknown_instruction;
|
||||||
m_infoTable[i] = &unknownopinfo;
|
m_infoTable[i] = &unknownopinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
Interpreter::m_op_table59[i] = Interpreter::unknown_instruction;
|
m_op_table59[i] = Interpreter::unknown_instruction;
|
||||||
m_infoTable59[i] = &unknownopinfo;
|
m_infoTable59[i] = &unknownopinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 1024; i++)
|
for (int i = 0; i < 1024; i++)
|
||||||
{
|
{
|
||||||
Interpreter::m_op_table4[i] = Interpreter::unknown_instruction;
|
m_op_table4[i] = Interpreter::unknown_instruction;
|
||||||
Interpreter::m_op_table19[i] = Interpreter::unknown_instruction;
|
m_op_table19[i] = Interpreter::unknown_instruction;
|
||||||
Interpreter::m_op_table31[i] = Interpreter::unknown_instruction;
|
m_op_table31[i] = Interpreter::unknown_instruction;
|
||||||
Interpreter::m_op_table63[i] = Interpreter::unknown_instruction;
|
m_op_table63[i] = Interpreter::unknown_instruction;
|
||||||
m_infoTable4[i] = &unknownopinfo;
|
m_infoTable4[i] = &unknownopinfo;
|
||||||
m_infoTable19[i] = &unknownopinfo;
|
m_infoTable19[i] = &unknownopinfo;
|
||||||
m_infoTable31[i] = &unknownopinfo;
|
m_infoTable31[i] = &unknownopinfo;
|
||||||
|
@ -400,7 +397,7 @@ void InitTables()
|
||||||
|
|
||||||
for (auto& tpl : primarytable)
|
for (auto& tpl : primarytable)
|
||||||
{
|
{
|
||||||
Interpreter::m_op_table[tpl.opcode] = tpl.Inst;
|
m_op_table[tpl.opcode] = tpl.Inst;
|
||||||
m_infoTable[tpl.opcode] = &tpl.opinfo;
|
m_infoTable[tpl.opcode] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +407,7 @@ void InitTables()
|
||||||
for (auto& tpl : table4_2)
|
for (auto& tpl : table4_2)
|
||||||
{
|
{
|
||||||
int op = fill + tpl.opcode;
|
int op = fill + tpl.opcode;
|
||||||
Interpreter::m_op_table4[op] = tpl.Inst;
|
m_op_table4[op] = tpl.Inst;
|
||||||
m_infoTable4[op] = &tpl.opinfo;
|
m_infoTable4[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +418,7 @@ void InitTables()
|
||||||
for (auto& tpl : table4_3)
|
for (auto& tpl : table4_3)
|
||||||
{
|
{
|
||||||
int op = fill + tpl.opcode;
|
int op = fill + tpl.opcode;
|
||||||
Interpreter::m_op_table4[op] = tpl.Inst;
|
m_op_table4[op] = tpl.Inst;
|
||||||
m_infoTable4[op] = &tpl.opinfo;
|
m_infoTable4[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,35 +426,35 @@ void InitTables()
|
||||||
for (auto& tpl : table4)
|
for (auto& tpl : table4)
|
||||||
{
|
{
|
||||||
int op = tpl.opcode;
|
int op = tpl.opcode;
|
||||||
Interpreter::m_op_table4[op] = tpl.Inst;
|
m_op_table4[op] = tpl.Inst;
|
||||||
m_infoTable4[op] = &tpl.opinfo;
|
m_infoTable4[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& tpl : table31)
|
for (auto& tpl : table31)
|
||||||
{
|
{
|
||||||
int op = tpl.opcode;
|
int op = tpl.opcode;
|
||||||
Interpreter::m_op_table31[op] = tpl.Inst;
|
m_op_table31[op] = tpl.Inst;
|
||||||
m_infoTable31[op] = &tpl.opinfo;
|
m_infoTable31[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& tpl : table19)
|
for (auto& tpl : table19)
|
||||||
{
|
{
|
||||||
int op = tpl.opcode;
|
int op = tpl.opcode;
|
||||||
Interpreter::m_op_table19[op] = tpl.Inst;
|
m_op_table19[op] = tpl.Inst;
|
||||||
m_infoTable19[op] = &tpl.opinfo;
|
m_infoTable19[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& tpl : table59)
|
for (auto& tpl : table59)
|
||||||
{
|
{
|
||||||
int op = tpl.opcode;
|
int op = tpl.opcode;
|
||||||
Interpreter::m_op_table59[op] = tpl.Inst;
|
m_op_table59[op] = tpl.Inst;
|
||||||
m_infoTable59[op] = &tpl.opinfo;
|
m_infoTable59[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& tpl : table63)
|
for (auto& tpl : table63)
|
||||||
{
|
{
|
||||||
int op = tpl.opcode;
|
int op = tpl.opcode;
|
||||||
Interpreter::m_op_table63[op] = tpl.Inst;
|
m_op_table63[op] = tpl.Inst;
|
||||||
m_infoTable63[op] = &tpl.opinfo;
|
m_infoTable63[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +464,7 @@ void InitTables()
|
||||||
for (auto& tpl : table63_2)
|
for (auto& tpl : table63_2)
|
||||||
{
|
{
|
||||||
int op = fill + tpl.opcode;
|
int op = fill + tpl.opcode;
|
||||||
Interpreter::m_op_table63[op] = tpl.Inst;
|
m_op_table63[op] = tpl.Inst;
|
||||||
m_infoTable63[op] = &tpl.opinfo;
|
m_infoTable63[op] = &tpl.opinfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,4 +491,3 @@ void InitTables()
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
} // namespace InterpreterTables
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
// Copyright 2008 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace InterpreterTables
|
|
||||||
{
|
|
||||||
void InitTables();
|
|
||||||
}
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/PowerPC/Jit64/Jit.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -22,8 +24,6 @@
|
||||||
#include "Core/HW/GPFifo.h"
|
#include "Core/HW/GPFifo.h"
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/Jit64/Jit.h"
|
|
||||||
#include "Core/PowerPC/Jit64/Jit64_Tables.h"
|
|
||||||
#include "Core/PowerPC/Jit64/JitAsm.h"
|
#include "Core/PowerPC/Jit64/JitAsm.h"
|
||||||
#include "Core/PowerPC/Jit64/JitRegCache.h"
|
#include "Core/PowerPC/Jit64/JitRegCache.h"
|
||||||
#include "Core/PowerPC/Jit64Common/FarCodeCache.h"
|
#include "Core/PowerPC/Jit64Common/FarCodeCache.h"
|
||||||
|
@ -216,6 +216,7 @@ bool Jit64::HandleFault(uintptr_t access_address, SContext* ctx)
|
||||||
|
|
||||||
void Jit64::Init()
|
void Jit64::Init()
|
||||||
{
|
{
|
||||||
|
InitializeInstructionTables();
|
||||||
EnableBlockLink();
|
EnableBlockLink();
|
||||||
|
|
||||||
jo.optimizeGatherPipe = true;
|
jo.optimizeGatherPipe = true;
|
||||||
|
|
|
@ -35,17 +35,14 @@ public:
|
||||||
Jit64() : code_buffer(32000) {}
|
Jit64() : code_buffer(32000) {}
|
||||||
~Jit64() {}
|
~Jit64() {}
|
||||||
void Init() override;
|
void Init() override;
|
||||||
|
|
||||||
void EnableOptimization();
|
|
||||||
|
|
||||||
void EnableBlockLink();
|
|
||||||
|
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
bool HandleFault(uintptr_t access_address, SContext* ctx) override;
|
bool HandleFault(uintptr_t access_address, SContext* ctx) override;
|
||||||
|
|
||||||
bool HandleStackFault() override;
|
bool HandleStackFault() override;
|
||||||
|
|
||||||
|
void EnableOptimization();
|
||||||
|
void EnableBlockLink();
|
||||||
|
|
||||||
// Jit!
|
// Jit!
|
||||||
|
|
||||||
void Jit(u32 em_address) override;
|
void Jit(u32 em_address) override;
|
||||||
|
@ -234,6 +231,7 @@ public:
|
||||||
void eieio(UGeckoInstruction inst);
|
void eieio(UGeckoInstruction inst);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void InitializeInstructionTables();
|
||||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||||
|
|
||||||
void AllocStack();
|
void AllocStack();
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "Core/PowerPC/Jit64/Jit.h"
|
#include "Core/PowerPC/Jit64/Jit.h"
|
||||||
#include "Core/PowerPC/Gekko.h"
|
#include "Core/PowerPC/Gekko.h"
|
||||||
#include "Core/PowerPC/Jit64/Jit64_Tables.h"
|
|
||||||
|
|
||||||
static Jit64::Instruction dynaOpTable[64];
|
static Jit64::Instruction dynaOpTable[64];
|
||||||
static Jit64::Instruction dynaOpTable4[1024];
|
static Jit64::Instruction dynaOpTable4[1024];
|
||||||
|
@ -376,9 +375,7 @@ void Jit64::CompileInstruction(PPCAnalyst::CodeOp& op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Jit64Tables
|
void Jit64::InitializeInstructionTables()
|
||||||
{
|
|
||||||
void InitTables()
|
|
||||||
{
|
{
|
||||||
// once initialized, tables are read-only
|
// once initialized, tables are read-only
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
@ -471,5 +468,3 @@ void InitTables()
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2008 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class Jit64;
|
|
||||||
|
|
||||||
namespace PPCAnalyst
|
|
||||||
{
|
|
||||||
struct CodeOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Jit64Tables
|
|
||||||
{
|
|
||||||
void InitTables();
|
|
||||||
}
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/PowerPC/Jit64IL/JitIL.h"
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <ctime> // For profiling
|
#include <ctime> // For profiling
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -19,8 +21,6 @@
|
||||||
#include "Core/HW/CPU.h"
|
#include "Core/HW/CPU.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
|
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
|
||||||
#include "Core/PowerPC/Jit64IL/JitIL.h"
|
|
||||||
#include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
|
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/PowerPC/Profiler.h"
|
#include "Core/PowerPC/Profiler.h"
|
||||||
|
|
||||||
|
@ -255,6 +255,7 @@ static void Shutdown()
|
||||||
|
|
||||||
void JitIL::Init()
|
void JitIL::Init()
|
||||||
{
|
{
|
||||||
|
InitializeInstructionTables();
|
||||||
EnableBlockLink();
|
EnableBlockLink();
|
||||||
|
|
||||||
jo.optimizeGatherPipe = true;
|
jo.optimizeGatherPipe = true;
|
||||||
|
|
|
@ -35,11 +35,10 @@ public:
|
||||||
// Initialization, etc
|
// Initialization, etc
|
||||||
|
|
||||||
void Init() override;
|
void Init() override;
|
||||||
|
void Shutdown() override;
|
||||||
|
|
||||||
void EnableBlockLink();
|
void EnableBlockLink();
|
||||||
|
|
||||||
void Shutdown() override;
|
|
||||||
|
|
||||||
// Jit!
|
// Jit!
|
||||||
|
|
||||||
void Jit(u32 em_address) override;
|
void Jit(u32 em_address) override;
|
||||||
|
@ -79,5 +78,6 @@ public:
|
||||||
void DynaRunTable63(UGeckoInstruction _inst) override;
|
void DynaRunTable63(UGeckoInstruction _inst) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void InitializeInstructionTables();
|
||||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "Core/PowerPC/Jit64IL/JitIL.h"
|
#include "Core/PowerPC/Jit64IL/JitIL.h"
|
||||||
#include "Core/PowerPC/Gekko.h"
|
#include "Core/PowerPC/Gekko.h"
|
||||||
#include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
|
|
||||||
#include "Core/PowerPC/PPCTables.h"
|
#include "Core/PowerPC/PPCTables.h"
|
||||||
|
|
||||||
static JitIL::Instruction dynaOpTable[64];
|
static JitIL::Instruction dynaOpTable[64];
|
||||||
|
@ -399,9 +398,7 @@ void JitIL::CompileInstruction(PPCAnalyst::CodeOp& op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace JitILTables
|
void JitIL::InitializeInstructionTables()
|
||||||
{
|
|
||||||
void InitTables()
|
|
||||||
{
|
{
|
||||||
// once initialized, tables are read-only
|
// once initialized, tables are read-only
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
@ -494,4 +491,3 @@ void InitTables()
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2008 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class JitIL;
|
|
||||||
|
|
||||||
namespace PPCAnalyst
|
|
||||||
{
|
|
||||||
struct CodeOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace JitILTables
|
|
||||||
{
|
|
||||||
void InitTables();
|
|
||||||
}
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/PowerPC/JitArm64/Jit.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "Common/Arm64Emitter.h"
|
#include "Common/Arm64Emitter.h"
|
||||||
|
@ -19,9 +21,7 @@
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/JitArm64/Jit.h"
|
|
||||||
#include "Core/PowerPC/JitArm64/JitArm64_RegCache.h"
|
#include "Core/PowerPC/JitArm64/JitArm64_RegCache.h"
|
||||||
#include "Core/PowerPC/JitArm64/JitArm64_Tables.h"
|
|
||||||
#include "Core/PowerPC/JitInterface.h"
|
#include "Core/PowerPC/JitInterface.h"
|
||||||
#include "Core/PowerPC/Profiler.h"
|
#include "Core/PowerPC/Profiler.h"
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ static bool HasCycleCounters()
|
||||||
|
|
||||||
void JitArm64::Init()
|
void JitArm64::Init()
|
||||||
{
|
{
|
||||||
|
InitializeInstructionTables();
|
||||||
|
|
||||||
size_t child_code_size = SConfig::GetInstance().bMMU ? FARCODE_SIZE_MMU : FARCODE_SIZE;
|
size_t child_code_size = SConfig::GetInstance().bMMU ? FARCODE_SIZE_MMU : FARCODE_SIZE;
|
||||||
AllocCodeSpace(CODE_SIZE + child_code_size);
|
AllocCodeSpace(CODE_SIZE + child_code_size);
|
||||||
AddChildCodeSpace(&farcode, child_code_size);
|
AddChildCodeSpace(&farcode, child_code_size);
|
||||||
|
|
|
@ -172,6 +172,7 @@ private:
|
||||||
const u8* slowmem_code;
|
const u8* slowmem_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void InitializeInstructionTables();
|
||||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||||
|
|
||||||
void EmitResetCycleCounters();
|
void EmitResetCycleCounters();
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/PowerPC/JitArm64/JitArm64_Tables.h"
|
#include "Core/PowerPC/JitArm64/Jit.h"
|
||||||
|
|
||||||
#include "Core/PowerPC/Gekko.h"
|
#include "Core/PowerPC/Gekko.h"
|
||||||
#include "Core/PowerPC/JitArm64/Jit.h"
|
|
||||||
#include "Core/PowerPC/JitInterface.h"
|
#include "Core/PowerPC/JitInterface.h"
|
||||||
#include "Core/PowerPC/PPCAnalyst.h"
|
#include "Core/PowerPC/PPCAnalyst.h"
|
||||||
#include "Core/PowerPC/PPCTables.h"
|
#include "Core/PowerPC/PPCTables.h"
|
||||||
|
@ -385,9 +384,7 @@ void JitArm64::CompileInstruction(PPCAnalyst::CodeOp& op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace JitArm64Tables
|
void JitArm64::InitializeInstructionTables()
|
||||||
{
|
|
||||||
void InitTables()
|
|
||||||
{
|
{
|
||||||
// once initialized, tables are read-only
|
// once initialized, tables are read-only
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
@ -480,5 +477,3 @@ void InitTables()
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2008 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class JitArm64;
|
|
||||||
|
|
||||||
namespace PPCAnalyst
|
|
||||||
{
|
|
||||||
struct CodeOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace JitArm64Tables
|
|
||||||
{
|
|
||||||
void InitTables();
|
|
||||||
}
|
|
|
@ -22,14 +22,11 @@
|
||||||
|
|
||||||
#if _M_X86
|
#if _M_X86
|
||||||
#include "Core/PowerPC/Jit64/Jit.h"
|
#include "Core/PowerPC/Jit64/Jit.h"
|
||||||
#include "Core/PowerPC/Jit64/Jit64_Tables.h"
|
|
||||||
#include "Core/PowerPC/Jit64IL/JitIL.h"
|
#include "Core/PowerPC/Jit64IL/JitIL.h"
|
||||||
#include "Core/PowerPC/Jit64IL/JitIL_Tables.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _M_ARM_64
|
#if _M_ARM_64
|
||||||
#include "Core/PowerPC/JitArm64/Jit.h"
|
#include "Core/PowerPC/JitArm64/Jit.h"
|
||||||
#include "Core/PowerPC/JitArm64/JitArm64_Tables.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace JitInterface
|
namespace JitInterface
|
||||||
|
@ -70,31 +67,7 @@ CPUCoreBase* InitJitCore(int core)
|
||||||
g_jit->Init();
|
g_jit->Init();
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
void InitTables(int core)
|
|
||||||
{
|
|
||||||
switch (core)
|
|
||||||
{
|
|
||||||
#if _M_X86
|
|
||||||
case PowerPC::CORE_JIT64:
|
|
||||||
Jit64Tables::InitTables();
|
|
||||||
break;
|
|
||||||
case PowerPC::CORE_JITIL64:
|
|
||||||
JitILTables::InitTables();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#if _M_ARM_64
|
|
||||||
case PowerPC::CORE_JITARM64:
|
|
||||||
JitArm64Tables::InitTables();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case PowerPC::CORE_CACHEDINTERPRETER:
|
|
||||||
// has no tables
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PanicAlert("Unrecognizable cpu_core: %d", core);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CPUCoreBase* GetCore()
|
CPUCoreBase* GetCore()
|
||||||
{
|
{
|
||||||
return g_jit;
|
return g_jit;
|
||||||
|
|
|
@ -22,7 +22,6 @@ enum class ExceptionType
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
CPUCoreBase* InitJitCore(int core);
|
CPUCoreBase* InitJitCore(int core);
|
||||||
void InitTables(int core);
|
|
||||||
CPUCoreBase* GetCore();
|
CPUCoreBase* GetCore();
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||||
#include "Core/PowerPC/Interpreter/Interpreter_Tables.h"
|
|
||||||
#include "Core/PowerPC/JitInterface.h"
|
#include "Core/PowerPC/JitInterface.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
|
@ -110,15 +109,6 @@ bool UsesFPU(UGeckoInstruction inst)
|
||||||
return (info->flags & FL_USE_FPU) != 0;
|
return (info->flags & FL_USE_FPU) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitTables(int cpu_core)
|
|
||||||
{
|
|
||||||
// Interpreter ALWAYS needs to be initialized
|
|
||||||
InterpreterTables::InitTables();
|
|
||||||
|
|
||||||
if (cpu_core != PowerPC::CORE_INTERPRETER)
|
|
||||||
JitInterface::InitTables(cpu_core);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define OPLOG
|
#define OPLOG
|
||||||
#define OP_TO_LOG "mtfsb0x"
|
#define OP_TO_LOG "mtfsb0x"
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,6 @@ Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst);
|
||||||
|
|
||||||
namespace PPCTables
|
namespace PPCTables
|
||||||
{
|
{
|
||||||
void InitTables(int cpu_core);
|
|
||||||
bool IsValidInstruction(UGeckoInstruction _instCode);
|
bool IsValidInstruction(UGeckoInstruction _instCode);
|
||||||
bool UsesFPU(UGeckoInstruction _inst);
|
bool UsesFPU(UGeckoInstruction _inst);
|
||||||
|
|
||||||
|
@ -118,5 +117,4 @@ void CountInstruction(UGeckoInstruction _inst);
|
||||||
void PrintInstructionRunCounts();
|
void PrintInstructionRunCounts();
|
||||||
void LogCompiledInstructions();
|
void LogCompiledInstructions();
|
||||||
const char* GetInstructionName(UGeckoInstruction _inst);
|
const char* GetInstructionName(UGeckoInstruction _inst);
|
||||||
|
} // namespace PPCTables
|
||||||
} // namespace
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
@ -18,8 +20,6 @@
|
||||||
#include "Core/PowerPC/CPUCoreBase.h"
|
#include "Core/PowerPC/CPUCoreBase.h"
|
||||||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||||
#include "Core/PowerPC/JitInterface.h"
|
#include "Core/PowerPC/JitInterface.h"
|
||||||
#include "Core/PowerPC/PPCTables.h"
|
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
|
||||||
|
|
||||||
namespace PowerPC
|
namespace PowerPC
|
||||||
{
|
{
|
||||||
|
@ -148,8 +148,6 @@ static void ResetRegisters()
|
||||||
|
|
||||||
static void InitializeCPUCore(int cpu_core)
|
static void InitializeCPUCore(int cpu_core)
|
||||||
{
|
{
|
||||||
PPCTables::InitTables(cpu_core);
|
|
||||||
|
|
||||||
// We initialize the interpreter because
|
// We initialize the interpreter because
|
||||||
// it is used on boot and code window independently.
|
// it is used on boot and code window independently.
|
||||||
s_interpreter->Init();
|
s_interpreter->Init();
|
||||||
|
|
Loading…
Reference in New Issue