36 #ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
37 #define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
84 :
Uses(std::move(
Uses)), Offset(Offset) { }
106 ClonedCastMap.clear();
107 ConstCandVec.clear();
112 typedef std::vector<consthoist::ConstantCandidate> ConstCandVecType;
120 ConstCandVecType ConstCandVec;
131 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
134 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
136 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
138 void collectConstantCandidates(
Function &Fn);
139 void findAndMakeBaseConstant(ConstCandVecType::iterator S,
140 ConstCandVecType::iterator
E);
141 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,
142 ConstCandVecType::iterator
E,
143 ConstCandVecType::iterator &MaxCostItr);
144 void findBaseConstants();
147 bool emitBaseConstants();
148 void deleteDeadCastInst()
const;
149 bool optimizeConstants(
Function &Fn);
153 #endif // LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
void push_back(const T &Elt)
A base constant and all its rebased constants.
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.
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.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
SmallVector< ConstantUser, 8 > ConstantUseListType
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry)
Optimize expensive integer constants in the given function.
ConstantUser(Instruction *Inst, unsigned Idx)
A container for analyses that lazily runs them and caches their results.
RebasedConstantListType RebasedConstants
SmallVector< RebasedConstantInfo, 4 > RebasedConstantListType
This header defines various interfaces for pass management in LLVM.