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 | bed23081860275c79137f65d592920e7991b8198 (patch) | |
tree | d06c6135d2f04c21d9551cf53d867de0cc7d4ce5 /include/llvm/MC/MCRegisterInfo.h | |
parent | 9c8e1f93b419299aa9a416ada3b7190ce4a1f1b6 (diff) | |
download | external_llvm-bed23081860275c79137f65d592920e7991b8198.zip external_llvm-bed23081860275c79137f65d592920e7991b8198.tar.gz external_llvm-bed23081860275c79137f65d592920e7991b8198.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCRegisterInfo.h')
-rw-r--r-- | include/llvm/MC/MCRegisterInfo.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h index 0c4a53f..002f71d 100644 --- a/include/llvm/MC/MCRegisterInfo.h +++ b/include/llvm/MC/MCRegisterInfo.h @@ -144,6 +144,13 @@ public: bool operator<(DwarfLLVMRegPair RHS) const { return FromReg < RHS.FromReg; } }; + + /// SubRegCoveredBits - Emitted by tablegen: bit range covered by a subreg + /// index, -1 in any being invalid. + struct SubRegCoveredBits { + uint16_t Offset; + uint16_t Size; + }; private: const MCRegisterDesc *Desc; // Pointer to the descriptor array unsigned NumRegs; // Number of entries in the array @@ -157,6 +164,8 @@ private: const char *RegStrings; // Pointer to the string table. const uint16_t *SubRegIndices; // Pointer to the subreg lookup // array. + const SubRegCoveredBits *SubRegIdxRanges; // Pointer to the subreg covered + // bit ranges array. unsigned NumSubRegIndices; // Number of subreg indices. const uint16_t *RegEncodingTable; // Pointer to array of register // encodings. @@ -236,6 +245,7 @@ public: const char *Strings, const uint16_t *SubIndices, unsigned NumIndices, + const SubRegCoveredBits *SubIdxRanges, const uint16_t *RET) { Desc = D; NumRegs = NR; @@ -249,6 +259,7 @@ public: NumRegUnits = NRU; SubRegIndices = SubIndices; NumSubRegIndices = NumIndices; + SubRegIdxRanges = SubIdxRanges; RegEncodingTable = RET; } @@ -327,6 +338,13 @@ public: /// otherwise. unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const; + /// \brief Get the bit range covered by a given sub-register index. + /// In some cases, for instance non-contiguous synthesized indices, + /// there is no meaningful bit range to get, so return true if \p Offset + /// and \p Size were set. + bool getSubRegIdxCoveredBits(unsigned Idx, + unsigned &Offset, unsigned &Size) const; + /// \brief Return the human-readable symbolic target-specific name for the /// specified physical register. const char *getName(unsigned RegNo) const { |