diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-01 18:16:35 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-01 18:16:35 +0000 |
commit | 4b1212b4bfac98c688d484bf22ae158875f06ad5 (patch) | |
tree | 4a59460b707f300fa2404f64e4d13cd3ae9b1d82 /include | |
parent | b5372769eb3fa7ba682ea0c54ba3c0bcc8e7726e (diff) | |
download | external_llvm-4b1212b4bfac98c688d484bf22ae158875f06ad5.zip external_llvm-4b1212b4bfac98c688d484bf22ae158875f06ad5.tar.gz external_llvm-4b1212b4bfac98c688d484bf22ae158875f06ad5.tar.bz2 |
Move getSubRegIndex out of generated code into MCRegisterInfo, devirtualize it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/MC/MCRegisterInfo.h | 10 | ||||
-rw-r--r-- | include/llvm/Target/TargetRegisterInfo.h | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h index 2595e4f..4f081bf 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); } + /// 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. + unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const { + for (unsigned I = 1; I <= NumSubRegIndices; ++I) + if (getSubReg(RegNo, I) == SubRegNo) + return I; + return 0; + } + /// getSuperRegisters - Return the list of registers that are super-registers /// of the specified register, or a null list of there are none. The list /// returned is zero terminated and sorted according to super-sub register diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index 57553c6..2c59b7d 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -383,11 +383,6 @@ public: /// used by register scavenger to determine what registers are free. virtual BitVector getReservedRegs(const MachineFunction &MF) const = 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. - virtual unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const = 0; - /// 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, |