PPCAnalyst: Convert #define into a constant
This commit is contained in:
parent
a947391556
commit
082275d785
|
@ -34,6 +34,8 @@ constexpr int CODEBUFFER_SIZE = 32000;
|
||||||
// 0 does not perform block merging
|
// 0 does not perform block merging
|
||||||
constexpr u32 FUNCTION_FOLLOWING_THRESHOLD = 16;
|
constexpr u32 FUNCTION_FOLLOWING_THRESHOLD = 16;
|
||||||
|
|
||||||
|
constexpr u32 INVALID_BRANCH_TARGET = 0xFFFFFFFF;
|
||||||
|
|
||||||
CodeBuffer::CodeBuffer(int size)
|
CodeBuffer::CodeBuffer(int size)
|
||||||
{
|
{
|
||||||
codebuffer = new PPCAnalyst::CodeOp[size];
|
codebuffer = new PPCAnalyst::CodeOp[size];
|
||||||
|
@ -45,8 +47,6 @@ CodeBuffer::~CodeBuffer()
|
||||||
delete[] codebuffer;
|
delete[] codebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INVALID_TARGET ((u32)-1)
|
|
||||||
|
|
||||||
static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc)
|
static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc)
|
||||||
{
|
{
|
||||||
switch (instr.OPCD)
|
switch (instr.OPCD)
|
||||||
|
@ -60,7 +60,7 @@ static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc)
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return INVALID_TARGET;
|
return INVALID_BRANCH_TARGET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u32 target = EvaluateBranchTarget(instr, addr);
|
u32 target = EvaluateBranchTarget(instr, addr);
|
||||||
if (target != INVALID_TARGET && instr.LK)
|
if (target != INVALID_BRANCH_TARGET && instr.LK)
|
||||||
{
|
{
|
||||||
// we found a branch-n-link!
|
// we found a branch-n-link!
|
||||||
func.calls.emplace_back(target, addr);
|
func.calls.emplace_back(target, addr);
|
||||||
|
|
Loading…
Reference in New Issue