30 if (Local || Delete) {
67 explicit GVExtractorPass(std::vector<GlobalValue*>& GVs,
bool deleteS =
true)
70 bool runOnModule(
Module &M)
override {
89 deleteStuff == (
bool)Named.count(&*
I) && !
I->isDeclaration();
91 if (
I->hasAvailableExternallyLinkage())
93 if (
I->getName() ==
"llvm.global_ctors")
101 I->setInitializer(
nullptr);
102 I->setComdat(
nullptr);
109 deleteStuff == (
bool)Named.count(&
F) && !
F.isDeclaration();
111 if (
F.hasAvailableExternallyLinkage())
120 F.setComdat(
nullptr);
130 bool Delete = deleteStuff == (
bool)Named.count(&*CurI);
134 Type *Ty = CurI->getValueType();
136 CurI->removeFromParent();
140 CurI->getName(), &M);
145 nullptr, CurI->getName());
148 CurI->replaceAllUsesWith(Declaration);
162 return new GVExtractorPass(GVs, deleteFn);
void setVisibility(VisibilityTypes V)
const_iterator end(StringRef path)
Get end iterator over path.
LinkageTypes getLinkage() const
A Module instance is used to store all the information related to an LLVM module. ...
Same, but only replaced by something equivalent.
Externally visible function.
const_iterator begin(StringRef path)
Get begin iterator over path.
void setModuleInlineAsm(StringRef Asm)
Set the module-scope inline assembly blocks.
global_iterator global_begin()
Class to represent function types.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
Same, but only replaced by something equivalent.
The instances of the Type class are immutable: once they are created, they are never changed...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
global_iterator global_end()
Iterator for intrusive lists based on ilist_node.
Keep one copy of function when linking (inline)
Module.h This file contains the declarations for the Module class.
void setLinkage(LinkageTypes LT)
bool hasLinkOnceLinkage() const
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Keep one copy of named function when linking (weak)
bool hasLocalLinkage() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
A vector that has set insertion semantics.
ModulePass * createGVExtractionPass(std::vector< GlobalValue * > &GVs, bool deleteFn=false)
createGVExtractionPass - If deleteFn is true, this pass deletes the specified global values...
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)