[llvm-commits] [llvm] r156220 - /llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri May 4 15:53:29 PDT 2012
Author: stoklund
Date: Fri May 4 17:53:28 2012
New Revision: 156220
URL: http://llvm.org/viewvc/llvm-project?rev=156220&view=rev
Log:
Make sure findRepresentativeClass picks the widest super-register.
We want the representative register class to contain the largest
super-registers available. This makes the function less sensitive to the
register class numbering.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=156220&r1=156219&r2=156220&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri May 4 17:53:28 2012
@@ -719,18 +719,22 @@
return std::make_pair(RC, 0);
// Compute the set of all super-register classes.
- // Include direct sub-classes of RC in case there are no super-registers.
BitVector SuperRegRC(TRI->getNumRegClasses());
- for (SuperRegClassIterator RCI(RC, TRI, true); RCI.isValid(); ++RCI)
+ for (SuperRegClassIterator RCI(RC, TRI); RCI.isValid(); ++RCI)
SuperRegRC.setBitsInMask(RCI.getMask());
- // Find the first legal register class in the set.
+ // Find the first legal register class with the largest spill size.
+ const TargetRegisterClass *BestRC = RC;
for (int i = SuperRegRC.find_first(); i >= 0; i = SuperRegRC.find_next(i)) {
const TargetRegisterClass *SuperRC = TRI->getRegClass(i);
- if (isLegalRC(SuperRC))
- return std::make_pair(SuperRC, 1);
+ // We want the largest possible spill size.
+ if (SuperRC->getSize() <= BestRC->getSize())
+ continue;
+ if (!isLegalRC(SuperRC))
+ continue;
+ BestRC = SuperRC;
}
- llvm_unreachable("Inconsistent register class tables.");
+ return std::make_pair(BestRC, 1);
}
/// computeRegisterProperties - Once all of the register classes are added,
More information about the llvm-commits
mailing list