Go to the documentation of this file.
36 #ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
37 #define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
51 class BlockFrequencyInfo;
59 class ProfileSummaryInfo;
60 class TargetTransformInfo;
133 ClonedCastMap.clear();
134 ConstIntCandVec.clear();
135 for (
auto MapEntry : ConstGEPCandMap)
136 MapEntry.second.clear();
137 ConstGEPCandMap.clear();
138 ConstIntInfoVec.
clear();
139 for (
auto MapEntry : ConstGEPInfoMap)
140 MapEntry.second.clear();
141 ConstGEPInfoMap.clear();
157 using ConstCandVecType = std::vector<consthoist::ConstantCandidate>;
159 ConstCandVecType ConstIntCandVec;
160 GVCandVecMapType ConstGEPCandMap;
165 ConstInfoVecType ConstIntInfoVec;
166 GVInfoVecMapType ConstGEPInfoMap;
174 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
177 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
180 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
182 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
184 void collectConstantCandidates(
Function &Fn);
185 void findAndMakeBaseConstant(ConstCandVecType::iterator
S,
186 ConstCandVecType::iterator
E,
188 unsigned maximizeConstantsInRange(ConstCandVecType::iterator
S,
189 ConstCandVecType::iterator
E,
190 ConstCandVecType::iterator &MaxCostItr);
199 void deleteDeadCastInst()
const;
204 #endif // LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
ConstantUser(Instruction *Inst, unsigned Idx)
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
A parsed version of the target data layout string in and methods for querying it.
Keeps track of a constant candidate and its uses.
A CRTP mix-in to automatically provide informational APIs needed for passes.
RebasedConstantListType RebasedConstants
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Basic Block Representation.
This is the shared class of boolean and integer constants.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry, ProfileSummaryInfo *PSI)
Optimize expensive integer constants in the given function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
void addUser(Instruction *Inst, unsigned Idx, unsigned Cost)
Add the user to the use list and update the cost.
Keeps track of the user of a constant and the operand index where the constant is used.
Analysis providing profile information.
RebasedConstantInfo(ConstantUseListType &&Uses, Constant *Offset, Type *Ty=nullptr)
This is an important base class in LLVM.
This is an important class for using LLVM in a threaded context.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
@ BasicBlock
Various leaf nodes.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
A base constant and all its rebased constants.
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
A constant value that is initialized with an expression using other constant values.
ConstantCandidate(ConstantInt *ConstInt, ConstantExpr *ConstExpr=nullptr)
This represents a constant that has been rebased with respect to a base constant.
A container for analyses that lazily runs them and caches their results.