mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Make block and function count available via ProfileInfo.
- Part of optimal static profiling patch sequence by Andreas Neustifter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -27,6 +27,9 @@ char ProfileInfo::ID = 0;
|
||||
ProfileInfo::~ProfileInfo() {}
|
||||
|
||||
unsigned ProfileInfo::getExecutionCount(const BasicBlock *BB) const {
|
||||
if (BlockCounts.find(BB) != BlockCounts.end())
|
||||
return BlockCounts.find(BB)->second;
|
||||
|
||||
pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
|
||||
|
||||
// Are there zero predecessors of this block?
|
||||
@ -76,7 +79,9 @@ unsigned ProfileInfo::getExecutionCount(const BasicBlock *BB) const {
|
||||
}
|
||||
|
||||
unsigned ProfileInfo::getExecutionCount(const Function *F) const {
|
||||
if (F->isDeclaration()) return -1;
|
||||
if (FunctionCounts.find(F) != FunctionCounts.end())
|
||||
return FunctionCounts.find(F)->second;
|
||||
|
||||
return getExecutionCount(&F->getEntryBlock());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user