43 std::unique_ptr<Module> New =
57 I->isConstant(),
I->getLinkage(),
60 I->getThreadLocalMode(),
61 I->getType()->getAddressSpace());
69 I.getLinkage(),
I.getName(), New.get());
77 if (!ShouldCloneDefinition(&*
I)) {
83 if (
I->getValueType()->isFunctionTy())
91 I->getThreadLocalMode(),
I->getType()->getAddressSpace());
99 I->getType()->getPointerAddressSpace(),
100 I->getLinkage(),
I->getName(), New.get());
111 if (
I->isDeclaration())
115 if (!ShouldCloneDefinition(&*
I)) {
120 if (
I->hasInitializer())
124 I->getAllMetadata(MDs);
132 if (
I.isDeclaration())
136 if (!ShouldCloneDefinition(&
I)) {
147 DestI->setName(J->getName());
148 VMap[&*J] = &*DestI++;
154 if (
I.hasPersonalityFn())
162 if (!ShouldCloneDefinition(&*
I))
171 E = M->named_metadata_end();
I !=
E; ++
I) {
StringRef getName() const
virtual void copyAttributesFrom(const GlobalValue *Src)
Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...
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.
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
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.
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...
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
global_iterator global_begin()
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
This is an important base class in LLVM.
LLVMModuleRef LLVMCloneModule(LLVMModuleRef M)
Return an exact copy of the specified module.
MDNode * getOperand(unsigned i) const
void copyAttributesFrom(const GlobalValue *Src) override
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
std::unique_ptr< Module > CloneModule(const Module *M)
Return an exact copy of the specified module.
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.
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
global_iterator global_end()
Iterator for intrusive lists based on ilist_node.
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.
void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
void setLinkage(LinkageTypes LT)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
LLVMAttributeRef wrap(Attribute Attr)
void copyAttributesFrom(const GlobalValue *Src) override
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
unsigned getNumOperands() const
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
void setPersonalityFn(Constant *Fn)
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.
LLVMContext & getContext() const
Get the global data context.