IR: Use std::array instead of raw C arrays

This commit is contained in:
Lioncash 2017-01-16 18:45:26 -05:00
parent ef3e6de875
commit a8b2dd7fc3
2 changed files with 14 additions and 18 deletions

View File

@ -149,22 +149,17 @@ void IRBuilder::Reset()
MarkUsed.clear(); MarkUsed.clear();
MarkUsed.reserve(100000); MarkUsed.reserve(100000);
for (unsigned i = 0; i < 32; i++) GRegCache = {};
{ GRegCacheStore = {};
GRegCache[i] = nullptr;
GRegCacheStore[i] = nullptr; FRegCache = {};
FRegCache[i] = nullptr; FRegCacheStore = {};
FRegCacheStore[i] = nullptr;
}
CarryCache = nullptr; CarryCache = nullptr;
CarryCacheStore = nullptr; CarryCacheStore = nullptr;
for (unsigned i = 0; i < 8; i++) CRCache = {};
{ CRCacheStore = {};
CRCache[i] = nullptr;
CRCacheStore[i] = nullptr;
}
CTRCache = nullptr; CTRCache = nullptr;
CTRCacheStore = nullptr; CTRCacheStore = nullptr;

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <array>
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -427,15 +428,15 @@ private:
std::vector<bool> MarkUsed; // Used for IRWriter std::vector<bool> MarkUsed; // Used for IRWriter
std::vector<u64> ConstList; std::vector<u64> ConstList;
InstLoc curReadPtr; InstLoc curReadPtr;
InstLoc GRegCache[32]; std::array<InstLoc, 32> GRegCache;
InstLoc GRegCacheStore[32]; std::array<InstLoc, 32> GRegCacheStore;
InstLoc FRegCache[32]; std::array<InstLoc, 32> FRegCache;
InstLoc FRegCacheStore[32]; std::array<InstLoc, 32> FRegCacheStore;
InstLoc CarryCache; InstLoc CarryCache;
InstLoc CarryCacheStore; InstLoc CarryCacheStore;
InstLoc CTRCache; InstLoc CTRCache;
InstLoc CTRCacheStore; InstLoc CTRCacheStore;
InstLoc CRCache[8]; std::array<InstLoc, 8> CRCache;
InstLoc CRCacheStore[8]; std::array<InstLoc, 8> CRCacheStore;
}; };
}; };