26 DC->setSelectionKind(
SC->getSelectionKind());
50 std::unique_ptr<Module> New =
51 std::make_unique<Module>(M.getModuleIdentifier(), M.getContext());
52 New->setSourceFileName(M.getSourceFileName());
53 New->setDataLayout(M.getDataLayout());
54 New->setTargetTriple(M.getTargetTriple());
55 New->setModuleInlineAsm(M.getModuleInlineAsm());
65 I->isConstant(),
I->getLinkage(),
68 I->getThreadLocalMode(),
69 I->getType()->getAddressSpace());
78 I.getAddressSpace(),
I.getName(), New.get());
86 if (!ShouldCloneDefinition(&*
I)) {
92 if (
I->getValueType()->isFunctionTy())
95 I->getAddressSpace(),
I->getName(), New.get());
99 nullptr,
I->getName(),
nullptr,
100 I->getThreadLocalMode(),
I->getType()->getAddressSpace());
108 I->getType()->getPointerAddressSpace(),
109 I->getLinkage(),
I->getName(), New.get());
123 I->getAllMetadata(MDs);
128 if (
I->isDeclaration())
131 if (!ShouldCloneDefinition(&*
I)) {
136 if (
I->hasInitializer())
145 if (
I.isDeclaration())
149 if (!ShouldCloneDefinition(&
I)) {
153 F->setPersonalityFn(
nullptr);
161 VMap[&*J] = &*DestI++;
167 if (
I.hasPersonalityFn())
168 F->setPersonalityFn(
MapValue(
I.getPersonalityFn(), VMap));
177 if (!ShouldCloneDefinition(&*
I))
185 const auto* LLVM_DBG_CU = M.getNamedMetadata(
"llvm.dbg.cu");
187 E = M.named_metadata_end();
191 if (&NMD == LLVM_DBG_CU) {
194 for (
const auto* Operand : NewNMD->
operands())
196 for (
const auto* Operand : NMD.
operands()) {
198 if (Visited.
insert(MappedOperand).second)
This class represents an incoming formal argument to a Function.
MDNode * getOperand(unsigned i) const
This class represents lattice values for constants.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
A Module instance is used to store all the information related to an LLVM module.
void addOperand(MDNode *M)
An efficient, type-erasing, non-owning reference to a callable.
Externally visible function.
Metadata * MapMetadata(const Metadata *MD, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Lookup or compute a mapping for a piece of metadata.
static ManagedStatic< DebugCounter > DC
Attribute unwrap(LLVMAttributeRef Attr)
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
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.
unsigned getNumOperands() const
void setName(const Twine &Name)
Change the name of the value.
Instruct the remapper to move distinct metadata instead of duplicating it when there are module-level...
void setComdat(Comdat *C)
iterator_range< op_iterator > operands()
std::unique_ptr< Module > CloneModule(const Module &M)
Return an exact copy of the specified module.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void copyAttributesFrom(const Function *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
LLVMModuleRef LLVMCloneModule(LLVMModuleRef M)
Return an exact copy of the specified module.
void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static void copyComdat(GlobalObject *Dst, const GlobalObject *Src)
Comdat * getOrInsertComdat(StringRef Name)
Return the Comdat in the module with the specified name.
Value * MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Look up or compute a value in the value map.
Iterator for intrusive lists based on ilist_node.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void copyAttributesFrom(const GlobalValue *Src)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Module.h This file contains the declarations for the Module class.
CHAIN = SC CHAIN, Imm128 - System call.
void setLinkage(LinkageTypes LT)
StringRef getName() const
const Comdat * getComdat() const
LLVMAttributeRef wrap(Attribute Attr)
void copyAttributesFrom(const GlobalVariable *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
Module * getParent()
Get the module that this global value is contained inside of...
static GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
void setAliasee(Constant *Aliasee)
These methods retrieve and set alias target.