36 #ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
37 #define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
83 :
Uses(std::move(
Uses)), Offset(Offset) { }
105 ClonedCastMap.clear();
106 ConstCandVec.clear();
111 typedef std::vector<consthoist::ConstantCandidate> ConstCandVecType;
118 ConstCandVecType ConstCandVec;
129 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
132 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
134 void collectConstantCandidates(
Function &Fn);
135 void findAndMakeBaseConstant(ConstCandVecType::iterator S,
136 ConstCandVecType::iterator
E);
137 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,
138 ConstCandVecType::iterator
E,
139 ConstCandVecType::iterator &MaxCostItr);
140 void findBaseConstants();
143 bool emitBaseConstants();
144 void deleteDeadCastInst()
const;
145 bool optimizeConstants(
Function &Fn);
149 #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. ...
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BasicBlock &Entry)
Optimize expensive integer constants in the given function.
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...
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
ConstantInt * BaseConstant
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...
This is the shared class of boolean and integer constants.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
SmallVector< ConstantUser, 8 > ConstantUseListType
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.