36#ifndef LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
37#define LLVM_TRANSFORMS_SCALAR_CONSTANTHOISTING_H
137 ClonedCastMap.clear();
138 ConstIntCandVec.clear();
139 ConstGEPCandMap.clear();
140 ConstIntInfoVec.clear();
141 ConstGEPInfoMap.clear();
158 using ConstCandVecType = std::vector<consthoist::ConstantCandidate>;
160 ConstCandVecType ConstIntCandVec;
161 GVCandVecMapType ConstGEPCandMap;
166 ConstInfoVecType ConstIntInfoVec;
167 GVInfoVecMapType ConstGEPInfoMap;
172 void collectMatInsertPts(
176 unsigned Idx = ~0U)
const;
180 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
183 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
186 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
188 void collectConstantCandidates(ConstCandMapType &ConstCandMap,
190 void collectConstantCandidates(
Function &Fn);
191 void findAndMakeBaseConstant(ConstCandVecType::iterator S,
192 ConstCandVecType::iterator
E,
194 unsigned maximizeConstantsInRange(ConstCandVecType::iterator S,
195 ConstCandVecType::iterator
E,
196 ConstCandVecType::iterator &MaxCostItr);
203 struct UserAdjustment {
212 void emitBaseConstants(Instruction *
Base, UserAdjustment *Adj);
215 bool emitBaseConstants(GlobalVariable *BaseGV);
216 void deleteDeadCastInst()
const;
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
This header defines various interfaces for pass management in LLVM.
This file implements a map that provides insertion order iteration.
This file defines the PointerUnion class, which is a discriminated union of pointer types.
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
A constant value that is initialized with an expression using other constant values.
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry, ProfileSummaryInfo *PSI)
Optimize expensive integer constants in the given function.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
This is the shared class of boolean and integer constants.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
This is an important class for using LLVM in a threaded context.
This class implements a map that also provides access to all stored values in a deterministic order.
A discriminated union of two or more pointer types, with the discriminator in the low bits of the poi...
A set of analyses that are preserved following a run of a transformation pass.
Analysis providing profile information.
A vector that has set insertion semantics.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
A private "module" namespace for types and utilities used by ConstantHoisting.
SmallVector< ConstantUser, 8 > ConstantUseListType
SmallVector< RebasedConstantInfo, 4 > RebasedConstantListType
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
Implement std::hash so that hash_code can be used in STL containers.
A CRTP mix-in for passes that can be skipped.
void addUser(Instruction *Inst, unsigned Idx, unsigned Cost)
Add the user to the use list and update the cost.
ConstantCandidate(ConstantInt *ConstInt, ConstantExpr *ConstExpr=nullptr)
A base constant and all its rebased constants.
RebasedConstantListType RebasedConstants
Keeps track of the user of a constant and the operand index where the constant is used.
ConstantUser(Instruction *Inst, unsigned Idx)
RebasedConstantInfo(ConstantUseListType &&Uses, Constant *Offset, Type *Ty=nullptr)