[RegisterBankInfo] Add statistics for dynamic value mappings.

Like partial mappings, as we move toward TableGen'ed information, the
number should reach zero eventually.

llvm-svn: 282325
This commit is contained in:
Quentin Colombet 2016-09-24 04:53:55 +00:00
parent fd8c95adf4
commit a50813f608
1 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,10 @@ STATISTIC(NumPartialMappingsCreated,
"Number of partial mappings dynamically created"); "Number of partial mappings dynamically created");
STATISTIC(NumPartialMappingsAccessed, STATISTIC(NumPartialMappingsAccessed,
"Number of partial mappings dynamically accessed"); "Number of partial mappings dynamically accessed");
STATISTIC(NumValueMappingsCreated,
"Number of value mappings dynamically created");
STATISTIC(NumValueMappingsAccessed,
"Number of value mappings dynamically accessed");
const unsigned RegisterBankInfo::DefaultMappingID = UINT_MAX; const unsigned RegisterBankInfo::DefaultMappingID = UINT_MAX;
const unsigned RegisterBankInfo::InvalidMappingID = UINT_MAX - 1; const unsigned RegisterBankInfo::InvalidMappingID = UINT_MAX - 1;
@ -364,10 +368,14 @@ RegisterBankInfo::getValueMapping(const PartialMapping *BreakDown,
Hash = hash_combine_range(Hashes.begin(), Hashes.end()); Hash = hash_combine_range(Hashes.begin(), Hashes.end());
} }
++NumValueMappingsAccessed;
const auto &It = MapOfValueMappings.find(Hash); const auto &It = MapOfValueMappings.find(Hash);
if (It != MapOfValueMappings.end()) if (It != MapOfValueMappings.end())
return *It->second; return *It->second;
++NumValueMappingsCreated;
ValueMapping *&ValMapping = MapOfValueMappings[Hash]; ValueMapping *&ValMapping = MapOfValueMappings[Hash];
ValMapping = new ValueMapping{BreakDown, NumBreakDowns}; ValMapping = new ValueMapping{BreakDown, NumBreakDowns};
return *ValMapping; return *ValMapping;