37 #ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H 38 #define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H 50 class BlockFrequencyInfo;
56 class TargetTransformInfo;
78 unsigned CumulativeCost = 0;
84 CumulativeCost += Cost;
96 : Uses(
std::move(Uses)), Offset(Offset) {}
119 ClonedCastMap.clear();
120 ConstCandVec.clear();
125 using ConstCandVecType = std::vector<consthoist::ConstantCandidate>;
133 ConstCandVecType ConstCandVec;
151 void collectConstantCandidates(
Function &Fn);
152 void findAndMakeBaseConstant(ConstCandVecType::iterator S,
153 ConstCandVecType::iterator
E);
154 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,
155 ConstCandVecType::iterator E,
156 ConstCandVecType::iterator &MaxCostItr);
157 void findBaseConstants();
160 bool emitBaseConstants();
161 void deleteDeadCastInst()
const;
162 bool optimizeConstants(
Function &Fn);
167 #endif // LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H void push_back(const T &Elt)
static bool runImpl(Function &F, TargetLibraryInfo &TLI, DominatorTree &DT)
This is the entry point for all transforms.
A base constant and all its rebased constants.
Compute iterated dominance frontiers using a linear time algorithm.
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. ...
RebasedConstantInfo(ConstantUseListType &&Uses, Constant *Offset)
A CRTP mix-in to automatically provide informational APIs needed for passes.
ConstantCandidate(ConstantInt *ConstInt)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
ConstantInt * BaseConstant
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.
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...
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.