27 if (Local || Delete) {
64 explicit GVExtractorPass(std::vector<GlobalValue*> &GVs,
65 bool deleteS =
true,
bool keepConstInit =
false)
67 keepConstInit(keepConstInit) {}
69 bool runOnModule(
Module &M)
override {
75 M.setModuleInlineAsm(
"");
88 deleteStuff == (
bool)Named.
count(&*
I) && !
I->isDeclaration() &&
89 (!
I->isConstant() || !keepConstInit);
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);
134 Type *Ty = CurI->getValueType();
136 CurI->removeFromParent();
140 CurI->getAddressSpace(),
141 CurI->getName(), &
M);
146 nullptr, CurI->getName());
149 CurI->replaceAllUsesWith(Declaration);
162 bool deleteFn,
bool keepConstInit) {
163 return new GVExtractorPass(GVs, deleteFn, keepConstInit);
void setVisibility(VisibilityTypes V)
const_iterator end(StringRef path)
Get end iterator over path.
bool hasLocalLinkage() const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
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.
Externally visible function.
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")
ModulePass * createGVExtractionPass(std::vector< GlobalValue * > &GVs, bool deleteFn=false, bool keepConstInit=false)
createGVExtractionPass - If deleteFn is true, this pass deletes the specified global values.
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.
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.