15#ifndef LLVM_PASSES_OPTIMIZATIONLEVEL_H
16#define LLVM_PASSES_OPTIMIZATIONLEVEL_H
24 unsigned SpeedLevel = 2;
25 unsigned SizeLevel = 0;
27 : SpeedLevel(SpeedLevel), SizeLevel(SizeLevel) {
30 "Optimization level for speed should be 0, 1, 2, or 3");
32 "Optimization level for size should be 0, 1, or 2");
33 assert((SizeLevel == 0 || SpeedLevel == 2) &&
34 "Optimize for size should be encoded with speedup level == 2");
116 return SizeLevel ==
Other.SizeLevel && SpeedLevel ==
Other.SpeedLevel;
119 return SizeLevel !=
Other.SizeLevel || SpeedLevel !=
Other.SpeedLevel;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static LLVM_ABI const OptimizationLevel O3
Optimize for fast execution as much as possible.
bool operator==(const OptimizationLevel &Other) const
bool isOptimizingForSize() const
static LLVM_ABI const OptimizationLevel Oz
A very specialized mode that will optimize for code size at any and all costs.
OptimizationLevel()=default
static LLVM_ABI const OptimizationLevel O0
Disable as many optimizations as possible.
unsigned getSizeLevel() const
static LLVM_ABI 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 LLVM_ABI const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
bool isOptimizingForSpeed() const
static LLVM_ABI const OptimizationLevel O1
Optimize quickly without destroying debuggability.
This is an optimization pass for GlobalISel generic memory operations.