RAGreedy: Keep track of allocated PhysRegs internally
[oota-llvm.git] / lib / CodeGen / LiveRegMatrix.cpp
index 154ce6fc122b89736b5b91d624d8e589cdb1db01..9ea031d38d29663ed9f1e48e8f6d926205ded3f6 100644 (file)
@@ -131,6 +131,14 @@ void LiveRegMatrix::unassign(LiveInterval &VirtReg) {
   DEBUG(dbgs() << '\n');
 }
 
+bool LiveRegMatrix::isPhysRegUsed(unsigned PhysReg) const {
+  for (MCRegUnitIterator Unit(PhysReg, TRI); Unit.isValid(); ++Unit) {
+    if (!Matrix[*Unit].empty())
+      return true;
+  }
+  return false;
+}
+
 bool LiveRegMatrix::checkRegMaskInterference(LiveInterval &VirtReg,
                                              unsigned PhysReg) {
   // Check if the cached information is valid.