summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenRegisters.h
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-03-31 01:35:59 +0000
committerAndrew Trick <atrick@apple.com>2012-03-31 01:35:59 +0000
commitdd9a50196cd75dbcb2bd604754cd62f8c1f30357 (patch)
tree92a37437028d4ca8fa4953d6dbfb9e2731985ea9 /utils/TableGen/CodeGenRegisters.h
parent3ee3661f8f10e7f82094a89c40d9118630ab0a40 (diff)
downloadllvm-dd9a50196cd75dbcb2bd604754cd62f8c1f30357.tar.gz
llvm-dd9a50196cd75dbcb2bd604754cd62f8c1f30357.tar.bz2
llvm-dd9a50196cd75dbcb2bd604754cd62f8c1f30357.tar.xz
Introduce Register Units: Give each leaf register a number.
First small step toward modeling multi-register multi-pressure. In the future, register units can also be used to model liveness and aliasing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenRegisters.h')
-rw-r--r--utils/TableGen/CodeGenRegisters.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/TableGen/CodeGenRegisters.h b/utils/TableGen/CodeGenRegisters.h
index f5372c07c8..f73519ebbf 100644
--- a/utils/TableGen/CodeGenRegisters.h
+++ b/utils/TableGen/CodeGenRegisters.h
@@ -123,6 +123,13 @@ namespace llvm {
return SuperRegs;
}
+ // List of register units in ascending order.
+ typedef SmallVector<unsigned, 16> RegUnitList;
+
+ // Get the list of register units.
+ // This is only valid after getSubRegs() completes.
+ const RegUnitList &getRegUnits() const { return RegUnits; }
+
// Order CodeGenRegister pointers by EnumValue.
struct Less {
bool operator()(const CodeGenRegister *A,
@@ -139,6 +146,7 @@ namespace llvm {
bool SubRegsComplete;
SubRegMap SubRegs;
SuperRegList SuperRegs;
+ RegUnitList RegUnits;
};
@@ -307,6 +315,7 @@ namespace llvm {
// Registers.
std::vector<CodeGenRegister*> Registers;
DenseMap<Record*, CodeGenRegister*> Def2Reg;
+ unsigned NumRegUnits;
// Register classes.
std::vector<CodeGenRegisterClass*> RegClasses;
@@ -355,6 +364,8 @@ namespace llvm {
// Find a register from its Record def.
CodeGenRegister *getReg(Record*);
+ unsigned newRegUnit() { return NumRegUnits++; }
+
ArrayRef<CodeGenRegisterClass*> getRegClasses() const {
return RegClasses;
}