LLVM: include/llvm/Passes/OptimizationLevel.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_PASSES_OPTIMIZATIONLEVEL_H
16#define LLVM_PASSES_OPTIMIZATIONLEVEL_H
17
18#include <assert.h>
19
20namespace llvm {
21
23 unsigned SpeedLevel = 2;
24 unsigned SizeLevel = 0;
26 : SpeedLevel(SpeedLevel), SizeLevel(SizeLevel) {
27
28 assert(SpeedLevel <= 3 &&
29 "Optimization level for speed should be 0, 1, 2, or 3");
30 assert(SizeLevel <= 2 &&
31 "Optimization level for size should be 0, 1, or 2");
32 assert((SizeLevel == 0 || SpeedLevel == 2) &&
33 "Optimize for size should be encoded with speedup level == 2");
34 }
35
36public:
38
39
40
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
75
76
77
78
79
80
81
82
83
84
85
86
87
88
90
91
92
93
94
95
96
97
98
99
101
102
103
104
105
106
107
109
111
113
115 return SizeLevel == Other.SizeLevel && SpeedLevel == Other.SpeedLevel;
116 }
118 return SizeLevel != Other.SizeLevel || SpeedLevel != Other.SpeedLevel;
119 }
120
122
124};
125}
126
127#endif
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const OptimizationLevel O3
Optimize for fast execution as much as possible.
bool operator==(const OptimizationLevel &Other) const
bool isOptimizingForSize() const
static const OptimizationLevel Oz
A very specialized mode that will optimize for code size at any and all costs.
OptimizationLevel()=default
static const OptimizationLevel O0
Disable as many optimizations as possible.
unsigned getSizeLevel() const
static const OptimizationLevel Os
Similar to O2 but tries to optimize for small code size instead of fast execution without triggering ...
bool operator!=(const OptimizationLevel &Other) const
unsigned getSpeedupLevel() const
static const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
bool isOptimizingForSpeed() const
static const OptimizationLevel O1
Optimize quickly without destroying debuggability.
This is an optimization pass for GlobalISel generic memory operations.