Add PLT dyno stats.

Summary: Get PLT call stats.

(cherry picked from FBD3874799)
This commit is contained in:
Maksim Panchenko
2016-09-15 15:47:10 -07:00
parent c4e36c1dd6
commit 2c9bf9afd6
2 changed files with 15 additions and 0 deletions

View File

@@ -2688,6 +2688,20 @@ DynoStats BinaryFunction::getDynoStats() const {
Stats[DynoStats::FUNCTION_CALLS] += BBExecutionCount;
if (BC.MIA->getMemoryOperandNo(Instr) != -1) {
Stats[DynoStats::INDIRECT_CALLS] += BBExecutionCount;
} else if (const auto *CallSymbol = BC.MIA->getTargetSymbol(Instr)) {
if (BC.getFunctionForSymbol(CallSymbol))
continue;
auto GSI = BC.GlobalSymbols.find(CallSymbol->getName());
if (GSI == BC.GlobalSymbols.end())
continue;
auto Section = BC.getSectionForAddress(GSI->second);
if (!Section)
continue;
StringRef SectionName;
Section->getName(SectionName);
if (SectionName == ".plt") {
Stats[DynoStats::PLT_CALLS] += BBExecutionCount;
}
}
}