18 #ifndef LLVM_TRANSFORMS_UTILS_CLONING_H
19 #define LLVM_TRANSFORMS_UTILS_CLONING_H
49 class AssumptionCacheTracker;
54 std::unique_ptr<Module>
CloneModule(
const Module *M);
61 std::unique_ptr<Module>
63 function_ref<
bool(
const GlobalValue *)> ShouldCloneDefinition);
115 const Twine &NameSuffix =
"", Function *
F =
nullptr,
116 ClonedCodeInfo *CodeInfo =
nullptr);
131 ClonedCodeInfo *CodeInfo =
nullptr);
144 SmallVectorImpl<ReturnInst*> &Returns,
145 const char *NameSuffix =
"",
146 ClonedCodeInfo *CodeInfo =
nullptr,
147 ValueMapTypeRemapper *TypeMapper =
nullptr,
148 ValueMaterializer *Materializer =
nullptr);
151 const Instruction *StartingInst,
153 SmallVectorImpl<ReturnInst *> &Returns,
154 const char *NameSuffix =
"",
155 ClonedCodeInfo *CodeInfo =
nullptr);
170 SmallVectorImpl<ReturnInst*> &Returns,
171 const char *NameSuffix =
"",
172 ClonedCodeInfo *CodeInfo =
nullptr,
173 Instruction *TheCall =
nullptr);
226 AAResults *CalleeAAR =
nullptr,
bool InsertLifetime =
true);
228 AAResults *CalleeAAR =
nullptr,
bool InsertLifetime =
true);
230 AAResults *CalleeAAR =
nullptr,
bool InsertLifetime =
true);
240 const Twine &NameSuffix, LoopInfo *LI,
242 SmallVectorImpl<BasicBlock *> &Blocks);
CallGraph * CG
CG - If non-null, InlineFunction will update the callgraph to reflect the changes it makes...
aarch64 AArch64 CCMP Pass
std::function< AssumptionCache &(Function &)> * GetAssumptionCache
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.
std::vector< WeakVH > OperandBundleCallSites
All cloned call sites that have operand bundles attached are appended to this vector.
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...
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...
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...
Function Alias Analysis false
SmallVector< CallSite, 8 > InlinedCallSites
All of the new call sites inlined into the caller.
SmallVector< WeakVH, 8 > InlinedCalls
InlinedCalls - InlineFunction fills this in with callsites that were inlined from the callee...
ValueMap< const Value *, WeakVH > ValueToValueMapTy
std::unique_ptr< Module > CloneModule(const Module *M)
Return an exact copy of the specified module.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
Loop * cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB, Loop *OrigLoop, ValueToValueMapTy &VMap, const Twine &NameSuffix, LoopInfo *LI, DominatorTree *DT, SmallVectorImpl< BasicBlock * > &Blocks)
Clones a loop OrigLoop.
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.
ClonedCodeInfo - This struct can be used to capture information about code being cloned, while it is being cloned.
bool ContainsDynamicAllocas
ContainsDynamicAllocas - This is set to true if the cloned code contains a 'dynamic' alloca...
InlineFunctionInfo(CallGraph *cg=nullptr, std::function< AssumptionCache &(Function &)> *GetAssumptionCache=nullptr)
print Print MemDeps of function
BasicBlock * CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix="", Function *F=nullptr, ClonedCodeInfo *CodeInfo=nullptr)
CloneBasicBlock - Return a copy of the specified basic block, but without embedding the block into a ...