[llvm-commits] [llvm] r170609 - /llvm/trunk/include/llvm/MC/MCRegisterInfo.h

Jim Grosbach grosbach at apple.com
Wed Dec 19 15:38:49 PST 2012


Author: grosbach
Date: Wed Dec 19 17:38:49 2012
New Revision: 170609

URL: http://llvm.org/viewvc/llvm-project?rev=170609&view=rev
Log:
Add isSubRegisterEq() and isSuperRegisterEq().

isSub and isSuper return false if RegA == RegB. Add variants which also
include the identity function.

Modified:
    llvm/trunk/include/llvm/MC/MCRegisterInfo.h

Modified: llvm/trunk/include/llvm/MC/MCRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCRegisterInfo.h?rev=170609&r1=170608&r2=170609&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCRegisterInfo.h Wed Dec 19 17:38:49 2012
@@ -386,14 +386,24 @@
     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 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.
+  /// Returns true if RegB is a super-register of RegA.
   bool isSuperRegister(unsigned RegA, unsigned RegB) const;
 
+  /// Returns true if RegB is a sub-register of RegA or if RegB == RegA.
+  bool isSubRegisterEq(unsigned RegA, unsigned RegB) const {
+    return isSuperRegisterEq(RegB, RegA);
+  }
+
+  /// Returns true if RegB is a super-register of RegA or if RegB == RegA.
+  bool isSuperRegisterEq(unsigned RegA, unsigned RegB) const {
+    return RegA == RegB || isSuperRegister(RegA, RegB);
+  }
+
 };
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list