21#define DEBUG_TYPE "spirv-prepare-globals"
27struct SPIRVPrepareGlobals :
public ModulePass {
32 return "SPIRV prepare global variables";
35 bool runOnModule(
Module &M)
override;
52 LLVM_DEBUG(
dbgs() <<
"Skipping alias whose aliasee is not a GlobalObject: "
57 if (AO->isInterposable()) {
58 LLVM_DEBUG(
dbgs() <<
"Skipping interposable aliasee: " << AO->getName()
64 <<
" with aliasee: " << AO->getName() <<
"\n");
74bool SPIRVPrepareGlobals::runOnModule(
Module &M) {
78 Changed |= tryReplaceAliasWithAliasee(GA);
83char SPIRVPrepareGlobals::ID = 0;
88 "SPIRV prepare global variables",
false,
false)
92 return new SPIRVPrepareGlobals();
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
LLVM_ABI void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
const Constant * getAliasee() const
LLVM_ABI bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time ...
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
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...
ModulePass * createSPIRVPrepareGlobalsPass()
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.