summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-03-05 19:33:24 +0000
committerJim Grosbach <grosbach@apple.com>2012-03-05 19:33:24 +0000
commit33ca87affb81b60c4d50214eb7458bd26d397d53 (patch)
tree6412b1a85492d01140df6a5e294deabae1146619
parentc6449b636f4984be88f128d0375c056ad05e7e8f (diff)
downloadllvm-33ca87affb81b60c4d50214eb7458bd26d397d53.tar.gz
llvm-33ca87affb81b60c4d50214eb7458bd26d397d53.tar.bz2
llvm-33ca87affb81b60c4d50214eb7458bd26d397d53.tar.xz
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.h10
-rw-r--r--include/llvm/Target/TargetRegisterInfo.h5
2 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h
index ddf355e4b4..2e5968de54 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 0cef3501fa..c6e308691d 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