[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp

Alkis Evlogimenos alkis at niobe.cs.uiuc.edu
Wed Feb 18 17:19:05 PST 2004


Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.48 -> 1.49

---
Log message:

Implement assignment correctness verification.


---
Diffs of the changes:  (+15 -0)

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.48 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.49
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.48	Sun Feb 15 04:24:21 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Wed Feb 18 17:15:23 2004
@@ -206,6 +206,19 @@
                 std::cerr << mri_->getName(reg) << '\n';
             }
         }
+
+        void verifyAssignment() const {
+            for (Virt2PhysMap::const_iterator i = v2pMap_.begin(),
+                     e = v2pMap_.end(); i != e; ++i)
+                for (Virt2PhysMap::const_iterator i2 = i; i2 != e; ++i2)
+                    if (mri_->areAliases(i->second, i2->second)) {
+                        const LiveIntervals::Interval
+                            &in = li_->getInterval(i->second),
+                            &in2 = li_->getInterval(i2->second);
+                        assert(!in.overlaps(in2) &&
+                               "overlapping intervals for same register!");
+                    }
+        }
     };
 }
 
@@ -290,6 +303,8 @@
 
     DEBUG(printVirtRegAssignment());
     DEBUG(std::cerr << "finished register allocation\n");
+    // this is a slow operations do not uncomment
+    // DEBUG(verifyAssignment());
 
     const TargetInstrInfo& tii = tm_->getInstrInfo();
 





More information about the llvm-commits mailing list