Move isSubRegister() and isSuperRegister to MCRegisterInfo.
authorJim Grosbach <grosbach@apple.com>
Wed, 19 Dec 2012 23:38:46 +0000 (23:38 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 19 Dec 2012 23:38:46 +0000 (23:38 +0000)
These were defined on TargetRegisterInfo, but they don't use any information
that's not available in MCRegisterInfo, so sink them down to be available
at the MC layer.

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

include/llvm/MC/MCRegisterInfo.h
include/llvm/Target/TargetRegisterInfo.h

index 7118127e5f914206f51692ce03309db074319469..9310b466f41129207af080eebc883d36b77cd70f 100644 (file)
@@ -386,6 +386,14 @@ public:
     return RegEncodingTable[RegNo];
   }
 
+  /// Returns true if regB is a sub-register of regA.
+  bool isSubRegister(unsigned regA, unsigned regB) const {
+    return isSuperRegister(regB, regA);
+  }
+
+  /// Returns true if regB is a super-register of regA.
+  bool isSuperRegister(unsigned RegA, unsigned RegB) const;
+
 };
 
 //===----------------------------------------------------------------------===//
@@ -426,6 +434,15 @@ public:
   }
 };
 
+// Definition for isSuperRegister. Put it down here since it needs the
+// iterator defined above in addition to the MCRegisterInfo class itself.
+inline bool MCRegisterInfo::isSuperRegister(unsigned RegA, unsigned RegB) const{
+  for (MCSuperRegIterator I(RegA, this); I.isValid(); ++I)
+    if (*I == RegB)
+      return true;
+  return false;
+}
+
 //===----------------------------------------------------------------------===//
 //                               Register Units
 //===----------------------------------------------------------------------===//
index 40a7505f678d03822790feab3be2af35436c5fdc..1ccbc216d8167dba3c9d6b85f1c6240c51a828eb 100644 (file)
@@ -388,21 +388,6 @@ public:
     return false;
   }
 
-  /// isSubRegister - Returns true if regB is a sub-register of regA.
-  ///
-  bool isSubRegister(unsigned regA, unsigned regB) const {
-    return isSuperRegister(regB, regA);
-  }
-
-  /// isSuperRegister - Returns true if regB is a super-register of regA.
-  ///
-  bool isSuperRegister(unsigned RegA, unsigned RegB) const {
-    for (MCSuperRegIterator I(RegA, this); I.isValid(); ++I)
-      if (*I == RegB)
-        return true;
-    return false;
-  }
-
   /// getCalleeSavedRegs - Return a null-terminated list of all of the
   /// callee saved registers on this target. The register should be in the
   /// order of desired callee-save stack frame offset. The first register is