18 #ifndef LLVM_TRANSFORMS_UTILS_CLONING_H
19 #define LLVM_TRANSFORMS_UTILS_CLONING_H
36 class BlockFrequencyInfo;
39 class DebugInfoFinder;
47 class ProfileSummaryInfo;
52 std::unique_ptr<Module>
CloneModule(
const Module *M);
59 std::unique_ptr<Module>
61 function_ref<
bool(
const GlobalValue *)> ShouldCloneDefinition);
144 const char *NameSuffix =
"",
153 const char *NameSuffix =
"",
170 const char *NameSuffix =
"",
231 AAResults *CalleeAAR =
nullptr,
bool InsertLifetime =
true);
233 AAResults *CalleeAAR =
nullptr,
bool InsertLifetime =
true);
235 AAResults *CalleeAAR =
nullptr,
bool InsertLifetime =
true);
245 const Twine &NameSuffix, LoopInfo *LI,
247 SmallVectorImpl<BasicBlock *> &Blocks);
265 #endif // LLVM_TRANSFORMS_UTILS_CLONING_H
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
CallGraph * CG
CG - If non-null, InlineFunction will update the callgraph to reflect the changes it makes...
std::function< AssumptionCache &(Function &)> * GetAssumptionCache
Analysis providing profile information.
Function * CloneFunction(Function *F, ValueToValueMapTy &VMap, ClonedCodeInfo *CodeInfo=nullptr)
CloneFunction - Return a copy of the specified function and add it to that function's module...
A cache of .assume calls within a function.
InlineFunctionInfo - This class captures the data input to the InlineFunction call, and records the auxiliary results produced by it.
void remapInstructionsInBlocks(const SmallVectorImpl< BasicBlock * > &Blocks, ValueToValueMapTy &VMap)
Remaps instructions in Blocks using the mapping in VMap.
bool InlineFunction(CallInst *C, InlineFunctionInfo &IFI, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true)
InlineFunction - This function inlines the called function into the basic block of the caller...
void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr, Instruction *TheCall=nullptr)
CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, except that it does some simpl...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Clone OldFunc into NewFunc, transforming the old arguments into references to VMap values...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Utility to find all debug info in a module.
void CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc, const Instruction *StartingInst, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr)
This works like CloneAndPruneFunctionInto, except that it does not clone the entire function...
std::vector< WeakTrackingVH > OperandBundleCallSites
All cloned call sites that have operand bundles attached are appended to this vector.
BlockFrequencyInfo * CalleeBFI
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
This is a class that can be implemented by clients to materialize Values on demand.
SmallVector< CallSite, 8 > InlinedCallSites
All of the new call sites inlined into the caller.
LLVM Basic Block Representation.
std::unique_ptr< Module > CloneModule(const Module *M)
Return an exact copy of the specified module.
InlineFunctionInfo(CallGraph *cg=nullptr, std::function< AssumptionCache &(Function &)> *GetAssumptionCache=nullptr, ProfileSummaryInfo *PSI=nullptr, BlockFrequencyInfo *CallerBFI=nullptr, BlockFrequencyInfo *CalleeBFI=nullptr)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
BasicBlock * CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix="", Function *F=nullptr, ClonedCodeInfo *CodeInfo=nullptr, DebugInfoFinder *DIFinder=nullptr)
CloneBasicBlock - Return a copy of the specified basic block, but without embedding the block into a ...
BasicBlock * DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB, Instruction *StopAt, ValueToValueMapTy &ValueMapping)
Split edge between BB and PredBB and duplicate all non-Phi instructions from BB between its beginning...
Loop * cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB, Loop *OrigLoop, ValueToValueMapTy &VMap, const Twine &NameSuffix, LoopInfo *LI, DominatorTree *DT, SmallVectorImpl< BasicBlock * > &Blocks)
Clones a loop OrigLoop.
This is a class that can be implemented by clients to remap types when cloning constants and instruct...
bool ContainsCalls
ContainsCalls - This is set to true if the cloned code contains a normal call instruction.
SmallVector< AllocaInst *, 4 > StaticAllocas
StaticAllocas - InlineFunction fills this in with all static allocas that get copied into the caller...
The basic data container for the call graph of a Module of IR.
SmallVector< WeakTrackingVH, 8 > InlinedCalls
InlinedCalls - InlineFunction fills this in with callsites that were inlined from the callee...
ClonedCodeInfo - This struct can be used to capture information about code being cloned, while it is being cloned.
Helper struct that represents how a value is mapped through different register banks.
BlockFrequencyInfo * CallerBFI
bool ContainsDynamicAllocas
ContainsDynamicAllocas - This is set to true if the cloned code contains a 'dynamic' alloca...
print Print MemDeps of function