[clang] [llvm] [SPIR-V] Implement SPV_KHR_untyped_pointers extension (PR #201233)
Marcos Maronas via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 07:18:47 PDT 2026
================
@@ -1464,6 +1497,23 @@ unsigned SPIRVGlobalRegistry::getNumScalarOrVectorTotalBitWidth(
: 0;
}
+bool SPIRVGlobalRegistry::isSpecialOpaqueElementType(
+ SPIRVTypeInst ElemType) const {
+ // A function pointer has to keep its function type, which an untyped pointer
+ // cannot express.
+ if (ElemType && ElemType->getOpcode() == SPIRV::OpTypeFunction)
+ return true;
+ auto It = SPIRVToLLVMType.find(ElemType);
+ return It != SPIRVToLLVMType.end() && It->second &&
+ isSpecialOpaqueType(It->second);
+}
+
+bool SPIRVGlobalRegistry::shouldUseUntypedPointer(
+ SPIRVTypeInst ElemType, const SPIRVSubtarget &ST) const {
+ return ST.canUseExtension(SPIRV::Extension::SPV_KHR_untyped_pointers) &&
+ !ST.isShader() && !isSpecialOpaqueElementType(ElemType);
----------------
maarquitos14 wrote:
Shader is not supported here because of an implementation decision we made, but it is supported by the spec, isn't it? If so, might deserve a comment explaining it?
https://github.com/llvm/llvm-project/pull/201233
More information about the llvm-commits
mailing list