summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-10-23 21:21:50 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-10-23 21:21:50 +0000
commit14edd314af99ccaad194d071f23e437a1371f176 (patch)
tree7d73af919df8bc5a203bae12d13ad399c0e3fc97 /include/llvm
parent65ec521c3cd08bfbfb17334cc2c6668524cea68d (diff)
downloadllvm-14edd314af99ccaad194d071f23e437a1371f176.tar.gz
llvm-14edd314af99ccaad194d071f23e437a1371f176.tar.bz2
llvm-14edd314af99ccaad194d071f23e437a1371f176.tar.xz
Teach the BranchProbabilityInfo pass to print its results, and use that
to bring it under direct test instead of merely indirectly testing it in the BlockFrequencyInfo pass. The next step is to start adding tests for the various heuristics employed, and to start fixing those heuristics once they're under test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/BranchProbabilityInfo.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/Analysis/BranchProbabilityInfo.h b/include/llvm/Analysis/BranchProbabilityInfo.h
index a2c12ab9e8..180d230b4c 100644
--- a/include/llvm/Analysis/BranchProbabilityInfo.h
+++ b/include/llvm/Analysis/BranchProbabilityInfo.h
@@ -37,6 +37,9 @@ class BranchProbabilityInfo : public FunctionPass {
DenseMap<Edge, uint32_t> Weights;
+ /// \brief Track the last function we run over for printing.
+ Function *LastF;
+
// Get sum of the block successors' weights.
uint32_t getSumForBlock(const BasicBlock *BB) const;
@@ -48,8 +51,8 @@ public:
}
void getAnalysisUsage(AnalysisUsage &AU) const;
-
bool runOnFunction(Function &F);
+ void print(raw_ostream &OS, const Module *M = 0) const;
// Returned value is between 1 and UINT32_MAX. Look at
// BranchProbabilityInfo.cpp for details.
@@ -74,8 +77,8 @@ public:
// Print value between 0 (0% probability) and 1 (100% probability),
// however the value is never equal to 0, and can be 1 only iff SRC block
// has only one successor.
- raw_ostream &printEdgeProbability(raw_ostream &OS, BasicBlock *Src,
- BasicBlock *Dst) const;
+ raw_ostream &printEdgeProbability(raw_ostream &OS, const BasicBlock *Src,
+ const BasicBlock *Dst) const;
};
}