LLVM: include/llvm/Analysis/LazyBlockFrequencyInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_ANALYSIS_LAZYBLOCKFREQUENCYINFO_H
17#define LLVM_ANALYSIS_LAZYBLOCKFREQUENCYINFO_H
18
22
23namespace llvm {
26
27
28
29
30
31template <typename FunctionT, typename BranchProbabilityInfoPassT,
32 typename LoopInfoT, typename BlockFrequencyInfoT>
34public:
36
37
38 void setAnalysis(const FunctionT *F, BranchProbabilityInfoPassT *BPIPass,
39 const LoopInfoT *LI) {
40 this->F = F;
41 this->BPIPass = BPIPass;
42 this->LI = LI;
43 }
44
45
47 if (!Calculated) {
48 assert(F && BPIPass && LI && "call setAnalysis");
49 BFI.calculate(
51 Calculated = true;
52 }
53 return BFI;
54 }
55
59
61 BFI.releaseMemory();
62 Calculated = false;
64 }
65
66private:
67 BlockFrequencyInfoT BFI;
68 bool Calculated = false;
69 const FunctionT *F = nullptr;
70 BranchProbabilityInfoPassT *BPIPass = nullptr;
71 const LoopInfoT *LI = nullptr;
72};
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
98private:
101 LBFI;
102
103public:
105
107
108
110
111
113
115
116
117
119
123};
124
125}
126#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Represent the analysis usage information of a pass.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
const BlockFrequencyInfo & getBFI() const
Compute and return the block frequencies.
Definition LazyBlockFrequencyInfo.h:112
BlockFrequencyInfo & getBFI()
Compute and return the block frequencies.
Definition LazyBlockFrequencyInfo.h:109
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
static void getLazyBFIAnalysisUsage(AnalysisUsage &AU)
Helper for client passes to set up the analysis usage on behalf of this pass.
void print(raw_ostream &OS, const Module *M) const override
print - Print out the internal state of the pass.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
LazyBlockFrequencyInfoPass()
static char ID
Definition LazyBlockFrequencyInfo.h:104
Wraps a BFI to allow lazy computation of the block frequencies.
Definition LazyBlockFrequencyInfo.h:33
LazyBlockFrequencyInfo()=default
const BlockFrequencyInfoT & getCalculated() const
Definition LazyBlockFrequencyInfo.h:56
void releaseMemory()
Definition LazyBlockFrequencyInfo.h:60
BlockFrequencyInfoT & getCalculated()
Retrieve the BFI with the block frequencies computed.
Definition LazyBlockFrequencyInfo.h:46
void setAnalysis(const FunctionT *F, BranchProbabilityInfoPassT *BPIPass, const LoopInfoT *LI)
Set up the per-function input.
Definition LazyBlockFrequencyInfo.h:38
This is an alternative analysis pass to BranchProbabilityInfoWrapperPass.
A Module instance is used to store all the information related to an LLVM module.
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.
static PassT & getBPI(PassT *P)