LLVM: include/llvm/Analysis/LazyBranchProbabilityInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_ANALYSIS_LAZYBRANCHPROBABILITYINFO_H
17#define LLVM_ANALYSIS_LAZYBRANCHPROBABILITYINFO_H
18
21
22namespace llvm {
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
50
51
52
53
54
55 class LazyBranchProbabilityInfo {
56 public:
59 : F(F), LI(LI), TLI(TLI) {}
60
61
63 if (!Calculated) {
64 assert(F && LI && "call setAnalysis");
65 BPI.calculate(*F, *LI, TLI, nullptr, nullptr);
66 Calculated = true;
67 }
68 return BPI;
69 }
70
72 return const_cast<LazyBranchProbabilityInfo *>(this)->getCalculated();
73 }
74
75 private:
77 bool Calculated = false;
81 };
82
83 std::unique_ptr LBPI;
84
85public:
87
89
90
92
93
95
97
98
99
101
105};
106
107
109
110
111
113 static PassT &getBPI(PassT *P) { return *P; }
114};
115
118 return P->getBPI();
119 }
120};
121}
122#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Represent the analysis usage information of a pass.
Analysis providing branch probability information.
LLVM_ABI void calculate(const Function &F, const LoopInfo &LI, const TargetLibraryInfo *TLI, DominatorTree *DT, PostDominatorTree *PDT)
This is an alternative analysis pass to BranchProbabilityInfoWrapperPass.
Definition LazyBranchProbabilityInfo.h:49
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
const BranchProbabilityInfo & getBPI() const
Compute and return the branch probabilities.
Definition LazyBranchProbabilityInfo.h:94
void print(raw_ostream &OS, const Module *M) const override
print - Print out the internal state of the pass.
BranchProbabilityInfo & getBPI()
Compute and return the branch probabilities.
Definition LazyBranchProbabilityInfo.h:91
LazyBranchProbabilityInfoPass()
static void getLazyBPIAnalysisUsage(AnalysisUsage &AU)
Helper for client passes to set up the analysis usage on behalf of this pass.
static char ID
Definition LazyBranchProbabilityInfo.h:86
A Module instance is used to store all the information related to an LLVM module.
Provides information about what library functions are available for the current target.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
void initializeLazyBPIPassPass(PassRegistry &Registry)
Helper for client passes to initialize dependent passes for LBPI.
MachinePassRegistry< typename RegisterRegAllocBase< T >::FunctionPassCtor > RegisterRegAllocBase< T >::Registry
RegisterRegAlloc's global Registry tracks allocator registration.
static BranchProbabilityInfo & getBPI(LazyBranchProbabilityInfoPass *P)
Definition LazyBranchProbabilityInfo.h:117
Simple trait class that provides a mapping between BPI passes and the corresponding BPInfo.
Definition LazyBranchProbabilityInfo.h:112
static PassT & getBPI(PassT *P)
Definition LazyBranchProbabilityInfo.h:113