mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Let Jit64IL use the new PPCAnalyst class
This commit is contained in:
@ -268,6 +268,10 @@ void JitIL::Init()
|
|||||||
blocks.Init();
|
blocks.Init();
|
||||||
asm_routines.Init();
|
asm_routines.Init();
|
||||||
|
|
||||||
|
code_block.m_stats = &js.st;
|
||||||
|
code_block.m_gpa = &js.gpa;
|
||||||
|
code_block.m_fpa = &js.fpa;
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILTimeProfiling) {
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILTimeProfiling) {
|
||||||
JitILProfiler::Init();
|
JitILProfiler::Init();
|
||||||
}
|
}
|
||||||
@ -500,9 +504,6 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
// Memory exception on instruction fetch
|
// Memory exception on instruction fetch
|
||||||
bool memory_exception = false;
|
bool memory_exception = false;
|
||||||
|
|
||||||
// A broken block is a block that does not end in a branch
|
|
||||||
bool broken_block = false;
|
|
||||||
|
|
||||||
if (Core::g_CoreStartupParameter.bEnableDebugging)
|
if (Core::g_CoreStartupParameter.bEnableDebugging)
|
||||||
{
|
{
|
||||||
// Comment out the following to disable breakpoints (speed-up)
|
// Comment out the following to disable breakpoints (speed-up)
|
||||||
@ -529,7 +530,6 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = 0;
|
|
||||||
js.isLastInstruction = false;
|
js.isLastInstruction = false;
|
||||||
js.blockStart = em_address;
|
js.blockStart = em_address;
|
||||||
js.fifoBytesThisBlock = 0;
|
js.fifoBytesThisBlock = 0;
|
||||||
@ -538,19 +538,12 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
jit->js.numLoadStoreInst = 0;
|
jit->js.numLoadStoreInst = 0;
|
||||||
jit->js.numFloatingPointInst = 0;
|
jit->js.numFloatingPointInst = 0;
|
||||||
|
|
||||||
|
u32 nextPC = em_address;
|
||||||
// Analyze the block, collect all instructions it is made of (including inlining,
|
// Analyze the block, collect all instructions it is made of (including inlining,
|
||||||
// if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
|
// if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
|
||||||
u32 exitAddress = em_address;
|
|
||||||
|
|
||||||
u32 merged_addresses[32];
|
|
||||||
const int capacity_of_merged_addresses = sizeof(merged_addresses) / sizeof(merged_addresses[0]);
|
|
||||||
int size_of_merged_addresses = 0;
|
|
||||||
if (!memory_exception)
|
if (!memory_exception)
|
||||||
{
|
nextPC = analyser.Analyze(em_address, &code_block, code_buf, blockSize);
|
||||||
// If there is a memory exception inside a block (broken_block==true), compile up to that instruction.
|
|
||||||
// TODO
|
|
||||||
exitAddress = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, broken_block, code_buf, blockSize, merged_addresses, capacity_of_merged_addresses, size_of_merged_addresses);
|
|
||||||
}
|
|
||||||
PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
|
PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
|
||||||
|
|
||||||
const u8 *start = AlignCode4(); // TODO: Test if this or AlignCode16 make a difference from GetCodePtr
|
const u8 *start = AlignCode4(); // TODO: Test if this or AlignCode16 make a difference from GetCodePtr
|
||||||
@ -586,7 +579,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILOutputIR)
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILOutputIR)
|
||||||
{
|
{
|
||||||
// For profiling and IR Writer
|
// For profiling and IR Writer
|
||||||
for (int i = 0; i < (int)size; i++)
|
for (u32 i = 0; i < code_block.m_num_instructions; i++)
|
||||||
{
|
{
|
||||||
const u64 inst = ops[i].inst.hex;
|
const u64 inst = ops[i].inst.hex;
|
||||||
// Ported from boost::hash
|
// Ported from boost::hash
|
||||||
@ -606,16 +599,10 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
|
|
||||||
js.downcountAmount = 0;
|
js.downcountAmount = 0;
|
||||||
if (!Core::g_CoreStartupParameter.bEnableDebugging)
|
if (!Core::g_CoreStartupParameter.bEnableDebugging)
|
||||||
{
|
js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address);
|
||||||
for (int i = 0; i < size_of_merged_addresses; ++i)
|
|
||||||
{
|
|
||||||
const u32 address = merged_addresses[i];
|
|
||||||
js.downcountAmount += PatchEngine::GetSpeedhackCycles(address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Translate instructions
|
// Translate instructions
|
||||||
for (int i = 0; i < (int)size; i++)
|
for (u32 i = 0; i < code_block.m_num_instructions; i++)
|
||||||
{
|
{
|
||||||
js.compilerPC = ops[i].address;
|
js.compilerPC = ops[i].address;
|
||||||
js.op = &ops[i];
|
js.op = &ops[i];
|
||||||
@ -623,7 +610,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
const GekkoOPInfo *opinfo = GetOpInfo(ops[i].inst);
|
const GekkoOPInfo *opinfo = GetOpInfo(ops[i].inst);
|
||||||
js.downcountAmount += opinfo->numCycles;
|
js.downcountAmount += opinfo->numCycles;
|
||||||
|
|
||||||
if (i == (int)size - 1)
|
if (i == (code_block.m_num_instructions - 1))
|
||||||
{
|
{
|
||||||
js.isLastInstruction = true;
|
js.isLastInstruction = true;
|
||||||
js.next_inst = 0;
|
js.next_inst = 0;
|
||||||
@ -708,13 +695,13 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform actual code generation
|
// Perform actual code generation
|
||||||
WriteCode(exitAddress);
|
WriteCode(nextPC);
|
||||||
|
|
||||||
b->codeSize = (u32)(GetCodePtr() - normalEntry);
|
b->codeSize = (u32)(GetCodePtr() - normalEntry);
|
||||||
b->originalSize = size;
|
b->originalSize = code_block.m_num_instructions;
|
||||||
|
|
||||||
#ifdef JIT_LOG_X86
|
#ifdef JIT_LOG_X86
|
||||||
LogGeneratedX86(size, code_buf, normalEntry, b);
|
LogGeneratedX86(code_block.m_num_instructions, code_buf, normalEntry, b);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILOutputIR)
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITILOutputIR)
|
||||||
|
Reference in New Issue
Block a user