37 #ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H 38 #define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H 51 class BlockFrequencyInfo;
59 class TargetTransformInfo;
85 unsigned CumulativeCost = 0;
88 ConstInt(ConstInt), ConstExpr(ConstExpr) {}
92 CumulativeCost += Cost;
105 Type *Ty=
nullptr) : Uses(
std::move(Uses)), Offset(Offset), Ty(Ty) {}
131 ClonedCastMap.clear();
132 ConstIntCandVec.clear();
133 for (
auto MapEntry : ConstGEPCandMap)
134 MapEntry.second.clear();
135 ConstGEPCandMap.clear();
136 ConstIntInfoVec.clear();
137 for (
auto MapEntry : ConstGEPInfoMap)
138 MapEntry.second.clear();
139 ConstGEPInfoMap.clear();
154 using ConstCandVecType = std::vector<consthoist::ConstantCandidate>;
156 ConstCandVecType ConstIntCandVec;
181 void collectConstantCandidates(
Function &Fn);
182 void findAndMakeBaseConstant(ConstCandVecType::iterator S,
183 ConstCandVecType::iterator
E,
185 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,
186 ConstCandVecType::iterator E,
187 ConstCandVecType::iterator &MaxCostItr);
196 void deleteDeadCastInst()
const;
197 bool optimizeConstants(
Function &Fn);
202 #endif // LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H A parsed version of the target data layout string in and methods for querying it. ...
static bool runImpl(Function &F, TargetLibraryInfo &TLI, DominatorTree &DT)
This is the entry point for all transforms.
ConstantCandidate(ConstantInt *ConstInt, ConstantExpr *ConstExpr=nullptr)
A base constant and all its rebased constants.
This class represents lattice values for constants.
void push_back(const T &Elt)
Keeps track of a constant candidate and its uses.
void addUser(Instruction *Inst, unsigned Idx, unsigned Cost)
Add the user to the use list and update the cost.
This represents a constant that has been rebased with respect to a base constant. ...
A constant value that is initialized with an expression using other constant values.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
Keeps track of the user of a constant and the operand index where the constant is used...
RebasedConstantInfo(ConstantUseListType &&Uses, Constant *Offset, Type *Ty=nullptr)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
ConstantUser(Instruction *Inst, unsigned Idx)
A container for analyses that lazily runs them and caches their results.
RebasedConstantListType RebasedConstants
This header defines various interfaces for pass management in LLVM.
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...