Go to the documentation of this file.
26 if (Local || Delete) {
63 explicit GVExtractorPass(std::vector<GlobalValue*> &GVs,
64 bool deleteS =
true,
bool keepConstInit =
false)
66 keepConstInit(keepConstInit) {}
68 bool runOnModule(
Module &M)
override {
74 M.setModuleInlineAsm(
"");
85 bool Delete = deleteStuff == (bool)Named.
count(&GV) &&
86 !GV.isDeclaration() &&
87 (!GV.isConstant() || !keepConstInit);
89 if (GV.hasAvailableExternallyLinkage())
91 if (GV.getName() ==
"llvm.global_ctors")
99 GV.setInitializer(
nullptr);
100 GV.setComdat(
nullptr);
107 deleteStuff == (bool)Named.
count(&
F) && !
F.isDeclaration();
109 if (
F.hasAvailableExternallyLinkage())
118 F.setComdat(
nullptr);
124 bool Delete = deleteStuff == (bool)Named.
count(&GA);
128 Type *Ty = GA.getValueType();
130 GA.removeFromParent();
135 GA.getAddressSpace(), GA.getName(), &M);
140 nullptr, GA.getName());
142 GA.replaceAllUsesWith(Declaration);
155 bool deleteFn,
bool keepConstInit) {
156 return new GVExtractorPass(GVs, deleteFn, keepConstInit);
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
LinkageTypes getLinkage() const
@ HiddenVisibility
The GV is hidden.
The instances of the Type class are immutable: once they are created, they are never changed.
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
void setLinkage(LinkageTypes LT)
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasLocalLinkage() const
A Module instance is used to store all the information related to an LLVM module.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ WeakODRLinkage
Same, but only replaced by something equivalent.
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
@ ExternalLinkage
Externally visible function.
bool hasLinkOnceLinkage() const
A vector that has set insertion semantics.
ModulePass * createGVExtractionPass(std::vector< GlobalValue * > &GVs, bool deleteFn=false, bool keepConstInit=false)
createGVExtractionPass - If deleteFn is true, this pass deletes the specified global values.
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
void setVisibility(VisibilityTypes V)
LLVM Value Representation.
Class to represent function types.