14 #ifndef LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H
15 #define LLVM_ANALYSIS_BRANCHPROBABILITYINFO_H
62 unsigned IndexInSuccessors)
const;
97 unsigned IndexInSuccessors)
const;
118 return IsLikely ? (1u << 20) - 1 : 1;
124 typedef std::pair<const BasicBlock *, unsigned> Edge;
132 static const uint32_t DEFAULT_WEIGHT = 16;
149 uint32_t getSumForBlock(
const BasicBlock *BB)
const;
151 bool calcUnreachableHeuristics(
BasicBlock *BB);
155 bool calcLoopBranchHeuristics(
BasicBlock *BB);
157 bool calcFloatingPointHeuristics(
BasicBlock *BB);
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
raw_ostream & printEdgeProbability(raw_ostream &OS, const BasicBlock *Src, const BasicBlock *Dst) const
Print an edge's probability.
A Module instance is used to store all the information related to an LLVM module. ...
BasicBlock * getHotSucc(BasicBlock *BB) const
Retrieve the hot successor of a block if one exists.
void initializeBranchProbabilityInfoPass(PassRegistry &)
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
LLVM Basic Block Representation.
void setEdgeWeight(const BasicBlock *Src, unsigned IndexInSuccessors, uint32_t Weight)
Set the raw edge weight for a given edge.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Represent the analysis usage information of a pass.
static uint32_t getBranchWeightStackProtector(bool IsLikely)
FunctionPass class - This class is used to implement most global optimizations.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
bool isEdgeHot(const BasicBlock *Src, const BasicBlock *Dst) const
Test if an edge is hot relative to other out-edges of the Src.
Analysis pass providing branch probability information.
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
This class implements an extremely fast bulk output stream that can only output to a stream...
BranchProbability getEdgeProbability(const BasicBlock *Src, unsigned IndexInSuccessors) const
Get an edge's probability, relative to other out-edges of the Src.
uint32_t getEdgeWeight(const BasicBlock *Src, unsigned IndexInSuccessors) const
Get the raw edge weight calculated for the edge.