LiveIntervals: Add removeAllRegUnitsForPhysReg
Convenience wrapper for removing the reg units of
a physical register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354685 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/CodeGen/LiveIntervals.h b/include/llvm/CodeGen/LiveIntervals.h
index d0791be..588b0f9 100644
--- a/include/llvm/CodeGen/LiveIntervals.h
+++ b/include/llvm/CodeGen/LiveIntervals.h
@@ -417,6 +417,15 @@
RegUnitRanges[Unit] = nullptr;
}
+ /// Remove associated live ranges for the register units associated with \p
+ /// Reg. Subsequent uses should rely on on-demand recomputation. \note This
+ /// method can result in inconsistent liveness tracking if multiple phyical
+ /// registers share a regunit, and should be used cautiously.
+ void removeAllRegUnitsForPhysReg(unsigned Reg) {
+ for (MCRegUnitIterator Units(Reg, TRI); Units.isValid(); ++Units)
+ removeRegUnit(*Units);
+ }
+
/// Remove value numbers and related live segments starting at position
/// \p Pos that are part of any liverange of physical register \p Reg or one
/// of its subregisters.