30 if (Local || Delete) {
67 explicit GVExtractorPass(std::vector<GlobalValue*>& GVs,
bool deleteS =
true)
70 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(
I) && !
I->isDeclaration();
108 if (
I->hasAvailableExternallyLinkage())
117 I->setComdat(
nullptr);
127 bool Delete = deleteStuff == (
bool)Named.count(CurI);
131 Type *Ty = CurI->getType()->getElementType();
133 CurI->removeFromParent();
137 CurI->getName(), &M);
142 nullptr, CurI->getName());
145 CurI->replaceAllUsesWith(Declaration);
159 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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setModuleInlineAsm(StringRef Asm)
Set the module-scope inline assembly blocks.
global_iterator global_begin()
FunctionType - Class to represent function types.
Same, but only replaced by something equivalent.
alias_iterator alias_end()
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...
global_iterator global_end()
Keep one copy of function when linking (inline)
Module.h This file contains the declarations for the Module class.
alias_iterator alias_begin()
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
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)