diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-09-23 18:38:06 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-09-23 18:38:06 +0000 |
commit | d4c02437c16b52d49f6b2ead97c8b716c81de64b (patch) | |
tree | c82d8b9fe50b30e49b388e92f8ebe9af662327e3 | |
parent | 1acb55e67c554fabc768d52b4dcab32e474f83cb (diff) | |
download | bcm5719-llvm-d4c02437c16b52d49f6b2ead97c8b716c81de64b.tar.gz bcm5719-llvm-d4c02437c16b52d49f6b2ead97c8b716c81de64b.zip |
[RegisterBankInfo] Add statistics for dynamic partial mappings.
Collect statistics about the number of partial mappings dynamically
allocated and accessed. Ultimately, when the whole TableGen
infrastructure is set, those numbers should be zero.
llvm-svn: 282274
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp index 88e47f6fb89..b52e0985398 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp @@ -13,6 +13,7 @@ #include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Statistic.h" #include "llvm/ADT/iterator_range.h" #include "llvm/CodeGen/GlobalISel/RegisterBank.h" #include "llvm/CodeGen/MachineBasicBlock.h" @@ -32,6 +33,11 @@ using namespace llvm; +STATISTIC(NumPartialMappingsCreated, + "Number of partial mappings dynamically created"); +STATISTIC(NumPartialMappingsAccessed, + "Number of partial mappings dynamically accessed"); + const unsigned RegisterBankInfo::DefaultMappingID = UINT_MAX; const unsigned RegisterBankInfo::InvalidMappingID = UINT_MAX - 1; @@ -309,10 +315,15 @@ RegisterBankInfo::getInstrMappingImpl(const MachineInstr &MI) const { const RegisterBankInfo::PartialMapping & RegisterBankInfo::getPartialMapping(unsigned StartIdx, unsigned Length, const RegisterBank &RegBank) const { + ++NumPartialMappingsAccessed; + hash_code Hash = hash_combine(StartIdx, Length, RegBank.getID()); const auto &It = MapOfPartialMappings.find(Hash); if (It != MapOfPartialMappings.end()) return It->second; + + ++NumPartialMappingsCreated; + PartialMapping &PartMapping = MapOfPartialMappings[Hash]; PartMapping = PartialMapping{StartIdx, Length, RegBank}; return PartMapping; |