Move the JitWindow debugging window over to using the new PPCAnalyzer class.

This commit is contained in:
Ryan Houdek 2014-04-30 08:19:28 -05:00
parent 6949087ee1
commit c794dc8085
1 changed files with 12 additions and 10 deletions

View File

@ -129,8 +129,7 @@ void CJitWindow::Compare(u32 em_address)
const u8 *code = (const u8 *)jit->GetBlockCache()->GetCompiledCodeFromBlock(block_num); const u8 *code = (const u8 *)jit->GetBlockCache()->GetCompiledCodeFromBlock(block_num);
u64 disasmPtr = (u64)code; u64 disasmPtr = (u64)code;
int size = block->codeSize; const u8 *end = code + block->codeSize;
const u8 *end = code + size;
char *sptr = (char*)xDis; char *sptr = (char*)xDis;
int num_x86_instructions = 0; int num_x86_instructions = 0;
@ -154,14 +153,17 @@ void CJitWindow::Compare(u32 em_address)
PPCAnalyst::BlockStats st; PPCAnalyst::BlockStats st;
PPCAnalyst::BlockRegStats gpa; PPCAnalyst::BlockRegStats gpa;
PPCAnalyst::BlockRegStats fpa; PPCAnalyst::BlockRegStats fpa;
bool broken_block = false; PPCAnalyst::CodeBlock code_block;
u32 merged_addresses[32]; PPCAnalyst::PPCAnalyzer analyzer;
const int capacity_of_merged_addresses = sizeof(merged_addresses) / sizeof(merged_addresses[0]);
int size_of_merged_addresses; code_block.m_stats = &st;
if (PPCAnalyst::Flatten(ppc_addr, &size, &st, &gpa, &fpa, broken_block, &code_buffer, size, merged_addresses, capacity_of_merged_addresses, size_of_merged_addresses) != 0xffffffff) code_block.m_gpa = &gpa;
code_block.m_fpa = &fpa;
if (analyzer.Analyze(ppc_addr, &code_block, &code_buffer, block->codeSize) != 0xFFFFFFFF)
{ {
sptr = (char*)xDis; sptr = (char*)xDis;
for (int i = 0; i < size; i++) for (u32 i = 0; i < code_block.m_num_instructions; i++)
{ {
const PPCAnalyst::CodeOp &op = code_buffer.codebuffer[i]; const PPCAnalyst::CodeOp &op = code_buffer.codebuffer[i];
char temp[256]; char temp[256];
@ -181,9 +183,9 @@ void CJitWindow::Compare(u32 em_address)
sptr += sprintf(sptr, "%i estimated cycles\n", st.numCycles); sptr += sprintf(sptr, "%i estimated cycles\n", st.numCycles);
sptr += sprintf(sptr, "Num instr: PPC: %i x86: %i (blowup: %i%%)\n", sptr += sprintf(sptr, "Num instr: PPC: %i x86: %i (blowup: %i%%)\n",
size, num_x86_instructions, 100 * (num_x86_instructions / size - 1)); code_block.m_num_instructions, num_x86_instructions, 100 * (num_x86_instructions / code_block.m_num_instructions - 1));
sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n", sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n",
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1)); code_block.m_num_instructions * 4, block->codeSize, 100 * (block->codeSize / (4 * code_block.m_num_instructions) - 1));
ppc_box->SetValue(StrToWxStr((char*)xDis)); ppc_box->SetValue(StrToWxStr((char*)xDis));
} }