summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ProfileInfo.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-14 06:58:59 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-14 06:58:59 +0000
commit858cb8a5e07d4fe4b516a99eef7e8c028516a679 (patch)
treeff34da69a12554b93f8bc94551280ae165b40cb7 /include/llvm/Analysis/ProfileInfo.h
parente11c4db848d4b9c0e8a2bd1752ec87a451ff3a55 (diff)
downloadllvm-858cb8a5e07d4fe4b516a99eef7e8c028516a679.tar.gz
llvm-858cb8a5e07d4fe4b516a99eef7e8c028516a679.tar.bz2
llvm-858cb8a5e07d4fe4b516a99eef7e8c028516a679.tar.xz
ProfileInfo interface tweaks.
- Add getExecutionCount(const Function). - Add helper Edge type. - constify. - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ProfileInfo.h')
-rw-r--r--include/llvm/Analysis/ProfileInfo.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/llvm/Analysis/ProfileInfo.h b/include/llvm/Analysis/ProfileInfo.h
index ff83f97ee0..47b437c1b2 100644
--- a/include/llvm/Analysis/ProfileInfo.h
+++ b/include/llvm/Analysis/ProfileInfo.h
@@ -26,17 +26,22 @@
namespace llvm {
class BasicBlock;
+ class Function;
class Pass;
/// ProfileInfo Class - This class holds and maintains edge profiling
/// information for some unit of code.
class ProfileInfo {
+ public:
+ // Types for handling profiling information.
+ typedef std::pair<const BasicBlock*, const BasicBlock*> Edge;
+
protected:
// EdgeCounts - Count the number of times a transition between two blocks is
// executed. As a special case, we also hold an edge from the null
// BasicBlock to the entry block to indicate how many times the function was
// entered.
- std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned> EdgeCounts;
+ std::map<Edge, unsigned> EdgeCounts;
public:
static char ID; // Class identification, replacement for typeinfo
virtual ~ProfileInfo(); // We want to be subclassed
@@ -44,10 +49,13 @@ namespace llvm {
//===------------------------------------------------------------------===//
/// Profile Information Queries
///
- unsigned getExecutionCount(BasicBlock *BB) const;
+ unsigned getExecutionCount(const Function *F) const;
+
+ unsigned getExecutionCount(const BasicBlock *BB) const;
- unsigned getEdgeWeight(BasicBlock *Src, BasicBlock *Dest) const {
- std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned>::const_iterator I=
+ unsigned getEdgeWeight(const BasicBlock *Src,
+ const BasicBlock *Dest) const {
+ std::map<Edge, unsigned>::const_iterator I =
EdgeCounts.find(std::make_pair(Src, Dest));
return I != EdgeCounts.end() ? I->second : 0;
}