================
@@ -91,6 +97,88 @@ SPIRVTargetMachine::SPIRVTargetMachine(const Target &T, 
const Triple &TT,
   setRequiresStructuredCFG(false);
 }
 
+enum AddressSpace {
+  Function = storageClassToAddressSpace(SPIRV::StorageClass::Function),
+  CrossWorkgroup =
+      storageClassToAddressSpace(SPIRV::StorageClass::CrossWorkgroup),
+  UniformConstant =
+      storageClassToAddressSpace(SPIRV::StorageClass::UniformConstant),
+  Workgroup = storageClassToAddressSpace(SPIRV::StorageClass::Workgroup),
+  Generic = storageClassToAddressSpace(SPIRV::StorageClass::Generic)
+};
+
+unsigned SPIRVTargetMachine::getAssumedAddrSpace(const Value *V) const {
----------------
AlexVlx wrote:

`UniformConstant` is pretty much OCL `constant` (with a bit of handwavium 
around initializers being allowed depending on an undefined client API). This 
is just saying that if you have a load from that, and you're loading a pointer, 
that pointer can only point to global (CrossWorkgroup), which I think holds 
here as well because there's no legal way to put a private or a local (shared) 
pointer in there (if you do it at static init, before a kernel executes, you 
cannot form those types of addresses, if you do it as the kernel executes it's 
UB). Or are you worried about cases where global does not include constant?

https://github.com/llvm/llvm-project/pull/110897
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to