diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-10-05 00:35:49 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-10-05 00:35:49 +0000 |
commit | 3a541b046a1989cfbedc99a3ceadc00083422a4c (patch) | |
tree | e2b2270f749550dd217a573322f4177397ae7eef /llvm/utils/TableGen/CodeGenRegisters.h | |
parent | 48c69106e4ce1759b6df61d5e6a59a22768944a8 (diff) | |
download | bcm5719-llvm-3a541b046a1989cfbedc99a3ceadc00083422a4c.tar.gz bcm5719-llvm-3a541b046a1989cfbedc99a3ceadc00083422a4c.zip |
Add TRI::getSubClassWithSubReg(RC, Idx) function.
This function is used to constrain a register class to a sub-class that
supports the given sub-register index.
For example, getSubClassWithSubReg(GR32, sub_8bit) -> GR32_ABCD.
The function will be used to compute register classes when emitting
INSERT_SUBREG and EXTRACT_SUBREG nodes and for register class inflation
of sub-register operations.
The version provided by TableGen is usually adequate, but targets can
override.
llvm-svn: 141142
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 72c8ac05025..ab3e68efc24 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.h +++ b/llvm/utils/TableGen/CodeGenRegisters.h @@ -101,6 +101,9 @@ namespace llvm { // super-class. void inheritProperties(CodeGenRegBank&); + // Map SubRegIndex -> sub-class + DenseMap<Record*, CodeGenRegisterClass*> SubClassWithSubReg; + public: unsigned EnumValue; std::string Namespace; @@ -145,6 +148,16 @@ namespace llvm { return SubClasses.test(RC->EnumValue); } + // getSubClassWithSubReg - Returns the largest sub-class where all + // registers have a SubIdx sub-register. + CodeGenRegisterClass *getSubClassWithSubReg(Record *SubIdx) const { + return SubClassWithSubReg.lookup(SubIdx); + } + + void setSubClassWithSubReg(Record *SubIdx, CodeGenRegisterClass *SubRC) { + SubClassWithSubReg[SubIdx] = SubRC; + } + // getSubClasses - Returns a constant BitVector of subclasses indexed by // EnumValue. // The SubClasses vector includs an entry for this class. |