Add TargetRegisterInfo::hasRegUnit().
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 2 Aug 2012 14:45:53 +0000 (14:45 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 2 Aug 2012 14:45:53 +0000 (14:45 +0000)
This trivial helper function tests if a register contains a register
unit. It is similar to regsOverlap(), but with asymmetric arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161180 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetRegisterInfo.h

index a70b8f6cbdb424d28d47cc0dd9afebb5200ac21d..df4d900e4c8e912a5e3214cffaba1981a8db5ba7 100644 (file)
@@ -349,6 +349,14 @@ public:
     return false;
   }
 
+  /// hasRegUnit - Returns true if Reg contains RegUnit.
+  bool hasRegUnit(unsigned Reg, unsigned RegUnit) const {
+    for (MCRegUnitIterator Units(Reg, this); Units.isValid(); ++Units)
+      if (*Units == RegUnit)
+        return true;
+    return false;
+  }
+
   /// isSubRegister - Returns true if regB is a sub-register of regA.
   ///
   bool isSubRegister(unsigned regA, unsigned regB) const {