[llvm-commits] CVS: llvm/include/llvm/Analysis/ProfileInfo.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Mar 8 16:04:01 PST 2004
Changes in directory llvm/include/llvm/Analysis:
ProfileInfo.h updated: 1.3 -> 1.4
---
Log message:
Switch over to using edge profile information as the basic profiling representation,
from basic block counts.
---
Diffs of the changes: (+18 -10)
Index: llvm/include/llvm/Analysis/ProfileInfo.h
diff -u llvm/include/llvm/Analysis/ProfileInfo.h:1.3 llvm/include/llvm/Analysis/ProfileInfo.h:1.4
--- llvm/include/llvm/Analysis/ProfileInfo.h:1.3 Mon Mar 8 15:30:18 2004
+++ llvm/include/llvm/Analysis/ProfileInfo.h Mon Mar 8 16:03:45 2004
@@ -28,31 +28,39 @@
class BasicBlock;
class Pass;
- /// createProfileLoaderPass - This function returns a Pass that loads the
- /// profiling information for the module from the specified filename, making
- /// it available to the optimizers.
- Pass *createProfileLoaderPass(const std::string &Filename);
-
+ /// ProfileInfo Class - This class holds and maintains edge profiling
+ /// information for some unit of code.
class ProfileInfo {
protected:
- std::map<BasicBlock*, unsigned> ExecutionCounts;
+ // 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;
public:
virtual ~ProfileInfo(); // We want to be subclassed
//===------------------------------------------------------------------===//
/// Profile Information Queries
///
- unsigned getExecutionCount(BasicBlock *BB) {
- std::map<BasicBlock*, unsigned>::iterator I = ExecutionCounts.find(BB);
- return I != ExecutionCounts.end() ? I->second : 0;
+ unsigned getExecutionCount(BasicBlock *BB) const;
+
+ unsigned getEdgeWeight(BasicBlock *Src, BasicBlock *Dest) const {
+ std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned>::const_iterator I=
+ EdgeCounts.find(std::make_pair(Src, Dest));
+ return I != EdgeCounts.end() ? I->second : 0;
}
-
+
//===------------------------------------------------------------------===//
/// Analysis Update Methods
///
};
+ /// createProfileLoaderPass - This function returns a Pass that loads the
+ /// profiling information for the module from the specified filename, making
+ /// it available to the optimizers.
+ Pass *createProfileLoaderPass(const std::string &Filename);
} // End llvm namespace
#endif
More information about the llvm-commits
mailing list