28 if (Local || Delete) {
64 explicit GVExtractorPass(std::vector<GlobalValue*> &GVs,
66 :
ModulePass(ID), Named(GVs.begin(), GVs.end()), deleteStuff(deleteS) {}
68 bool runOnModule(
Module &M)
override {
87 deleteStuff == (
bool)Named.
count(&*
I) && !
I->isDeclaration();
89 if (
I->hasAvailableExternallyLinkage())
91 if (
I->getName() ==
"llvm.global_ctors")
99 I->setInitializer(
nullptr);
100 I->setComdat(
nullptr);
107 deleteStuff == (
bool)Named.
count(&
F) && !
F.isDeclaration();
109 if (
F.hasAvailableExternallyLinkage())
118 F.setComdat(
nullptr);
128 bool Delete = deleteStuff == (
bool)Named.
count(&*CurI);
132 Type *Ty = CurI->getValueType();
134 CurI->removeFromParent();
138 CurI->getAddressSpace(),
139 CurI->getName(), &M);
144 nullptr, CurI->getName());
147 CurI->replaceAllUsesWith(Declaration);
161 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.