[llvm] r265764 - [TargetRegisterInfo] Re-apply r265734.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 17:51:00 PDT 2016
Author: qcolombet
Date: Thu Apr 7 19:51:00 2016
New Revision: 265764
URL: http://llvm.org/viewvc/llvm-project?rev=265764&view=rev
Log:
[TargetRegisterInfo] Re-apply r265734.
Original commit message:
[TargetRegisterInfo] Refactor the code to use BitMaskClassIterator.
Modified:
llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp
Modified: llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp?rev=265764&r1=265763&r2=265764&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetRegisterInfo.cpp Thu Apr 7 19:51:00 2016
@@ -112,18 +112,11 @@ TargetRegisterInfo::getAllocatableClass(
if (!RC || RC->isAllocatable())
return RC;
- const unsigned *SubClass = RC->getSubClassMask();
- for (unsigned Base = 0, BaseE = getNumRegClasses();
- Base < BaseE; Base += 32) {
- unsigned Idx = Base;
- for (unsigned Mask = *SubClass++; Mask; Mask >>= 1) {
- unsigned Offset = countTrailingZeros(Mask);
- const TargetRegisterClass *SubRC = getRegClass(Idx + Offset);
- if (SubRC->isAllocatable())
- return SubRC;
- Mask >>= Offset;
- Idx += Offset + 1;
- }
+ for (BitMaskClassIterator It(RC->getSubClassMask(), *this); It.isValid();
+ ++It) {
+ const TargetRegisterClass *SubRC = getRegClass(It.getID());
+ if (SubRC->isAllocatable())
+ return SubRC;
}
return nullptr;
}
More information about the llvm-commits
mailing list