From 293c3bae6fa9fd578d62284c74fd208ffc6250f5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Jun 2015 19:11:27 -0400 Subject: [PATCH 1/2] PPCAnalyst: Mark some functions as const Also removes the redundant inline specifier, as functions defined in a class/struct definition are inline by default. --- Source/Core/Core/PowerPC/PPCAnalyst.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h index 0991cfad13..9c11fc4ff6 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/PowerPC/PPCAnalyst.h @@ -79,19 +79,23 @@ struct BlockRegStats bool any; bool anyTimer; - int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];} - int GetUseRange(int reg) + int GetTotalNumAccesses(int reg) const { - return std::max(lastRead[reg], lastWrite[reg]) - - std::min(firstRead[reg], firstWrite[reg]); + return numReads[reg] + numWrites[reg]; } - bool IsUsed(int reg) + int GetUseRange(int reg) const + { + return std::max(lastRead[reg], lastWrite[reg]) - + std::min(firstRead[reg], firstWrite[reg]); + } + + bool IsUsed(int reg) const { return (numReads[reg] + numWrites[reg]) > 0; } - inline void SetInputRegister(int reg, short opindex) + void SetInputRegister(int reg, short opindex) { if (firstRead[reg] == -1) firstRead[reg] = opindex; @@ -99,7 +103,7 @@ struct BlockRegStats numReads[reg]++; } - inline void SetOutputRegister(int reg, short opindex) + void SetOutputRegister(int reg, short opindex) { if (firstWrite[reg] == -1) firstWrite[reg] = opindex; @@ -107,7 +111,7 @@ struct BlockRegStats numWrites[reg]++; } - inline void Clear() + void Clear() { for (int i = 0; i < 32; ++i) { @@ -225,7 +229,7 @@ public: // Option setting/getting void SetOption(AnalystOption option) { m_options |= option; } void ClearOption(AnalystOption option) { m_options &= ~(option); } - bool HasOption(AnalystOption option) { return !!(m_options & option); } + bool HasOption(AnalystOption option) const { return !!(m_options & option); } u32 Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize); }; From 6f3598eee46e246fe06e7a1236bdbc9380cdfd59 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Jun 2015 19:13:29 -0400 Subject: [PATCH 2/2] PPCAnalyst: Remove extra whitespace from CodeBuffer --- Source/Core/Core/PowerPC/PPCAnalyst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h index 9c11fc4ff6..116a7541aa 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/PowerPC/PPCAnalyst.h @@ -126,7 +126,6 @@ struct BlockRegStats class CodeBuffer { - int size_; public: CodeBuffer(int size); ~CodeBuffer(); @@ -135,7 +134,8 @@ public: PPCAnalyst::CodeOp *codebuffer; - +private: + int size_; }; struct CodeBlock