aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/CodeGenRegisters.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-10-05 00:35:49 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-10-05 00:35:49 +0000
commit845d2c0c776abce551d16f7b1b7dc1f4d4df1a27 (patch)
tree204c79f6f26643a182bb869965b36795d212421e /utils/TableGen/CodeGenRegisters.h
parent2a85015313b585c2a6d2a59d5bfc99a5ebe88f30 (diff)
downloadexternal_llvm-845d2c0c776abce551d16f7b1b7dc1f4d4df1a27.zip
external_llvm-845d2c0c776abce551d16f7b1b7dc1f4d4df1a27.tar.gz
external_llvm-845d2c0c776abce551d16f7b1b7dc1f4d4df1a27.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141142 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenRegisters.h')
-rw-r--r--utils/TableGen/CodeGenRegisters.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/TableGen/CodeGenRegisters.h b/utils/TableGen/CodeGenRegisters.h
index 72c8ac0..ab3e68e 100644
--- a/utils/TableGen/CodeGenRegisters.h
+++ b/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.