LLVM 22.0.0git
Cloning.h File Reference
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InlineCost.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <functional>
#include <memory>
#include <vector>

Go to the source code of this file.

Classes

struct  llvm::ClonedCodeInfo
 This struct can be used to capture information about code being cloned, while it is being cloned. More...
class  llvm::InlineFunctionInfo
 This class captures the data input to the InlineFunction call, and records the auxiliary results produced by it. More...

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Enumerations

enum class  llvm::CloneFunctionChangeType { llvm::LocalChangesOnly , llvm::GlobalChanges , llvm::DifferentModule , llvm::ClonedModule }

Functions

LLVM_ABI std::unique_ptr< Modulellvm::CloneModule (const Module &M)
 Return an exact copy of the specified module.
LLVM_ABI std::unique_ptr< Modulellvm::CloneModule (const Module &M, ValueToValueMapTy &VMap)
LLVM_ABI std::unique_ptr< Modulellvm::CloneModule (const Module &M, ValueToValueMapTy &VMap, function_ref< bool(const GlobalValue *)> ShouldCloneDefinition)
 Return a copy of the specified module.
LLVM_ABI BasicBlockllvm::CloneBasicBlock (const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix="", Function *F=nullptr, ClonedCodeInfo *CodeInfo=nullptr, bool MapAtoms=true)
 Return a copy of the specified basic block, but without embedding the block into a particular function.
LLVM_ABI void llvm::mapAtomInstance (const DebugLoc &DL, ValueToValueMapTy &VMap)
 Mark a cloned instruction as a new instance so that its source loc can be updated when remapped.
LLVM_ABI Functionllvm::CloneFunction (Function *F, ValueToValueMapTy &VMap, ClonedCodeInfo *CodeInfo=nullptr)
 Return a copy of the specified function and add it to that function's module.
LLVM_ABI void llvm::CloneFunctionInto (Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, CloneFunctionChangeType Changes, 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.
LLVM_ABI void llvm::CloneFunctionAttributesInto (Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, bool ModuleLevelChanges, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
 Clone OldFunc's attributes into NewFunc, transforming values based on the mappings in VMap.
LLVM_ABI void llvm::CloneFunctionMetadataInto (Function &NewFunc, const Function &OldFunc, ValueToValueMapTy &VMap, RemapFlags RemapFlag, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
 Clone OldFunc's metadata into NewFunc.
LLVM_ABI void llvm::CloneFunctionBodyInto (Function &NewFunc, const Function &OldFunc, ValueToValueMapTy &VMap, RemapFlags RemapFlag, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
 Clone OldFunc's body into NewFunc.
LLVM_ABI void llvm::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.
LLVM_ABI void llvm::CloneAndPruneFunctionInto (Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr)
 This works exactly like CloneFunctionInto, except that it does some simple constant prop and DCE on the fly.
LLVM_ABI InlineResult llvm::CanInlineCallSite (const CallBase &CB, InlineFunctionInfo &IFI)
 Check if it is legal to perform inlining of the function called by CB into the caller at this particular use, and sets fields in IFI.
LLVM_ABI void llvm::InlineFunctionImpl (CallBase &CB, InlineFunctionInfo &IFI, bool MergeAttributes=false, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true, Function *ForwardVarArgsTo=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 This should generally not be used, use InlineFunction instead.
LLVM_ABI InlineResult llvm::InlineFunction (CallBase &CB, InlineFunctionInfo &IFI, bool MergeAttributes=false, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true, Function *ForwardVarArgsTo=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 This function inlines the called function into the basic block of the caller.
LLVM_ABI InlineResult llvm::InlineFunction (CallBase &CB, InlineFunctionInfo &IFI, PGOContextualProfile &CtxProf, bool MergeAttributes=false, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true, Function *ForwardVarArgsTo=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 Same as above, but it will update the contextual profile.
LLVM_ABI Loopllvm::cloneLoopWithPreheader (BasicBlock *Before, BasicBlock *LoopDomBB, Loop *OrigLoop, ValueToValueMapTy &VMap, const Twine &NameSuffix, LoopInfo *LI, DominatorTree *DT, SmallVectorImpl< BasicBlock * > &Blocks)
 Clones a loop OrigLoop.
LLVM_ABI void llvm::remapInstructionsInBlocks (ArrayRef< BasicBlock * > Blocks, ValueToValueMapTy &VMap)
 Remaps instructions in Blocks using the mapping in VMap.
LLVM_ABI BasicBlockllvm::DuplicateInstructionsInSplitBetween (BasicBlock *BB, BasicBlock *PredBB, Instruction *StopAt, ValueToValueMapTy &ValueMapping, DomTreeUpdater &DTU)
 Split edge between BB and PredBB and duplicate all non-Phi instructions from BB between its beginning and the StopAt instruction into the split block.
LLVM_ABI void llvm::updateProfileCallee (Function *Callee, int64_t EntryDelta, const ValueMap< const Value *, WeakTrackingVH > *VMap=nullptr)
 Updates profile information by adjusting the entry count by adding EntryDelta then scaling callsite information by the new count divided by the old count.
LLVM_ABI void llvm::identifyNoAliasScopesToClone (ArrayRef< BasicBlock * > BBs, SmallVectorImpl< MDNode * > &NoAliasDeclScopes)
 Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified basic blocks and extract their scope.
LLVM_ABI void llvm::identifyNoAliasScopesToClone (BasicBlock::iterator Start, BasicBlock::iterator End, SmallVectorImpl< MDNode * > &NoAliasDeclScopes)
 Find the 'llvm.experimental.noalias.scope.decl' intrinsics in the specified instruction range and extract their scope.
LLVM_ABI void llvm::cloneNoAliasScopes (ArrayRef< MDNode * > NoAliasDeclScopes, DenseMap< MDNode *, MDNode * > &ClonedScopes, StringRef Ext, LLVMContext &Context)
 Duplicate the specified list of noalias decl scopes.
LLVM_ABI void llvm::adaptNoAliasScopes (llvm::Instruction *I, const DenseMap< MDNode *, MDNode * > &ClonedScopes, LLVMContext &Context)
 Adapt the metadata for the specified instruction according to the provided mapping.
LLVM_ABI void llvm::cloneAndAdaptNoAliasScopes (ArrayRef< MDNode * > NoAliasDeclScopes, ArrayRef< BasicBlock * > NewBlocks, LLVMContext &Context, StringRef Ext)
 Clone the specified noalias decl scopes.
LLVM_ABI void llvm::cloneAndAdaptNoAliasScopes (ArrayRef< MDNode * > NoAliasDeclScopes, Instruction *IStart, Instruction *IEnd, LLVMContext &Context, StringRef Ext)
 Clone the specified noalias decl scopes.