14#include "llvm/IR/Function.h"
15#include "llvm/Support/raw_ostream.h"
25 const llvm::Instruction *_callSite,
26 const llvm::Function *_function)
27 : parent(_parent), callSite(_callSite), function(_function), count(0) {}
30 llvm::errs() <<
" (Function: " << this->
function->getName() <<
", "
32 <<
"Count: " << this->
count <<
")";
34 llvm::errs() <<
";\n";
37 else llvm::errs() <<
"\n";
47 for (
auto &path :
paths)
48 path->summaryStatistics = path->statistics;
51 for (
auto it =
paths.rbegin(), ie =
paths.rend(); it != ie; ++it) {
52 const auto &cp = (*it);
53 cp->parent->summaryStatistics += cp->summaryStatistics;
56 csi.
count += cp->count;
62 const llvm::Instruction *cs,
63 const llvm::Function *f) {
65 if (cs==p->callSite && f==p->function)
68 auto cp = std::unique_ptr<CallPathNode>(
new CallPathNode(parent, cs, f));
69 auto newCP = cp.get();
70 paths.emplace_back(std::move(cp));
75 const llvm::Instruction *cs,
76 const llvm::Function *f) {
77 std::pair<const llvm::Instruction *, const llvm::Function *> key(cs, f);
81 auto it = parent->
children.find(key);
84 parent->
children.insert(std::make_pair(key, cp));
std::vector< std::unique_ptr< CallPathNode > > paths
CallPathNode * getCallPath(CallPathNode *parent, const llvm::Instruction *callSite, const llvm::Function *f)
CallPathNode * computeCallPath(CallPathNode *parent, const llvm::Instruction *callSite, const llvm::Function *f)
void getSummaryStatistics(CallSiteSummaryTable &result)
const llvm::Function * function
const llvm::Instruction * callSite
std::map< const llvm::Instruction *, std::map< const llvm::Function *, CallSiteInfo > > CallSiteSummaryTable
StatisticRecord statistics