36 #ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H 37 #define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H 52 class BlockFrequencyInfo;
60 class ProfileSummaryInfo;
61 class TargetTransformInfo;
87 unsigned CumulativeCost = 0;
90 ConstInt(ConstInt), ConstExpr(ConstExpr) {}
94 CumulativeCost += Cost;
107 Type *Ty=
nullptr) : Uses(
std::move(Uses)), Offset(Offset), Ty(Ty) {}
134 ClonedCastMap.clear();
135 ConstIntCandVec.clear();
136 for (
auto MapEntry : ConstGEPCandMap)
137 MapEntry.second.clear();
138 ConstGEPCandMap.clear();
139 ConstIntInfoVec.clear();
140 for (
auto MapEntry : ConstGEPInfoMap)
141 MapEntry.second.clear();
142 ConstGEPInfoMap.clear();
158 using ConstCandVecType = std::vector<consthoist::ConstantCandidate>;
160 ConstCandVecType ConstIntCandVec;
185 void collectConstantCandidates(
Function &Fn);
186 void findAndMakeBaseConstant(ConstCandVecType::iterator S,
187 ConstCandVecType::iterator
E,
189 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,
190 ConstCandVecType::iterator E,
191 ConstCandVecType::iterator &MaxCostItr);
200 void deleteDeadCastInst()
const;
201 bool optimizeConstants(
Function &Fn);
206 #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)
Analysis providing profile information.
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)
This is the shared class of boolean and integer constants.
ConstantUser(Instruction *Inst, unsigned Idx)
A vector that has set insertion semantics.
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 or more pointer types, with the discriminator in the low bit of the poin...