From 14edd314af99ccaad194d071f23e437a1371f176 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 23 Oct 2011 21:21:50 +0000 Subject: 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 --- include/llvm/Analysis/BranchProbabilityInfo.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include/llvm') 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 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; }; } -- cgit v1.2.3