From bc7374a5e175caaefef0266b5642670594c6b82e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 16 Jan 2017 15:55:14 -0500 Subject: [PATCH] IR_X86: Use std::array instead of raw C arrays in RegInfo --- Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp index 0f95449d9d..9427ebf78e 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 +#include +#include #include #include "Common/BitSet.h" @@ -47,10 +49,10 @@ The register allocation is linear scan allocation. using namespace IREmitter; using namespace Gen; -static const unsigned int MAX_NUMBER_OF_REGS = 16; - struct RegInfo final : private NonCopyable { + static constexpr size_t MAX_NUMBER_OF_REGS = 16; + JitIL* Jit; IRBuilder* Build; InstLoc FirstI; @@ -69,8 +71,8 @@ struct RegInfo final : private NonCopyable // The last instruction which uses the result of this instruction. Used by the register allocator. std::vector lastUsed; - InstLoc regs[MAX_NUMBER_OF_REGS]; - InstLoc fregs[MAX_NUMBER_OF_REGS]; + std::array regs; + std::array fregs; unsigned numSpills; unsigned numFSpills; unsigned exitNumber; @@ -85,7 +87,7 @@ struct RegInfo final : private NonCopyable 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; @@ -2328,7 +2330,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]) {