Address delroth's comments.

This commit is contained in:
Ryan Houdek 2014-04-30 03:49:17 -05:00
parent 40c317d1d4
commit 1cb1260c1d
10 changed files with 56 additions and 57 deletions

View File

@ -185,7 +185,7 @@ void Jit64::Init()
code_block.m_stats = &js.st; code_block.m_stats = &js.st;
code_block.m_gpa = &js.gpa; code_block.m_gpa = &js.gpa;
code_block.m_fpa = &js.fpa; code_block.m_fpa = &js.fpa;
analyser.SetOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE); analyser.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE);
} }
void Jit64::ClearCache() void Jit64::ClearCache()
@ -449,7 +449,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
// 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.
if (!memory_exception) if (!memory_exception)
nextPC = analyser.Analyse(em_address, &code_block, code_buf, blockSize); nextPC = analyser.Analyze(em_address, &code_block, code_buf, blockSize);
PPCAnalyst::CodeOp *ops = code_buf->codebuffer; PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
@ -498,10 +498,10 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address); js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address);
js.skipnext = false; js.skipnext = false;
js.blockSize = code_block.m_instructions; js.blockSize = code_block.m_num_instructions;
js.compilerPC = nextPC; js.compilerPC = nextPC;
// Translate instructions // Translate instructions
for (u32 i = 0; i < code_block.m_instructions; 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];
@ -509,7 +509,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
const GekkoOPInfo *opinfo = ops[i].opinfo; const GekkoOPInfo *opinfo = ops[i].opinfo;
js.downcountAmount += opinfo->numCycles; js.downcountAmount += opinfo->numCycles;
if (i == (code_block.m_instructions - 1)) if (i == (code_block.m_num_instructions - 1))
{ {
// WARNING - cmp->branch merging will screw this up. // WARNING - cmp->branch merging will screw this up.
js.isLastInstruction = true; js.isLastInstruction = true;
@ -705,10 +705,10 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
b->flags = js.block_flags; b->flags = js.block_flags;
b->codeSize = (u32)(GetCodePtr() - normalEntry); b->codeSize = (u32)(GetCodePtr() - normalEntry);
b->originalSize = code_block.m_instructions; b->originalSize = code_block.m_num_instructions;
#ifdef JIT_LOG_X86 #ifdef JIT_LOG_X86
LogGeneratedX86(code_block.m_instructions, code_buf, normalEntry, b); LogGeneratedX86(code_block.m_num_instructions, code_buf, normalEntry, b);
#endif #endif
return normalEntry; return normalEntry;

View File

@ -142,7 +142,7 @@ void Jit64::bcx(UGeckoInstruction inst)
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch ); SetJumpTarget( pCTRDontBranch );
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }
@ -192,7 +192,7 @@ void Jit64::bcctrx(UGeckoInstruction inst)
// Would really like to continue the block here, but it ends. TODO. // Would really like to continue the block here, but it ends. TODO.
SetJumpTarget(b); SetJumpTarget(b);
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }
} }
@ -242,6 +242,6 @@ void Jit64::bclrx(UGeckoInstruction inst)
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch ); SetJumpTarget( pCTRDontBranch );
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }

View File

@ -425,7 +425,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
} }
else else
{ {
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
{ {
js.skipnext = true; js.skipnext = true;
WriteExit(js.next_compilerPC + 4); WriteExit(js.next_compilerPC + 4);
@ -537,7 +537,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
if (!!(4 & test_bit) == condition) SetJumpTarget(continue2); if (!!(4 & test_bit) == condition) SetJumpTarget(continue2);
if (!!(2 & test_bit) == condition) SetJumpTarget(continue1); if (!!(2 & test_bit) == condition) SetJumpTarget(continue1);
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
{ {
js.skipnext = true; js.skipnext = true;
WriteExit(js.next_compilerPC + 4); WriteExit(js.next_compilerPC + 4);
@ -2234,6 +2234,6 @@ void Jit64::twx(UGeckoInstruction inst)
SetJumpTarget(exit4); SetJumpTarget(exit4);
SetJumpTarget(exit5); SetJumpTarget(exit5);
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }

View File

@ -44,7 +44,7 @@ void JitArm::Init()
code_block.m_stats = &js.st; code_block.m_stats = &js.st;
code_block.m_gpa = &js.gpa; code_block.m_gpa = &js.gpa;
code_block.m_fpa = &js.fpa; code_block.m_fpa = &js.fpa;
analyser.SetOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE); analyser.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE);
} }
void JitArm::ClearCache() void JitArm::ClearCache()
@ -336,7 +336,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
// 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.
if (!memory_exception) if (!memory_exception)
nextPC = analyser.Analyse(em_address, &code_block, code_buf, blockSize); nextPC = analyser.Analyze(em_address, &code_block, code_buf, blockSize);
PPCAnalyst::CodeOp *ops = code_buf->codebuffer; PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
@ -397,7 +397,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address); js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address);
js.skipnext = false; js.skipnext = false;
js.blockSize = code_block.m_instructions; js.blockSize = code_block.m_num_instructions;
js.compilerPC = nextPC; js.compilerPC = nextPC;
const int DEBUG_OUTPUT = 0; const int DEBUG_OUTPUT = 0;
@ -406,7 +406,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
WARN_LOG(DYNA_REC, "-------0x%08x-------", em_address); WARN_LOG(DYNA_REC, "-------0x%08x-------", em_address);
// Translate instructions // Translate instructions
for (u32 i = 0; i < code_block.m_instructions; 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];
@ -414,7 +414,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
const GekkoOPInfo *opinfo = ops[i].opinfo; const GekkoOPInfo *opinfo = ops[i].opinfo;
js.downcountAmount += opinfo->numCycles; js.downcountAmount += opinfo->numCycles;
if (i == (code_block.m_instructions - 1)) if (i == (code_block.m_num_instructions - 1))
{ {
// WARNING - cmp->branch merging will screw this up. // WARNING - cmp->branch merging will screw this up.
js.isLastInstruction = true; js.isLastInstruction = true;
@ -488,7 +488,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo
b->flags = js.block_flags; b->flags = js.block_flags;
b->codeSize = (u32)(GetCodePtr() - normalEntry); b->codeSize = (u32)(GetCodePtr() - normalEntry);
b->originalSize = code_block.m_instructions; b->originalSize = code_block.m_num_instructions;
FlushIcache(); FlushIcache();
return start; return start;
} }

View File

@ -202,7 +202,7 @@ void JitArm::bcx(UGeckoInstruction inst)
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch ); SetJumpTarget( pCTRDontBranch );
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }
void JitArm::bcctrx(UGeckoInstruction inst) void JitArm::bcctrx(UGeckoInstruction inst)
@ -266,7 +266,7 @@ void JitArm::bcctrx(UGeckoInstruction inst)
SetJumpTarget(b); SetJumpTarget(b);
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }
} }
@ -334,6 +334,6 @@ void JitArm::bclrx(UGeckoInstruction inst)
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
SetJumpTarget( pCTRDontBranch ); SetJumpTarget( pCTRDontBranch );
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
} }

View File

@ -1015,7 +1015,7 @@ void JitArm::twx(UGeckoInstruction inst)
SetJumpTarget(exit4); SetJumpTarget(exit4);
SetJumpTarget(exit5); SetJumpTarget(exit5);
if (!analyser.HasOption(PPCAnalyst::PPCAnalyser::OPTION_CONDITIONAL_CONTINUE)) if (!analyser.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE))
WriteExit(js.compilerPC + 4); WriteExit(js.compilerPC + 4);
gpr.Unlock(RA, RB); gpr.Unlock(RA, RB);

View File

@ -239,7 +239,7 @@ const u8* JitArmIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
// 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.
if (!memory_exception) if (!memory_exception)
nextPC = analyser.Analyse(em_address, &code_block, code_buf, blockSize); nextPC = analyser.Analyze(em_address, &code_block, code_buf, blockSize);
PPCAnalyst::CodeOp *ops = code_buf->codebuffer; PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
@ -265,7 +265,7 @@ const u8* JitArmIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
u64 codeHash = -1; u64 codeHash = -1;
{ {
// For profiling and IR Writer // For profiling and IR Writer
for (u32 i = 0; i < code_block.m_instructions; 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
@ -286,10 +286,10 @@ const u8* JitArmIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address); js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address);
js.skipnext = false; js.skipnext = false;
js.blockSize = code_block.m_instructions; js.blockSize = code_block.m_num_instructions;
js.compilerPC = nextPC; js.compilerPC = nextPC;
// Translate instructions // Translate instructions
for (u32 i = 0; i < code_block.m_instructions; 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];
@ -297,7 +297,7 @@ const u8* JitArmIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
const GekkoOPInfo *opinfo = ops[i].opinfo; const GekkoOPInfo *opinfo = ops[i].opinfo;
js.downcountAmount += opinfo->numCycles; js.downcountAmount += opinfo->numCycles;
if (i == (code_block.m_instructions - 1)) if (i == (code_block.m_num_instructions - 1))
{ {
// WARNING - cmp->branch merging will screw this up. // WARNING - cmp->branch merging will screw this up.
js.isLastInstruction = true; js.isLastInstruction = true;
@ -347,7 +347,7 @@ const u8* JitArmIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
WriteCode(nextPC); WriteCode(nextPC);
b->flags = js.block_flags; b->flags = js.block_flags;
b->codeSize = (u32)(GetCodePtr() - normalEntry); b->codeSize = (u32)(GetCodePtr() - normalEntry);
b->originalSize = code_block.m_instructions;; b->originalSize = code_block.m_num_instructions;;
FlushIcache(); FlushIcache();
return start; return start;

View File

@ -84,7 +84,7 @@ protected:
}; };
PPCAnalyst::CodeBlock code_block; PPCAnalyst::CodeBlock code_block;
PPCAnalyst::PPCAnalyser analyser; PPCAnalyst::PPCAnalyzer analyser;
public: public:
// This should probably be removed from public: // This should probably be removed from public:

View File

@ -311,7 +311,7 @@ u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa,
CodeOp *code = buffer->codebuffer; CodeOp *code = buffer->codebuffer;
bool foundExit = false; bool foundExit = false;
u32 returnAddress = 0; u32 return_address = 0;
// Do analysis of the code, look for dependencies etc // Do analysis of the code, look for dependencies etc
int numSystemInstructions = 0; int numSystemInstructions = 0;
@ -446,15 +446,15 @@ u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa,
} }
else if (inst.OPCD == 19 && inst.SUBOP10 == 16 && else if (inst.OPCD == 19 && inst.SUBOP10 == 16 &&
(inst.BO & (1 << 4)) && (inst.BO & (1 << 2)) && (inst.BO & (1 << 4)) && (inst.BO & (1 << 2)) &&
returnAddress != 0) return_address != 0)
{ {
// bclrx with unconditional branch = return // bclrx with unconditional branch = return
follow = true; follow = true;
destination = returnAddress; destination = return_address;
returnAddress = 0; return_address = 0;
if (inst.LK) if (inst.LK)
returnAddress = address + 4; return_address = address + 4;
} }
else if (inst.OPCD == 31 && inst.SUBOP10 == 467) else if (inst.OPCD == 31 && inst.SUBOP10 == 467)
{ {
@ -463,7 +463,7 @@ u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa,
if (index == SPR_LR) { if (index == SPR_LR) {
// We give up to follow the return address // We give up to follow the return address
// because we have to check the register usage. // because we have to check the register usage.
returnAddress = 0; return_address = 0;
} }
} }
@ -699,7 +699,7 @@ void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB *func_db)
leafSize, niceSize, unniceSize); leafSize, niceSize, unniceSize);
} }
void PPCAnalyser::ReorderInstructions(u32 instructions, CodeOp *code) void PPCAnalyzer::ReorderInstructions(u32 instructions, CodeOp *code)
{ {
// Instruction Reordering Pass // Instruction Reordering Pass
// Bubble down compares towards branches, so that they can be merged. // Bubble down compares towards branches, so that they can be merged.
@ -723,7 +723,7 @@ void PPCAnalyser::ReorderInstructions(u32 instructions, CodeOp *code)
} }
} }
void PPCAnalyser::SetInstructionStats(CodeBlock *block, CodeOp *code, GekkoOPInfo *opinfo, u32 index) void PPCAnalyzer::SetInstructionStats(CodeBlock *block, CodeOp *code, GekkoOPInfo *opinfo, u32 index)
{ {
code->wantsCR0 = false; code->wantsCR0 = false;
code->wantsCR1 = false; code->wantsCR1 = false;
@ -822,7 +822,7 @@ void PPCAnalyser::SetInstructionStats(CodeBlock *block, CodeOp *code, GekkoOPInf
} }
} }
u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize) u32 PPCAnalyzer::Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize)
{ {
// Clear block stats // Clear block stats
memset(block->m_stats, 0, sizeof(BlockStats)); memset(block->m_stats, 0, sizeof(BlockStats));
@ -839,12 +839,12 @@ u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
// Reset our block state // Reset our block state
block->m_broken = false; block->m_broken = false;
block->m_instructions = 0; block->m_num_instructions = 0;
CodeOp *code = buffer->codebuffer; CodeOp *code = buffer->codebuffer;
bool found_exit = false; bool found_exit = false;
u32 returnAddress = 0; u32 return_address = 0;
u32 numFollows = 0; u32 numFollows = 0;
u32 num_inst = 0; u32 num_inst = 0;
@ -888,15 +888,15 @@ u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
} }
else if (inst.OPCD == 19 && inst.SUBOP10 == 16 && else if (inst.OPCD == 19 && inst.SUBOP10 == 16 &&
(inst.BO & (1 << 4)) && (inst.BO & (1 << 2)) && (inst.BO & (1 << 4)) && (inst.BO & (1 << 2)) &&
returnAddress != 0) return_address != 0)
{ {
// bclrx with unconditional branch = return // bclrx with unconditional branch = return
follow = true; follow = true;
destination = returnAddress; destination = return_address;
returnAddress = 0; return_address = 0;
if (inst.LK) if (inst.LK)
returnAddress = address + 4; return_address = address + 4;
} }
else if (inst.OPCD == 31 && inst.SUBOP10 == 467) else if (inst.OPCD == 31 && inst.SUBOP10 == 467)
{ {
@ -905,7 +905,7 @@ u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
if (index == SPR_LR) { if (index == SPR_LR) {
// We give up to follow the return address // We give up to follow the return address
// because we have to check the register usage. // because we have to check the register usage.
returnAddress = 0; return_address = 0;
} }
} }
@ -978,8 +978,8 @@ u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
} }
} }
if (block->m_instructions > 1) if (block->m_num_instructions > 1)
ReorderInstructions(block->m_instructions, code); ReorderInstructions(block->m_num_instructions, code);
if ((!found_exit && num_inst > 0) || blockSize == 1) if ((!found_exit && num_inst > 0) || blockSize == 1)
{ {
@ -992,7 +992,7 @@ u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
bool wantsCR0 = true; bool wantsCR0 = true;
bool wantsCR1 = true; bool wantsCR1 = true;
bool wantsPS1 = true; bool wantsPS1 = true;
for (int i = block->m_instructions - 1; i >= 0; i--) for (int i = block->m_num_instructions - 1; i >= 0; i--)
{ {
if (code[i].outputCR0) if (code[i].outputCR0)
wantsCR0 = false; wantsCR0 = false;
@ -1007,7 +1007,7 @@ u32 PPCAnalyser::Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
code[i].wantsCR1 = wantsCR1; code[i].wantsCR1 = wantsCR1;
code[i].wantsPS1 = wantsPS1; code[i].wantsPS1 = wantsPS1;
} }
block->m_instructions = num_inst; block->m_num_instructions = num_inst;
return address; return address;
} }

View File

@ -114,7 +114,7 @@ struct CodeBlock
// Number of instructions // Number of instructions
// Gives us the size of the block. // Gives us the size of the block.
u32 m_instructions; u32 m_num_instructions;
// Some basic statistics about the block. // Some basic statistics about the block.
BlockStats *m_stats; BlockStats *m_stats;
@ -126,17 +126,16 @@ struct CodeBlock
bool m_broken; bool m_broken;
}; };
class PPCAnalyser class PPCAnalyzer
{ {
private: private:
void ReorderInstructions(u32 instructions, CodeOp *code); void ReorderInstructions(u32 instructions, CodeOp *code);
void SetInstructionStats(CodeBlock *block, CodeOp *code, GekkoOPInfo *opinfo, u32 index); void SetInstructionStats(CodeBlock *block, CodeOp *code, GekkoOPInfo *opinfo, u32 index);
// Options // Options
u32 m_options; u32 m_options;
public:
public:
enum AnalystOption enum AnalystOption
{ {
@ -166,14 +165,14 @@ class PPCAnalyser
}; };
PPCAnalyser() : m_options(0) {} PPCAnalyzer() : m_options(0) {}
// Option setting/getting // Option setting/getting
void SetOption(AnalystOption option) { m_options |= option; } void SetOption(AnalystOption option) { m_options |= option; }
void ClearOption(AnalystOption option) { m_options &= ~(option); } void ClearOption(AnalystOption option) { m_options &= ~(option); }
bool HasOption(AnalystOption option) { return !!(m_options & option); } bool HasOption(AnalystOption option) { return !!(m_options & option); }
u32 Analyse(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize); u32 Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize);
}; };
u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa,