diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-03-01 17:30:39 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-03-01 17:30:39 +0000 |
commit | b3acdcc00c9dfb01663780e858e586cc5f04423f (patch) | |
tree | 3e599f9e2ce9387b4ca051dc16aa85fdc882f07d /include/llvm/MC | |
parent | 194f3fa9eadc7dfe9f1750c16e1c2a8ebe11c88c (diff) | |
download | external_llvm-b3acdcc00c9dfb01663780e858e586cc5f04423f.zip external_llvm-b3acdcc00c9dfb01663780e858e586cc5f04423f.tar.gz external_llvm-b3acdcc00c9dfb01663780e858e586cc5f04423f.tar.bz2 |
Move TargetRegisterInfo::getSubReg() to MCRegisterInfo.
Allows us to de-virtualize the function and provides access to it in
the instruction printer, which is useful for handling composite
physical registers (e.g., ARM register lists).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC')
-rw-r--r-- | include/llvm/MC/MCRegisterInfo.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h index b1f4942..2595e4f 100644 --- a/include/llvm/MC/MCRegisterInfo.h +++ b/include/llvm/MC/MCRegisterInfo.h @@ -136,6 +136,9 @@ private: const unsigned *Overlaps; // Pointer to the overlaps array const unsigned *SubRegs; // Pointer to the subregs array const unsigned *SuperRegs; // Pointer to the superregs array + const unsigned short *SubRegIndices; // Pointer to the subreg lookup + // array. + unsigned NumSubRegIndices; // Number of subreg indices. DenseMap<unsigned, int> L2DwarfRegs; // LLVM to Dwarf regs mapping DenseMap<unsigned, int> EHL2DwarfRegs; // LLVM to Dwarf regs mapping EH DenseMap<unsigned, unsigned> Dwarf2LRegs; // Dwarf to LLVM regs mapping @@ -148,7 +151,9 @@ public: void InitMCRegisterInfo(const MCRegisterDesc *D, unsigned NR, unsigned RA, const MCRegisterClass *C, unsigned NC, const unsigned *O, const unsigned *Sub, - const unsigned *Super) { + const unsigned *Super, + const unsigned short *SubIndices, + unsigned NumIndices) { Desc = D; NumRegs = NR; RAReg = RA; @@ -157,6 +162,8 @@ public: SubRegs = Sub; SuperRegs = Super; NumClasses = NC; + SubRegIndices = SubIndices; + NumSubRegIndices = NumIndices; } /// mapLLVMRegToDwarfReg - Used to initialize LLVM register to Dwarf @@ -234,6 +241,13 @@ public: return SubRegs + get(RegNo).SubRegs; } + /// getSubReg - Returns the physical register number of sub-register "Index" + /// for physical register RegNo. Return zero if the sub-register does not + /// exist. + unsigned getSubReg(unsigned Reg, unsigned Idx) const { + return *(SubRegIndices + (Reg - 1) * NumSubRegIndices + Idx - 1); + } + /// 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 |