summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2017-01-17 11:52:44 +1300
committerGitHub <noreply@github.com>2017-01-17 11:52:44 +1300
commit53bfab057cc4633562cb05282e3390be564f3b92 (patch)
treed9938cf437b551b51e5178714a4d33e1972957cb /Source/Core
parent8153772bfec3c8a35e9d6d701cefd3ee816ba08d (diff)
parent43910e474b14c2b93ea37434a47e17fd4370960f (diff)
Merge pull request #4666 from lioncash/jitil-ir
IR_X86: Minor changes to RegInfo
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp
index 83eb202eb2..a9107b1e81 100644
--- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp
+++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp
@@ -26,6 +26,8 @@ The register allocation is linear scan allocation.
#endif
#include <algorithm>
+#include <array>
+#include <cstddef>
#include <vector>
#include "Common/BitSet.h"
@@ -33,6 +35,7 @@ The register allocation is linear scan allocation.
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
#include "Common/MsgHandler.h"
+#include "Common/NonCopyable.h"
#include "Common/x64ABI.h"
#include "Common/x64Emitter.h"
#include "Core/CoreTiming.h"
@@ -46,12 +49,12 @@ The register allocation is linear scan allocation.
using namespace IREmitter;
using namespace Gen;
-static const unsigned int MAX_NUMBER_OF_REGS = 16;
-
-struct RegInfo
+struct RegInfo final : private NonCopyable
{
+ static constexpr size_t MAX_NUMBER_OF_REGS = 16;
+
JitIL* Jit;
- IRBuilder* Build;
+ IRBuilder* Build = nullptr;
InstLoc FirstI;
// IInfo contains (per instruction)
@@ -63,31 +66,24 @@ struct RegInfo
// and if we can clobber the operands registers.
// Warning, Memory instruction use these bits slightly differently.
// Bits 15-31: Spill location
- std::vector<unsigned> IInfo;
+ std::vector<u32> IInfo;
// The last instruction which uses the result of this instruction. Used by the register allocator.
std::vector<InstLoc> lastUsed;
- InstLoc regs[MAX_NUMBER_OF_REGS];
- InstLoc fregs[MAX_NUMBER_OF_REGS];
- unsigned numSpills;
- unsigned numFSpills;
- unsigned exitNumber;
-
- RegInfo(JitIL* j, InstLoc f, unsigned insts)
- : Jit(j), Build(nullptr), FirstI(f), IInfo(insts), lastUsed(insts), regs(), fregs(),
- numSpills(0), numFSpills(0), exitNumber(0)
- {
- }
+ std::array<InstLoc, MAX_NUMBER_OF_REGS> regs{};
+ std::array<InstLoc, MAX_NUMBER_OF_REGS> fregs{};
+ u32 numSpills = 0;
+ u32 numFSpills = 0;
+ u32 exitNumber = 0;
-private:
- RegInfo(RegInfo&); // DO NOT IMPLEMENT
+ RegInfo(JitIL* j, InstLoc f, u32 insts) : Jit(j), FirstI(f), IInfo(insts), lastUsed(insts) {}
};
static BitSet32 regsInUse(RegInfo& R)
{
BitSet32 result;
- for (unsigned i = 0; i < MAX_NUMBER_OF_REGS; i++)
+ for (size_t i = 0; i < RegInfo::MAX_NUMBER_OF_REGS; i++)
{
if (R.regs[i] != nullptr)
result[i] = true;
@@ -2330,7 +2326,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress)
}
}
- for (unsigned i = 0; i < MAX_NUMBER_OF_REGS; i++)
+ for (size_t i = 0; i < RegInfo::MAX_NUMBER_OF_REGS; i++)
{
if (RI.regs[i])
{