24struct SPIRVPrepareGlobals :
public ModulePass {
26 SPIRVPrepareGlobals() : ModulePass(ID) {}
28 StringRef getPassName()
const override {
29 return "SPIRV prepare global variables";
32 bool runOnModule(
Module &M)
override;
39 if (AT->getNumElements() != 0)
44 Bitcode.replaceInitializer(OneEltInit);
57 constexpr unsigned WorkgroupAS =
59 const bool IsWorkgroupExternal =
61 if (!IsWorkgroupExternal)
65 if (!AT || AT->getNumElements() != 0)
68 constexpr auto UInt32Max = std::numeric_limits<uint32_t>::max();
80bool SPIRVPrepareGlobals::runOnModule(
Module &M) {
81 const bool IsAMD =
M.getTargetTriple().getVendor() ==
Triple::AMD;
86 if (GlobalVariable *
Bitcode =
M.getNamedGlobal(
"llvm.embedded.module"))
90 Changed |= tryExtendDynamicLDSGlobal(GV);
94char SPIRVPrepareGlobals::ID = 0;
99 "SPIRV prepare global variables",
false,
false)
103 return new SPIRVPrepareGlobals();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
This is an important base class in LLVM.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
bool hasExternalLinkage() const
LinkageTypes getLinkage() const
ThreadLocalMode getThreadLocalMode() const
unsigned getAddressSpace() const
Module * getParent()
Get the module that this global value is contained inside of...
Type * getValueType() const
bool isExternallyInitialized() const
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
LLVM_ABI void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
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.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVM_ABI void takeName(Value *V)
Transfer the name from V to this value.
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...
constexpr unsigned storageClassToAddressSpace(SPIRV::StorageClass::StorageClass SC)
ModulePass * createSPIRVPrepareGlobalsPass()
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.