[llvm] [SPIR-V] Add support for inline SPIR-V types (PR #125316)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 08:57:26 PST 2025


================
@@ -2868,6 +2868,61 @@ static SPIRVType *getSampledImageType(const TargetExtType *OpaqueType,
   return GR->getOrCreateOpTypeSampledImage(OpaqueImageType, MIRBuilder);
 }
 
+static SPIRVType *getInlineSpirvType(const TargetExtType *ExtensionType,
+                                     MachineIRBuilder &MIRBuilder,
+                                     SPIRVGlobalRegistry *GR) {
+  assert(ExtensionType->getNumIntParameters() == 3 &&
+         "Inline SPIR-V type builtin takes an opcode, size, and alignment "
+         "parameter");
+  auto Opcode = ExtensionType->getIntParameter(0);
+
+  return GR->getOrCreateUnknownType(
----------------
s-perron wrote:

We don't need it for this PR, but we should have a follow up issue to see if we can map known opcodes to their actual type. We did this in DXC for pointer to make the pointer interactions work properly. I wonder if we will need it for clang as well.

https://github.com/llvm/llvm-project/pull/125316


More information about the llvm-commits mailing list