Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: src/IceTargetLowering.cpp

Issue 1676123002: Subzero: Use a proper RegNumT type instead of int32_t/SizeT. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make it possible to do "auto NewReg = RegNumT::NoRegister;" Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 75886d6dd8997693d240c6e878ec52f416402358..882b4ea93e6d9e977390205307cb530d69af027b 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -119,11 +119,11 @@ Variable *LoweringContext::availabilityGet(Operand *Src) const {
namespace {
void printRegisterSet(Ostream &Str, const llvm::SmallBitVector &Bitset,
- std::function<IceString(int32_t)> getRegName,
+ std::function<IceString(RegNumT)> getRegName,
const IceString &LineIndentString) {
constexpr size_t RegistersPerLine = 16;
size_t Count = 0;
- for (int i = Bitset.find_first(); i != -1; i = Bitset.find_next(i)) {
+ for (RegNumT RegNum : RegNumBVIter(Bitset)) {
if (Count == 0) {
Str << LineIndentString;
} else {
@@ -132,7 +132,7 @@ void printRegisterSet(Ostream &Str, const llvm::SmallBitVector &Bitset,
if (Count > 0 && Count % RegistersPerLine == 0)
Str << "\n" << LineIndentString;
++Count;
- Str << getRegName(i);
+ Str << getRegName(RegNum);
}
if (Count)
Str << "\n";
@@ -159,16 +159,18 @@ void splitToClassAndName(const IceString &RegName, IceString *SplitRegClass,
void TargetLowering::filterTypeToRegisterSet(
GlobalContext *Ctx, int32_t NumRegs,
llvm::SmallBitVector TypeToRegisterSet[], size_t TypeToRegisterSetSize,
- std::function<IceString(int32_t)> getRegName,
+ std::function<IceString(RegNumT)> getRegName,
std::function<IceString(RegClass)> getRegClassName) {
std::vector<llvm::SmallBitVector> UseSet(TypeToRegisterSetSize,
llvm::SmallBitVector(NumRegs));
std::vector<llvm::SmallBitVector> ExcludeSet(TypeToRegisterSetSize,
llvm::SmallBitVector(NumRegs));
- std::unordered_map<IceString, int32_t> RegNameToIndex;
- for (int32_t RegIndex = 0; RegIndex < NumRegs; ++RegIndex)
- RegNameToIndex[getRegName(RegIndex)] = RegIndex;
+ std::unordered_map<IceString, RegNumT> RegNameToIndex;
+ for (int32_t RegIndex = 0; RegIndex < NumRegs; ++RegIndex) {
+ const auto RegNum = RegNumT::fromInt(RegIndex);
+ RegNameToIndex[getRegName(RegNum)] = RegNum;
+ }
ClFlags::StringVector BadRegNames;
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698