27 if (Local || Delete) {
63 explicit GVExtractorPass(std::vector<GlobalValue*> &GVs,
65 :
ModulePass(ID), Named(GVs.begin(), GVs.end()), deleteStuff(deleteS) {}
67 bool runOnModule(
Module &M)
override {
86 deleteStuff == (
bool)Named.
count(&*
I) && !
I->isDeclaration();
88 if (
I->hasAvailableExternallyLinkage())
90 if (
I->getName() ==
"llvm.global_ctors")
98 I->setInitializer(
nullptr);
99 I->setComdat(
nullptr);
106 deleteStuff == (
bool)Named.
count(&
F) && !
F.isDeclaration();
108 if (
F.hasAvailableExternallyLinkage())
117 F.setComdat(
nullptr);
127 bool Delete = deleteStuff == (
bool)Named.
count(&*CurI);
131 Type *Ty = CurI->getValueType();
133 CurI->removeFromParent();
137 CurI->getAddressSpace(),
138 CurI->getName(), &M);
143 nullptr, CurI->getName());
146 CurI->replaceAllUsesWith(Declaration);
160 return new GVExtractorPass(GVs, deleteFn);
void setVisibility(VisibilityTypes V)
bool hasLocalLinkage() const
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
Same, but only replaced by something equivalent.
ModulePass * createGVExtractionPass(std::vector< GlobalValue *> &GVs, bool deleteFn=false)
createGVExtractionPass - If deleteFn is true, this pass deletes the specified global values...
Externally visible function.
void setModuleInlineAsm(StringRef Asm)
Set the module-scope inline assembly blocks.
global_iterator global_begin()
Class to represent function types.
LinkageTypes getLinkage() const
bool hasLinkOnceLinkage() const
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
Same, but only replaced by something equivalent.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
The instances of the Type class are immutable: once they are created, they are never changed...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Keep one copy of named function when linking (weak)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
A vector that has set insertion semantics.