[llvm] r252671 - TableGen: Emit LaneMask for register classes without subregisters as ~0u
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 15:23:06 PST 2015
Author: matze
Date: Tue Nov 10 17:23:05 2015
New Revision: 252671
URL: http://llvm.org/viewvc/llvm-project?rev=252671&view=rev
Log:
TableGen: Emit LaneMask for register classes without subregisters as ~0u
This makes it slightly easier to handle classes with and without
subregister uniformly.
Modified:
llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=252671&r1=252670&r2=252671&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Tue Nov 10 17:23:05 2015
@@ -2975,22 +2975,25 @@ bool RegisterCoalescer::runOnMachineFunc
if (MRI->recomputeRegClass(Reg)) {
DEBUG(dbgs() << PrintReg(Reg) << " inflated to "
<< TRI->getRegClassName(MRI->getRegClass(Reg)) << '\n');
+ ++NumInflated;
+
LiveInterval &LI = LIS->getInterval(Reg);
- LaneBitmask MaxMask = MRI->getMaxLaneMaskForVReg(Reg);
- if (MaxMask == 0) {
+ if (LI.hasSubRanges()) {
// If the inflated register class does not support subregisters anymore
// remove the subranges.
- LI.clearSubRanges();
- } else {
+ if (!MRI->shouldTrackSubRegLiveness(Reg)) {
+ LI.clearSubRanges();
+ } else {
#ifndef NDEBUG
- // If subranges are still supported, then the same subregs should still
- // be supported.
- for (LiveInterval::SubRange &S : LI.subranges()) {
- assert ((S.LaneMask & ~MaxMask) == 0);
- }
+ LaneBitmask MaxMask = MRI->getMaxLaneMaskForVReg(Reg);
+ // If subranges are still supported, then the same subregs
+ // should still be supported.
+ for (LiveInterval::SubRange &S : LI.subranges()) {
+ assert((S.LaneMask & ~MaxMask) == 0);
+ }
#endif
+ }
}
- ++NumInflated;
}
}
Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.cpp?rev=252671&r1=252670&r2=252671&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenRegisters.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenRegisters.cpp Tue Nov 10 17:23:05 2015
@@ -1274,6 +1274,12 @@ void CodeGenRegBank::computeSubRegLaneMa
continue;
LaneMask |= SubRegIndex.LaneMask;
}
+
+ // For classes without any subregisters set LaneMask to ~0u instead of 0.
+ // This makes it easier for client code to handle classes uniformly.
+ if (LaneMask == 0)
+ LaneMask = ~0u;
+
RegClass.LaneMask = LaneMask;
}
}
More information about the llvm-commits
mailing list