diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-03-05 19:33:24 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-03-05 19:33:24 +0000 |
commit | 33ca87affb81b60c4d50214eb7458bd26d397d53 (patch) | |
tree | 6412b1a85492d01140df6a5e294deabae1146619 | |
parent | c6449b636f4984be88f128d0375c056ad05e7e8f (diff) | |
download | external_llvm-33ca87affb81b60c4d50214eb7458bd26d397d53.zip external_llvm-33ca87affb81b60c4d50214eb7458bd26d397d53.tar.gz external_llvm-33ca87affb81b60c4d50214eb7458bd26d397d53.tar.bz2 |
MCRegisterInfo-ize getMatchingSuperReg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152044 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCRegisterInfo.h | 10 | ||||
-rw-r--r-- | include/llvm/Target/TargetRegisterInfo.h | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h index ddf355e..2e5968d 100644 --- a/include/llvm/MC/MCRegisterInfo.h +++ b/include/llvm/MC/MCRegisterInfo.h @@ -248,6 +248,16 @@ public: return *(SubRegIndices + (Reg - 1) * NumSubRegIndices + Idx - 1); } + /// getMatchingSuperReg - Return a super-register of the specified register + /// Reg so its sub-register of index SubIdx is Reg. + unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx, + const MCRegisterClass *RC) const { + for (const unsigned *SRs = getSuperRegisters(Reg); unsigned SR = *SRs;++SRs) + if (Reg == getSubReg(SR, SubIdx) && RC->contains(SR)) + return SR; + return 0; + } + /// getSubRegIndex - For a given register pair, return the sub-register index /// if the second register is a sub-register of the first. Return zero /// otherwise. diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index 0cef350..c6e3086 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -387,10 +387,7 @@ public: /// Reg so its sub-register of index SubIdx is Reg. unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx, const TargetRegisterClass *RC) const { - for (const uint16_t *SRs = getSuperRegisters(Reg); unsigned SR = *SRs;++SRs) - if (Reg == getSubReg(SR, SubIdx) && RC->contains(SR)) - return SR; - return 0; + return MCRegisterInfo::getMatchingSuperReg(Reg, SubIdx, RC->MC); } /// canCombineSubRegIndices - Given a register class and a list of |