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/utils/TableGen/CodeGenRegisters.h | |
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/utils/TableGen/CodeGenRegisters.h')
-rw-r--r-- | llvm/utils/TableGen/CodeGenRegisters.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h index ba62db48274..c83455149a6 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.h +++ b/llvm/utils/TableGen/CodeGenRegisters.h @@ -37,6 +37,8 @@ namespace llvm { Record *const TheDef; std::string Name; std::string Namespace; + uint16_t Size; + uint16_t Offset; public: const unsigned EnumValue; @@ -52,6 +54,8 @@ namespace llvm { const std::string &getName() const { return Name; } const std::string &getNamespace() const { return Namespace; } std::string getQualifiedName() const; + uint16_t getSize() const { return Size; } + uint16_t getOffset() const { return Offset; } // Order CodeGenSubRegIndex pointers by EnumValue. struct Less { @@ -79,6 +83,15 @@ namespace llvm { assert(A && B); std::pair<CompMap::iterator, bool> Ins = Composed.insert(std::make_pair(A, B)); + // Synthetic subreg indices that aren't contiguous (for instance ARM + // register tuples) don't have a bit range, so it's OK to let + // B->Offset == -1. For the other cases, accumulate the offset and set + // the size here. Only do so if there is no offset yet though. + if ((Offset != (uint16_t)-1 && A->Offset != (uint16_t)-1) && + (B->Offset == (uint16_t)-1)) { + B->Offset = Offset + A->Offset; + B->Size = A->Size; + } return (Ins.second || Ins.first->second == B) ? 0 : Ins.first->second; } |