summaryrefslogtreecommitdiff
path: root/lib/Target/TargetRegisterInfo.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-06-27 06:56:04 +0000
committerOwen Anderson <resistor@mac.com>2008-06-27 06:56:04 +0000
commit1360b7d8f8d1969026870d18c582b4e3a7cff8b8 (patch)
treed5acfde18f12d4dd270d333944e2f2bec4976f58 /lib/Target/TargetRegisterInfo.cpp
parent3648f9f0ae79532c6bdc9c6188d0e46676de212f (diff)
downloadllvm-1360b7d8f8d1969026870d18c582b4e3a7cff8b8.tar.gz
llvm-1360b7d8f8d1969026870d18c582b4e3a7cff8b8.tar.bz2
llvm-1360b7d8f8d1969026870d18c582b4e3a7cff8b8.tar.xz
Cache subregister relationships in a set in TargetRegisterInfo to allow faster lookups.
This speeds up LiveVariables from 0.6279s to 0.6165s on kimwitu++. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetRegisterInfo.cpp')
-rw-r--r--lib/Target/TargetRegisterInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/TargetRegisterInfo.cpp b/lib/Target/TargetRegisterInfo.cpp
index 3f44a0cb5a..e69496f4b2 100644
--- a/lib/Target/TargetRegisterInfo.cpp
+++ b/lib/Target/TargetRegisterInfo.cpp
@@ -29,6 +29,16 @@ TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
CallFrameSetupOpcode = CFSO;
CallFrameDestroyOpcode = CFDO;
+
+ for (unsigned i = 0; i < NumRegs; ++i) {
+ const TargetRegisterDesc* CurrReg = Desc + i;
+
+ // Initialize the Subregs set, which stores pairs (a, b) where
+ // b is a subreg of a.
+ if (CurrReg->SubRegs)
+ for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; ++CurrSR)
+ Subregs.insert(std::make_pair(i, *CurrSR));
+ }
}
TargetRegisterInfo::~TargetRegisterInfo() {}