@@ -207,7 +207,7 @@ SpirvEntryPoint::SpirvEntryPoint(SourceLocation loc,
207207 spv::ExecutionModel executionModel,
208208 SpirvFunction *entryPointFn,
209209 llvm::StringRef nameStr,
210- llvm::ArrayRef<SpirvInstruction *> iface)
210+ llvm::ArrayRef<SpirvVariableLike *> iface)
211211 : SpirvInstruction(IK_EntryPoint, spv::Op::OpEntryPoint, QualType(), loc),
212212 execModel(executionModel), entryPoint(entryPointFn), name(nameStr),
213213 interfaceVec(iface.begin(), iface.end()) {}
@@ -310,7 +310,7 @@ bool SpirvDecoration::operator==(const SpirvDecoration &that) const {
310310SpirvVariable::SpirvVariable (QualType resultType, SourceLocation loc,
311311 spv::StorageClass sc, bool precise,
312312 bool isNointerp, SpirvInstruction *initializerInst)
313- : SpirvInstruction (IK_Variable, spv::Op::OpVariable, resultType, loc),
313+ : SpirvVariableLike (IK_Variable, spv::Op::OpVariable, resultType, loc),
314314 initializer (initializerInst), descriptorSet(-1 ), binding(-1 ),
315315 hlslUserType(" " ) {
316316 setStorageClass (sc);
@@ -321,7 +321,7 @@ SpirvVariable::SpirvVariable(QualType resultType, SourceLocation loc,
321321SpirvVariable::SpirvVariable (const SpirvType *spvType, SourceLocation loc,
322322 spv::StorageClass sc, bool precise,
323323 bool isNointerp, SpirvInstruction *initializerInst)
324- : SpirvInstruction (IK_Variable, spv::Op::OpVariable, QualType(), loc),
324+ : SpirvVariableLike (IK_Variable, spv::Op::OpVariable, QualType(), loc),
325325 initializer(initializerInst), descriptorSet(-1 ), binding(-1 ),
326326 hlslUserType(" " ) {
327327 setResultType (spvType);
@@ -333,20 +333,25 @@ SpirvVariable::SpirvVariable(const SpirvType *spvType, SourceLocation loc,
333333SpirvUntypedVariableKHR::SpirvUntypedVariableKHR (QualType resultType,
334334 SourceLocation loc,
335335 spv::StorageClass sc)
336- : SpirvInstruction (IK_UntypedVariableKHR, spv::Op::OpUntypedVariableKHR,
337- resultType, loc) {
336+ : SpirvVariableLike (IK_UntypedVariableKHR, spv::Op::OpUntypedVariableKHR,
337+ resultType, loc) {
338338 setStorageClass (sc);
339339}
340340
341341SpirvUntypedVariableKHR::SpirvUntypedVariableKHR (const SpirvType *spvType,
342342 SourceLocation loc,
343343 spv::StorageClass sc)
344- : SpirvInstruction (IK_UntypedVariableKHR, spv::Op::OpUntypedVariableKHR,
345- QualType (), loc) {
344+ : SpirvVariableLike (IK_UntypedVariableKHR, spv::Op::OpUntypedVariableKHR,
345+ QualType (), loc) {
346346 setResultType (spvType);
347347 setStorageClass (sc);
348348}
349349
350+ SpirvVariableLike::SpirvVariableLike (Kind kind, spv::Op opcode,
351+ QualType astResultType, SourceLocation loc,
352+ SourceRange range)
353+ : SpirvInstruction(kind, opcode, astResultType, loc, range) {}
354+
350355SpirvUntypedAccessChainKHR::SpirvUntypedAccessChainKHR (
351356 const SpirvType *resultType, SourceLocation loc, const SpirvType *baseType,
352357 SpirvInstruction *baseInst, llvm::ArrayRef<SpirvInstruction *> indexVec)
0 commit comments