diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-12-19 23:38:49 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-12-19 23:38:49 +0000 |
commit | 16f3204b95c952a70c9d2aa3b423162215beb6ae (patch) | |
tree | af697bc9f3aa9e28a21a8ff07f01d17f551c90df | |
parent | e188fb7dd91c6fee15aa18c877d664d63d736000 (diff) |
Add isSubRegisterEq() and isSuperRegisterEq().
isSub and isSuper return false if RegA == RegB. Add variants which also
include the identity function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170609 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCRegisterInfo.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h index 9310b466f4..c793533fab 100644 --- a/include/llvm/MC/MCRegisterInfo.h +++ b/include/llvm/MC/MCRegisterInfo.h @@ -386,14 +386,24 @@ 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 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); + } + }; //===----------------------------------------------------------------------===// |