diff options
| author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-05-31 17:08:36 +0000 |
|---|---|---|
| committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-05-31 17:08:36 +0000 |
| commit | f1ed334d552a5e1dc608cdff4ad9319acac76520 (patch) | |
| tree | a6ace57d7ad51583a4a4976656d14e789d5b0621 /llvm/lib/MC | |
| parent | 4d5bae167976f5b66443f991e5975a53d8e47bc7 (diff) | |
| download | bcm5719-llvm-f1ed334d552a5e1dc608cdff4ad9319acac76520.tar.gz bcm5719-llvm-f1ed334d552a5e1dc608cdff4ad9319acac76520.zip | |
Add a way to define the bit range covered by a SubRegIndex.
NOTE: If this broke your out-of-tree backend, in *RegisterInfo.td, change
the instances of SubRegIndex that have a comps template arg to use the
ComposedSubRegIndex class instead.
In TableGen land, this adds Size and Offset attributes to SubRegIndex,
and the ComposedSubRegIndex class, for which the Size and Offset are
computed by TableGen. This also adds an accessor in MCRegisterInfo, and
Size/Offsets for the X86 and ARM subreg indices.
llvm-svn: 183020
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/MCRegisterInfo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCRegisterInfo.cpp b/llvm/lib/MC/MCRegisterInfo.cpp index 5c71106c901..06d6d9680dd 100644 --- a/llvm/lib/MC/MCRegisterInfo.cpp +++ b/llvm/lib/MC/MCRegisterInfo.cpp @@ -46,6 +46,19 @@ unsigned MCRegisterInfo::getSubRegIndex(unsigned Reg, unsigned SubReg) const { return 0; } +bool MCRegisterInfo::getSubRegIdxCoveredBits(unsigned Idx, unsigned &Offset, + unsigned &Size) const { + assert(Idx && Idx < getNumSubRegIndices() && + "This is not a subregister index"); + // Get a pointer to the corresponding SubRegIdxRanges struct. + const SubRegCoveredBits *Bits = &SubRegIdxRanges[Idx]; + if (Bits->Offset == (uint16_t)-1 || Bits->Size == (uint16_t)-1) + return false; + Offset = Bits->Offset; + Size = Bits->Size; + return true; +} + int MCRegisterInfo::getDwarfRegNum(unsigned RegNum, bool isEH) const { const DwarfLLVMRegPair *M = isEH ? EHL2DwarfRegs : L2DwarfRegs; unsigned Size = isEH ? EHL2DwarfRegsSize : L2DwarfRegsSize; |

