Skip to content

Commit

Permalink
Merge pull request #2523 from lioncash/clean
Browse files Browse the repository at this point in the history
PPCAnalyst: Mark some functions as const.
  • Loading branch information
Tilka committed Jun 5, 2015
2 parents e70c9b4 + 6f3598e commit 01ec940
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Source/Core/Core/PowerPC/PPCAnalyst.h
Expand Up @@ -79,35 +79,39 @@ 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 numReads[reg] + numWrites[reg];
}

int GetUseRange(int reg) const
{
return std::max(lastRead[reg], lastWrite[reg]) -
std::min(firstRead[reg], firstWrite[reg]);
std::min(firstRead[reg], firstWrite[reg]);
}

bool IsUsed(int 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;
lastRead[reg] = opindex;
numReads[reg]++;
}

inline void SetOutputRegister(int reg, short opindex)
void SetOutputRegister(int reg, short opindex)
{
if (firstWrite[reg] == -1)
firstWrite[reg] = opindex;
lastWrite[reg] = opindex;
numWrites[reg]++;
}

inline void Clear()
void Clear()
{
for (int i = 0; i < 32; ++i)
{
Expand All @@ -122,7 +126,6 @@ struct BlockRegStats

class CodeBuffer
{
int size_;
public:
CodeBuffer(int size);
~CodeBuffer();
Expand All @@ -131,7 +134,8 @@ class CodeBuffer

PPCAnalyst::CodeOp *codebuffer;


private:
int size_;
};

struct CodeBlock
Expand Down Expand Up @@ -225,7 +229,7 @@ class PPCAnalyzer
// 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);
};
Expand Down

0 comments on commit 01ec940

Please sign in to comment.