improve "cannot yet select" errors a trivial amount: now
[oota-llvm.git] / lib / CodeGen / CalcSpillWeights.cpp
index a39503ba2eef65f19359295b961141857176448e..5ace76c393ef8d91116f368588557fc9467608cd 100644 (file)
 using namespace llvm;
 
 char CalculateSpillWeights::ID = 0;
-INITIALIZE_PASS(CalculateSpillWeights, "calcspillweights",
-                "Calculate spill weights", false, false);
+INITIALIZE_PASS_BEGIN(CalculateSpillWeights, "calcspillweights",
+                "Calculate spill weights", false, false)
+INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
+INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
+INITIALIZE_PASS_END(CalculateSpillWeights, "calcspillweights",
+                "Calculate spill weights", false, false)
 
 void CalculateSpillWeights::getAnalysisUsage(AnalysisUsage &au) const {
   au.addRequired<LiveIntervals>();
@@ -181,10 +185,19 @@ void VirtRegAuxInfo::CalculateRegClass(unsigned reg) {
   SmallPtrSet<const TargetRegisterClass*,8> rcs;
 
   for (MachineRegisterInfo::reg_nodbg_iterator I = mri.reg_nodbg_begin(reg),
-       E = mri.reg_nodbg_end(); I != E; ++I)
+       E = mri.reg_nodbg_end(); I != E; ++I) {
+    // The targets don't have accurate enough regclass descriptions that we can
+    // handle subregs. We need something similar to
+    // TRI::getMatchingSuperRegClass, but returning a super class instead of a
+    // sub class.
+    if (I.getOperand().getSubReg()) {
+      DEBUG(dbgs() << "Cannot handle subregs: " << I.getOperand() << '\n');
+      return;
+    }
     if (const TargetRegisterClass *rc =
                                 I->getDesc().getRegClass(I.getOperandNo(), tri))
       rcs.insert(rc);
+  }
 
   // If we found no regclass constraints, just leave reg as is.
   // In theory, we could inflate to the largest superclass of reg's existing
@@ -192,8 +205,6 @@ void VirtRegAuxInfo::CalculateRegClass(unsigned reg) {
   // This could happen if reg is only used by COPY instructions, so we may need
   // to improve on this.
   if (rcs.empty()) {
-    DEBUG(dbgs() << "Not inflating unconstrained" << orc->getName() << ":%reg"
-                 << reg << ".\n");
     return;
   }