@@ -48,19 +48,20 @@ class SpirvInstruction {
4848 // "Metadata" kinds
4949 // In the order of logical layout
5050
51- IK_Capability, // OpCapability
52- IK_Extension, // OpExtension
53- IK_ExtInstImport, // OpExtInstImport
54- IK_MemoryModel, // OpMemoryModel
55- IK_EntryPoint, // OpEntryPoint
56- IK_ExecutionMode, // OpExecutionMode
57- IK_ExecutionModeId, // OpExecutionModeId
58- IK_String, // OpString (debug)
59- IK_Source, // OpSource (debug)
60- IK_ModuleProcessed, // OpModuleProcessed (debug)
61- IK_Decoration, // Op*Decorate
62- IK_Type, // OpType*
63- IK_Variable, // OpVariable
51+ IK_Capability, // OpCapability
52+ IK_Extension, // OpExtension
53+ IK_ExtInstImport, // OpExtInstImport
54+ IK_MemoryModel, // OpMemoryModel
55+ IK_EntryPoint, // OpEntryPoint
56+ IK_ExecutionMode, // OpExecutionMode
57+ IK_ExecutionModeId, // OpExecutionModeId
58+ IK_String, // OpString (debug)
59+ IK_Source, // OpSource (debug)
60+ IK_ModuleProcessed, // OpModuleProcessed (debug)
61+ IK_Decoration, // Op*Decorate
62+ IK_Type, // OpType*
63+ IK_Variable, // OpVariable
64+ IK_UntypedVariableKHR, // OpUntypedVariableKHR
6465
6566 // Different kind of constants. Order matters.
6667 IK_ConstantBoolean,
@@ -73,6 +74,7 @@ class SpirvInstruction {
7374 // Pointer <-> uint conversions.
7475 IK_ConvertPtrToU,
7576 IK_ConvertUToPtr,
77+ IK_BufferPointerEXT, // OpBufferPointerEXT
7678
7779 // OpUndef
7880 IK_Undef,
@@ -101,6 +103,7 @@ class SpirvInstruction {
101103 // In alphabetical order
102104
103105 IK_AccessChain, // OpAccessChain
106+ IK_UntypedAccessChainKHR, // OpUntypedAccessChainKHR
104107 IK_ArrayLength, // OpArrayLength
105108 IK_Atomic, // OpAtomic*
106109 IK_Barrier, // Op*Barrier
@@ -123,23 +126,24 @@ class SpirvInstruction {
123126
124127 IK_GroupNonUniformOp, // Group non-uniform operations
125128
126- IK_ImageOp, // OpImage*
127- IK_ImageQuery, // OpImageQuery*
128- IK_ImageSparseTexelsResident, // OpImageSparseTexelsResident
129- IK_ImageTexelPointer, // OpImageTexelPointer
130- IK_Load, // OpLoad
131- IK_RayQueryOpKHR, // KHR rayquery ops
132- IK_RayTracingOpNV, // NV raytracing ops
133- IK_ReadClock, // OpReadClock
134- IK_SampledImage, // OpSampledImage
135- IK_Select, // OpSelect
136- IK_SpecConstantBinaryOp, // SpecConstant binary operations
137- IK_SpecConstantUnaryOp, // SpecConstant unary operations
138- IK_Store, // OpStore
139- IK_UnaryOp, // Unary operations
140- IK_NullaryOp, // Nullary operations
141- IK_VectorShuffle, // OpVectorShuffle
142- IK_SpirvIntrinsicInstruction, // Spirv Intrinsic Instructions
129+ IK_ImageOp, // OpImage*
130+ IK_ImageQuery, // OpImageQuery*
131+ IK_ImageSparseTexelsResident, // OpImageSparseTexelsResident
132+ IK_ImageTexelPointer, // OpImageTexelPointer
133+ IK_UntypedImageTexelPointerEXT, // OpUntypedImageTexelPointerEXT
134+ IK_Load, // OpLoad
135+ IK_RayQueryOpKHR, // KHR rayquery ops
136+ IK_RayTracingOpNV, // NV raytracing ops
137+ IK_ReadClock, // OpReadClock
138+ IK_SampledImage, // OpSampledImage
139+ IK_Select, // OpSelect
140+ IK_SpecConstantBinaryOp, // SpecConstant binary operations
141+ IK_SpecConstantUnaryOp, // SpecConstant unary operations
142+ IK_Store, // OpStore
143+ IK_UnaryOp, // Unary operations
144+ IK_NullaryOp, // Nullary operations
145+ IK_VectorShuffle, // OpVectorShuffle
146+ IK_SpirvIntrinsicInstruction, // Spirv Intrinsic Instructions
143147
144148 // For DebugInfo instructions defined in
145149 // OpenCL.DebugInfo.100 and NonSemantic.Shader.DebugInfo.100
@@ -387,7 +391,7 @@ class SpirvEntryPoint : public SpirvInstruction {
387391public:
388392 SpirvEntryPoint (SourceLocation loc, spv::ExecutionModel executionModel,
389393 SpirvFunction *entryPoint, llvm::StringRef nameStr,
390- llvm::ArrayRef<SpirvVariable *> iface);
394+ llvm::ArrayRef<SpirvInstruction *> iface);
391395
392396 DEFINE_RELEASE_MEMORY_FOR_CLASS (SpirvEntryPoint)
393397
@@ -401,13 +405,15 @@ class SpirvEntryPoint : public SpirvInstruction {
401405 spv::ExecutionModel getExecModel () const { return execModel; }
402406 SpirvFunction *getEntryPoint () const { return entryPoint; }
403407 llvm::StringRef getEntryPointName () const { return name; }
404- llvm::ArrayRef<SpirvVariable *> getInterface () const { return interfaceVec; }
408+ llvm::ArrayRef<SpirvInstruction *> getInterface () const {
409+ return interfaceVec;
410+ }
405411
406412private:
407413 spv::ExecutionModel execModel;
408414 SpirvFunction *entryPoint;
409415 std::string name;
410- llvm::SmallVector<SpirvVariable *, 8 > interfaceVec;
416+ llvm::SmallVector<SpirvInstruction *, 8 > interfaceVec;
411417};
412418
413419class SpirvExecutionModeBase : public SpirvInstruction {
@@ -640,6 +646,52 @@ class SpirvVariable : public SpirvInstruction {
640646 std::string hlslUserType;
641647};
642648
649+ // / \brief OpUntypedVariableKHR instruction
650+ class SpirvUntypedVariableKHR : public SpirvInstruction {
651+ public:
652+ SpirvUntypedVariableKHR (QualType resultType, SourceLocation loc,
653+ spv::StorageClass sc);
654+
655+ SpirvUntypedVariableKHR (const SpirvType *spvType, SourceLocation loc,
656+ spv::StorageClass sc);
657+
658+ DEFINE_RELEASE_MEMORY_FOR_CLASS (SpirvUntypedVariableKHR)
659+
660+ // For LLVM-style RTTI
661+ static bool classof (const SpirvInstruction *inst) {
662+ return inst->getKind () == IK_UntypedVariableKHR;
663+ }
664+
665+ bool invokeVisitor (Visitor *v) override ;
666+ };
667+
668+ // / \brief Untyped Access Chain instruction representation
669+ // / (OpUntypedAccessChainKHR)
670+ class SpirvUntypedAccessChainKHR : public SpirvInstruction {
671+ public:
672+ SpirvUntypedAccessChainKHR (const SpirvType *resultType, SourceLocation loc,
673+ const SpirvType *baseType, SpirvInstruction *base,
674+ llvm::ArrayRef<SpirvInstruction *> indexVec);
675+
676+ DEFINE_RELEASE_MEMORY_FOR_CLASS (SpirvUntypedAccessChainKHR)
677+
678+ // For LLVM-style RTTI
679+ static bool classof (const SpirvInstruction *inst) {
680+ return inst->getKind () == IK_UntypedAccessChainKHR;
681+ }
682+
683+ bool invokeVisitor (Visitor *v) override ;
684+
685+ SpirvInstruction *getBase () const { return base; }
686+ const SpirvType *getBaseType () const { return baseType; };
687+ llvm::ArrayRef<SpirvInstruction *> getIndices () const { return indices; }
688+
689+ private:
690+ const SpirvType *baseType;
691+ SpirvInstruction *base;
692+ llvm::SmallVector<SpirvInstruction *, 4 > indices;
693+ };
694+
643695class SpirvFunctionParameter : public SpirvInstruction {
644696public:
645697 SpirvFunctionParameter (QualType resultType, bool isPrecise, bool isNointerp,
@@ -1542,6 +1594,26 @@ class SpirvConvertUToPtr : public SpirvInstruction {
15421594 SpirvInstruction *val;
15431595};
15441596
1597+ class SpirvBufferPointerEXT : public SpirvInstruction {
1598+ public:
1599+ SpirvBufferPointerEXT (const SpirvType *resultType, SourceLocation loc,
1600+ SpirvInstruction *buffer);
1601+
1602+ DEFINE_RELEASE_MEMORY_FOR_CLASS (SpirvBufferPointerEXT)
1603+
1604+ // For LLVM-style RTTI
1605+ static bool classof (const SpirvInstruction *inst) {
1606+ return inst->getKind () == IK_BufferPointerEXT;
1607+ }
1608+
1609+ bool invokeVisitor (Visitor *v) override ;
1610+
1611+ SpirvInstruction *getBuffer () const { return buffer; }
1612+
1613+ private:
1614+ SpirvInstruction *buffer;
1615+ };
1616+
15451617class SpirvUndef : public SpirvInstruction {
15461618public:
15471619 SpirvUndef (QualType type);
@@ -2002,6 +2074,32 @@ class SpirvImageTexelPointer : public SpirvInstruction {
20022074 SpirvInstruction *sample;
20032075};
20042076
2077+ class SpirvUntypedImageTexelPointerEXT : public SpirvInstruction {
2078+ public:
2079+ SpirvUntypedImageTexelPointerEXT (QualType resultType, SourceLocation loc,
2080+ SpirvInstruction *image,
2081+ SpirvInstruction *coordinate,
2082+ SpirvInstruction *sample);
2083+
2084+ DEFINE_RELEASE_MEMORY_FOR_CLASS (SpirvUntypedImageTexelPointerEXT)
2085+
2086+ // For LLVM-style RTTI
2087+ static bool classof (const SpirvInstruction *inst) {
2088+ return inst->getKind () == IK_UntypedImageTexelPointerEXT;
2089+ }
2090+
2091+ bool invokeVisitor (Visitor *v) override ;
2092+
2093+ SpirvInstruction *getImage () const { return image; }
2094+ SpirvInstruction *getCoordinate () const { return coordinate; }
2095+ SpirvInstruction *getSample () const { return sample; }
2096+
2097+ private:
2098+ SpirvInstruction *image;
2099+ SpirvInstruction *coordinate;
2100+ SpirvInstruction *sample;
2101+ };
2102+
20052103// / \brief Load instruction representation
20062104class SpirvLoad : public SpirvInstruction {
20072105public:
0 commit comments