diff options
author | Quentin Colombet <qcolombet@apple.com> | 2017-10-13 21:16:15 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2017-10-13 21:16:15 +0000 |
commit | 4a6b75012df35e105b4b0f0eca0e324479f8a3f7 (patch) | |
tree | d01843d2563b46dfe6c5332d3a8e37942052c5e0 /llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | |
parent | d58265ad5567e0177e29eeedbe1b16fc8c6f7fb5 (diff) | |
download | bcm5719-llvm-4a6b75012df35e105b4b0f0eca0e324479f8a3f7.tar.gz bcm5719-llvm-4a6b75012df35e105b4b0f0eca0e324479f8a3f7.zip |
[RegisterBankInfo] Cache the getMinimalPhysRegClass information
TargetRegisterInfo::getMinimalPhysRegClass is actually pretty expensive
because it has to iterate over all the register classes.
Cache this information as we need and get it so that we limit its usage.
Right now, we heavily rely on it, because this is how we get the mapping
for vregs defined by copies from physreg (i.e., the one that are ABI
related).
Improve compile time by up to 10% for that pass.
NFC
llvm-svn: 315759
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index f2eb217c0b8..fac26a16412 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -221,9 +221,8 @@ uint64_t RegBankSelect::getRepairCost( // into a new virtual register. // We would also need to propagate this information in the // repairing placement. - unsigned Cost = - RBI->copyCost(*DesiredRegBrank, *CurRegBank, - RegisterBankInfo::getSizeInBits(MO.getReg(), *MRI, *TRI)); + unsigned Cost = RBI->copyCost(*DesiredRegBrank, *CurRegBank, + RBI->getSizeInBits(MO.getReg(), *MRI, *TRI)); // TODO: use a dedicated constant for ImpossibleCost. if (Cost != std::numeric_limits<unsigned>::max()) return Cost; |