LLVM: lib/Transforms/Utils/SizeOpts.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
15
16using namespace llvm;
17
20 cl::desc("Enable the profile guided size optimizations. "));
21
24 cl::desc("Apply the profile guided size optimizations only "
25 "if the working set size is large (except for cold code.)"));
26
29 cl::desc("Apply the profile guided size optimizations only "
30 "to cold code."));
31
34 cl::desc("Apply the profile guided size optimizations only "
35 "to cold code under instrumentation PGO."));
36
39 cl::desc("Apply the profile guided size optimizations only "
40 "to cold code under sample PGO."));
41
43 "pgso-cold-code-only-for-partial-sample-pgo", cl::Hidden, cl::init(false),
44 cl::desc("Apply the profile guided size optimizations only "
45 "to cold code under partial-profile sample PGO."));
46
49 cl::desc("Force the (profiled-guided) size optimizations. "));
50
53 cl::desc("The profile guided size optimization profile summary cutoff "
54 "for instrumentation profile."));
55
58 cl::desc("The profile guided size optimization profile summary cutoff "
59 "for sample profile."));
60
61namespace {
62struct BasicBlockBFIAdapter {
63 static bool isFunctionColdInCallGraph(const Function *F,
64 ProfileSummaryInfo *PSI,
65 BlockFrequencyInfo &BFI) {
67 }
68 static bool isFunctionHotInCallGraphNthPercentile(int CutOff,
69 const Function *F,
70 ProfileSummaryInfo *PSI,
71 BlockFrequencyInfo &BFI) {
73 }
74 static bool isFunctionColdInCallGraphNthPercentile(int CutOff,
75 const Function *F,
76 ProfileSummaryInfo *PSI,
77 BlockFrequencyInfo &BFI) {
79 }
80 static bool isColdBlock(const BasicBlock *BB,
81 ProfileSummaryInfo *PSI,
82 BlockFrequencyInfo *BFI) {
84 }
85 static bool isHotBlockNthPercentile(int CutOff,
86 const BasicBlock *BB,
87 ProfileSummaryInfo *PSI,
88 BlockFrequencyInfo *BFI) {
90 }
91 static bool isColdBlockNthPercentile(int CutOff, const BasicBlock *BB,
92 ProfileSummaryInfo *PSI,
93 BlockFrequencyInfo *BFI) {
95 }
96};
97}
98
102 if (F->hasOptSize())
103 return true;
105}
106
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isColdBlock(const MachineBasicBlock &MBB, const MachineBlockFrequencyInfo *MBFI, ProfileSummaryInfo *PSI)
LLVM Basic Block Representation.
const Function * getParent() const
Return the enclosing method, or null if none.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
Analysis providing profile information.
bool isHotBlockNthPercentile(int PercentileCutoff, const BBType *BB, BFIT *BFI) const
bool isFunctionColdInCallGraph(const FuncT *F, BFIT &BFI) const
Returns true if F contains only cold code.
bool isFunctionColdInCallGraphNthPercentile(int PercentileCutoff, const FuncT *F, BFIT &BFI) const
Returns true if F contains cold code with regard to a given cold percentile cutoff value.
bool isColdBlock(const BBType *BB, BFIT *BFI) const
Returns true if BasicBlock BB is considered cold.
bool isFunctionHotInCallGraphNthPercentile(int PercentileCutoff, const FuncT *F, BFIT &BFI) const
Returns true if F contains hot code with regard to a given hot percentile cutoff value.
bool isColdBlockNthPercentile(int PercentileCutoff, const BBType *BB, BFIT *BFI) const
Returns true if BasicBlock BB is considered cold with regard to a given cold percentile cutoff value.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI cl::opt< bool > PGSOColdCodeOnlyForSamplePGO
LLVM_ABI cl::opt< bool > PGSOColdCodeOnlyForInstrPGO
LLVM_ABI bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
bool shouldFuncOptimizeForSizeImpl(const FuncT *F, ProfileSummaryInfo *PSI, BFIT *BFI, PGSOQueryType QueryType)
LLVM_ABI cl::opt< int > PgsoCutoffSampleProf
LLVM_ABI cl::opt< bool > EnablePGSO
LLVM_ABI cl::opt< bool > PGSOColdCodeOnlyForPartialSamplePGO
LLVM_ABI cl::opt< int > PgsoCutoffInstrProf
bool shouldOptimizeForSizeImpl(BlockTOrBlockFreq BBOrBlockFreq, ProfileSummaryInfo *PSI, BFIT *BFI, PGSOQueryType QueryType)
LLVM_ABI cl::opt< bool > ForcePGSO
LLVM_ABI cl::opt< bool > PGSOLargeWorkingSetSizeOnly
LLVM_ABI cl::opt< bool > PGSOColdCodeOnly