|
@@ -98,6 +98,9 @@ public:
|
|
|
|
|
|
virtual ~SpirvInstruction() = default;
|
|
virtual ~SpirvInstruction() = default;
|
|
|
|
|
|
|
|
+ // Invokes SPIR-V visitor on this instruction.
|
|
|
|
+ virtual bool invokeVisitor(Visitor *) = 0;
|
|
|
|
+
|
|
Kind getKind() const { return kind; }
|
|
Kind getKind() const { return kind; }
|
|
spv::Op getopcode() const { return opcode; }
|
|
spv::Op getopcode() const { return opcode; }
|
|
QualType getResultType() const { return resultType; }
|
|
QualType getResultType() const { return resultType; }
|
|
@@ -114,9 +117,6 @@ public:
|
|
|
|
|
|
clang::SourceLocation getSourceLocation() const { return srcLoc; }
|
|
clang::SourceLocation getSourceLocation() const { return srcLoc; }
|
|
|
|
|
|
- // Handle SPIR-V instruction visitors.
|
|
|
|
- bool invokeVisitor(Visitor *);
|
|
|
|
-
|
|
|
|
protected:
|
|
protected:
|
|
// Forbid creating SpirvInstruction directly
|
|
// Forbid creating SpirvInstruction directly
|
|
SpirvInstruction(Kind kind, spv::Op opcode, QualType resultType,
|
|
SpirvInstruction(Kind kind, spv::Op opcode, QualType resultType,
|
|
@@ -131,6 +131,9 @@ private:
|
|
SourceLocation srcLoc;
|
|
SourceLocation srcLoc;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+#define DECLARE_INVOKE_VISITOR_FOR_CLASS(cls) \
|
|
|
|
+ bool invokeVisitor(Visitor *v) override;
|
|
|
|
+
|
|
/// \brief OpCapability instruction
|
|
/// \brief OpCapability instruction
|
|
class SpirvCapability : public SpirvInstruction {
|
|
class SpirvCapability : public SpirvInstruction {
|
|
public:
|
|
public:
|
|
@@ -141,6 +144,8 @@ public:
|
|
return inst->getKind() == IK_Capability;
|
|
return inst->getKind() == IK_Capability;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvCapability)
|
|
|
|
+
|
|
spv::Capability getCapability() const { return capability; }
|
|
spv::Capability getCapability() const { return capability; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -157,6 +162,8 @@ public:
|
|
return inst->getKind() == IK_Extension;
|
|
return inst->getKind() == IK_Extension;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvExtension)
|
|
|
|
+
|
|
llvm::StringRef getExtensionName() const { return extName; }
|
|
llvm::StringRef getExtensionName() const { return extName; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -174,6 +181,8 @@ public:
|
|
return inst->getKind() == IK_ExtInstImport;
|
|
return inst->getKind() == IK_ExtInstImport;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvExtInstImport)
|
|
|
|
+
|
|
llvm::StringRef getExtendedInstSetName() const { return extName; }
|
|
llvm::StringRef getExtendedInstSetName() const { return extName; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -190,6 +199,8 @@ public:
|
|
return inst->getKind() == IK_MemoryModel;
|
|
return inst->getKind() == IK_MemoryModel;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvMemoryModel)
|
|
|
|
+
|
|
spv::AddressingModel getAddressingModel() const { return addressModel; }
|
|
spv::AddressingModel getAddressingModel() const { return addressModel; }
|
|
spv::MemoryModel getMemoryModel() const { return memoryModel; }
|
|
spv::MemoryModel getMemoryModel() const { return memoryModel; }
|
|
|
|
|
|
@@ -210,6 +221,8 @@ public:
|
|
return inst->getKind() == IK_EntryPoint;
|
|
return inst->getKind() == IK_EntryPoint;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvEntryPoint)
|
|
|
|
+
|
|
spv::ExecutionModel getExecModel() const { return execModel; }
|
|
spv::ExecutionModel getExecModel() const { return execModel; }
|
|
uint32_t getEntryPointId() const { return entryPoint; }
|
|
uint32_t getEntryPointId() const { return entryPoint; }
|
|
llvm::StringRef getEntryPointName() const { return name; }
|
|
llvm::StringRef getEntryPointName() const { return name; }
|
|
@@ -234,6 +247,8 @@ public:
|
|
return inst->getKind() == IK_ExecutionMode;
|
|
return inst->getKind() == IK_ExecutionMode;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvExecutionMode)
|
|
|
|
+
|
|
uint32_t getEntryPointId() const { return entryPointId; }
|
|
uint32_t getEntryPointId() const { return entryPointId; }
|
|
spv::ExecutionMode getExecutionMode() const { return execMode; }
|
|
spv::ExecutionMode getExecutionMode() const { return execMode; }
|
|
llvm::ArrayRef<uint32_t> getParams() const { return params; }
|
|
llvm::ArrayRef<uint32_t> getParams() const { return params; }
|
|
@@ -254,6 +269,8 @@ public:
|
|
return inst->getKind() == IK_String;
|
|
return inst->getKind() == IK_String;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvString)
|
|
|
|
+
|
|
llvm::StringRef getString() const { return str; }
|
|
llvm::StringRef getString() const { return str; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -271,6 +288,8 @@ public:
|
|
return inst->getKind() == IK_Source;
|
|
return inst->getKind() == IK_Source;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSource)
|
|
|
|
+
|
|
spv::SourceLanguage getSourceLanguage() const { return lang; }
|
|
spv::SourceLanguage getSourceLanguage() const { return lang; }
|
|
uint32_t getVersion() const { return version; }
|
|
uint32_t getVersion() const { return version; }
|
|
bool hasFileId() const { return file != 0; }
|
|
bool hasFileId() const { return file != 0; }
|
|
@@ -295,6 +314,8 @@ public:
|
|
return inst->getKind() == IK_Name;
|
|
return inst->getKind() == IK_Name;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvName)
|
|
|
|
+
|
|
uint32_t getTarget() const { return target; }
|
|
uint32_t getTarget() const { return target; }
|
|
bool isForMember() const { return member.hasValue(); }
|
|
bool isForMember() const { return member.hasValue(); }
|
|
uint32_t getMember() const { return member.getValue(); }
|
|
uint32_t getMember() const { return member.getValue(); }
|
|
@@ -316,6 +337,8 @@ public:
|
|
return inst->getKind() == IK_ModuleProcessed;
|
|
return inst->getKind() == IK_ModuleProcessed;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvModuleProcessed)
|
|
|
|
+
|
|
llvm::StringRef getProcess() const { return process; }
|
|
llvm::StringRef getProcess() const { return process; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -334,6 +357,8 @@ public:
|
|
return inst->getKind() == IK_Decoration;
|
|
return inst->getKind() == IK_Decoration;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvDecoration)
|
|
|
|
+
|
|
// Returns the <result-id> of the target of the decoration. It may be the id
|
|
// Returns the <result-id> of the target of the decoration. It may be the id
|
|
// of an object or the id of a structure type whose member is being decorated.
|
|
// of an object or the id of a structure type whose member is being decorated.
|
|
uint32_t getTarget() const { return target; }
|
|
uint32_t getTarget() const { return target; }
|
|
@@ -361,6 +386,8 @@ public:
|
|
return inst->getKind() == IK_Variable;
|
|
return inst->getKind() == IK_Variable;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvVariable)
|
|
|
|
+
|
|
bool hasInitializer() const { return initializer != 0; }
|
|
bool hasInitializer() const { return initializer != 0; }
|
|
uint32_t getInitializer() const { return initializer; }
|
|
uint32_t getInitializer() const { return initializer; }
|
|
spv::StorageClass getStorageClass() const { return storageClass; }
|
|
spv::StorageClass getStorageClass() const { return storageClass; }
|
|
@@ -379,6 +406,8 @@ public:
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
return inst->getKind() == IK_FunctionParameter;
|
|
return inst->getKind() == IK_FunctionParameter;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvFunctionParameter)
|
|
};
|
|
};
|
|
|
|
|
|
/// \brief Merge instructions include OpLoopMerge and OpSelectionMerge
|
|
/// \brief Merge instructions include OpLoopMerge and OpSelectionMerge
|
|
@@ -396,6 +425,8 @@ protected:
|
|
inst->getKind() == IK_SelectionMerge;
|
|
inst->getKind() == IK_SelectionMerge;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvMerge)
|
|
|
|
+
|
|
private:
|
|
private:
|
|
uint32_t mergeBlock;
|
|
uint32_t mergeBlock;
|
|
};
|
|
};
|
|
@@ -410,6 +441,8 @@ public:
|
|
return inst->getKind() == IK_LoopMerge;
|
|
return inst->getKind() == IK_LoopMerge;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvLoopMerge)
|
|
|
|
+
|
|
uint32_t getContinueTarget() const { return continueTarget; }
|
|
uint32_t getContinueTarget() const { return continueTarget; }
|
|
spv::LoopControlMask getLoopControlMask() const { return loopControlMask; }
|
|
spv::LoopControlMask getLoopControlMask() const { return loopControlMask; }
|
|
|
|
|
|
@@ -428,6 +461,8 @@ public:
|
|
return inst->getKind() == IK_SelectionMerge;
|
|
return inst->getKind() == IK_SelectionMerge;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSelectionMerge)
|
|
|
|
+
|
|
spv::SelectionControlMask getSelectionControlMask() const {
|
|
spv::SelectionControlMask getSelectionControlMask() const {
|
|
return selControlMask;
|
|
return selControlMask;
|
|
}
|
|
}
|
|
@@ -452,6 +487,8 @@ public:
|
|
return inst->getKind() >= IK_Branch && inst->getKind() <= IK_Unreachable;
|
|
return inst->getKind() >= IK_Branch && inst->getKind() <= IK_Unreachable;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvTerminator)
|
|
|
|
+
|
|
protected:
|
|
protected:
|
|
SpirvTerminator(Kind kind, spv::Op opcode, SourceLocation loc);
|
|
SpirvTerminator(Kind kind, spv::Op opcode, SourceLocation loc);
|
|
};
|
|
};
|
|
@@ -465,6 +502,8 @@ public:
|
|
inst->getKind() <= IK_BranchConditional;
|
|
inst->getKind() <= IK_BranchConditional;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBranching)
|
|
|
|
+
|
|
virtual llvm::ArrayRef<uint32_t> getTargetBranches() const = 0;
|
|
virtual llvm::ArrayRef<uint32_t> getTargetBranches() const = 0;
|
|
|
|
|
|
protected:
|
|
protected:
|
|
@@ -481,6 +520,8 @@ public:
|
|
return inst->getKind() == IK_Branch;
|
|
return inst->getKind() == IK_Branch;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBranch)
|
|
|
|
+
|
|
uint32_t getTargetLabel() const { return targetLabel; }
|
|
uint32_t getTargetLabel() const { return targetLabel; }
|
|
|
|
|
|
// Returns all possible branches that could be taken by the branching
|
|
// Returns all possible branches that could be taken by the branching
|
|
@@ -502,6 +543,8 @@ public:
|
|
return inst->getKind() == IK_BranchConditional;
|
|
return inst->getKind() == IK_BranchConditional;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBranchConditional)
|
|
|
|
+
|
|
llvm::ArrayRef<uint32_t> getTargetBranches() const {
|
|
llvm::ArrayRef<uint32_t> getTargetBranches() const {
|
|
return {trueLabel, falseLabel};
|
|
return {trueLabel, falseLabel};
|
|
}
|
|
}
|
|
@@ -525,6 +568,8 @@ public:
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
return inst->getKind() == IK_Kill;
|
|
return inst->getKind() == IK_Kill;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvKill)
|
|
};
|
|
};
|
|
|
|
|
|
/// \brief OpReturn and OpReturnValue instructions
|
|
/// \brief OpReturn and OpReturnValue instructions
|
|
@@ -537,6 +582,8 @@ public:
|
|
return inst->getKind() == IK_Return;
|
|
return inst->getKind() == IK_Return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvReturn)
|
|
|
|
+
|
|
bool hasReturnValue() const { return returnValue != 0; }
|
|
bool hasReturnValue() const { return returnValue != 0; }
|
|
uint32_t getReturnValue() const { return returnValue; }
|
|
uint32_t getReturnValue() const { return returnValue; }
|
|
|
|
|
|
@@ -555,6 +602,8 @@ public:
|
|
return inst->getKind() == IK_Switch;
|
|
return inst->getKind() == IK_Switch;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSwitch)
|
|
|
|
+
|
|
uint32_t getSelector() const { return selector; }
|
|
uint32_t getSelector() const { return selector; }
|
|
uint32_t getDefaultLabel() const { return defaultLabel; }
|
|
uint32_t getDefaultLabel() const { return defaultLabel; }
|
|
llvm::ArrayRef<std::pair<uint32_t, uint32_t>> getTargets() const {
|
|
llvm::ArrayRef<std::pair<uint32_t, uint32_t>> getTargets() const {
|
|
@@ -580,6 +629,8 @@ public:
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
return inst->getKind() == IK_Unreachable;
|
|
return inst->getKind() == IK_Unreachable;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvUnreachable)
|
|
};
|
|
};
|
|
|
|
|
|
/// \brief Access Chain instruction representation (OpAccessChain)
|
|
/// \brief Access Chain instruction representation (OpAccessChain)
|
|
@@ -596,6 +647,8 @@ public:
|
|
return inst->getKind() == IK_AccessChain;
|
|
return inst->getKind() == IK_AccessChain;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvAccessChain)
|
|
|
|
+
|
|
uint32_t getBase() const { return base; }
|
|
uint32_t getBase() const { return base; }
|
|
llvm::ArrayRef<uint32_t> getIndexes() const { return indices; }
|
|
llvm::ArrayRef<uint32_t> getIndexes() const { return indices; }
|
|
|
|
|
|
@@ -641,6 +694,8 @@ public:
|
|
return inst->getKind() == IK_Atomic;
|
|
return inst->getKind() == IK_Atomic;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvAtomic)
|
|
|
|
+
|
|
uint32_t getPointer() const { return pointer; }
|
|
uint32_t getPointer() const { return pointer; }
|
|
spv::Scope getScope() const { return scope; }
|
|
spv::Scope getScope() const { return scope; }
|
|
spv::MemorySemanticsMask getMemorySemantics() const { return memorySemantic; }
|
|
spv::MemorySemanticsMask getMemorySemantics() const { return memorySemantic; }
|
|
@@ -676,6 +731,8 @@ public:
|
|
return inst->getKind() == IK_Barrier;
|
|
return inst->getKind() == IK_Barrier;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBarrier)
|
|
|
|
+
|
|
spv::Scope getMemoryScope() const { return memoryScope; }
|
|
spv::Scope getMemoryScope() const { return memoryScope; }
|
|
spv::MemorySemanticsMask getMemorySemantics() const {
|
|
spv::MemorySemanticsMask getMemorySemantics() const {
|
|
return memorySemantics;
|
|
return memorySemantics;
|
|
@@ -761,6 +818,8 @@ public:
|
|
return inst->getKind() == IK_BinaryOp;
|
|
return inst->getKind() == IK_BinaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBinaryOp)
|
|
|
|
+
|
|
uint32_t getOperand1() const { return operand1; }
|
|
uint32_t getOperand1() const { return operand1; }
|
|
uint32_t getOperand2() const { return operand2; }
|
|
uint32_t getOperand2() const { return operand2; }
|
|
bool isSpecConstantOp() const {
|
|
bool isSpecConstantOp() const {
|
|
@@ -784,6 +843,8 @@ public:
|
|
inst->getKind() == IK_BitFieldInsert;
|
|
inst->getKind() == IK_BitFieldInsert;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBitField)
|
|
|
|
+
|
|
virtual uint32_t getBase() const { return base; }
|
|
virtual uint32_t getBase() const { return base; }
|
|
virtual uint32_t getOffset() const { return offset; }
|
|
virtual uint32_t getOffset() const { return offset; }
|
|
virtual uint32_t getCount() const { return count; }
|
|
virtual uint32_t getCount() const { return count; }
|
|
@@ -810,6 +871,8 @@ public:
|
|
return inst->getKind() == IK_BitFieldExtract;
|
|
return inst->getKind() == IK_BitFieldExtract;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBitFieldExtract)
|
|
|
|
+
|
|
uint32_t isSigned() const {
|
|
uint32_t isSigned() const {
|
|
return getopcode() == spv::Op::OpBitFieldSExtract;
|
|
return getopcode() == spv::Op::OpBitFieldSExtract;
|
|
}
|
|
}
|
|
@@ -826,6 +889,8 @@ public:
|
|
return inst->getKind() == IK_BitFieldInsert;
|
|
return inst->getKind() == IK_BitFieldInsert;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvBitFieldInsert)
|
|
|
|
+
|
|
uint32_t getInsert() const { return insert; }
|
|
uint32_t getInsert() const { return insert; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -847,6 +912,8 @@ public:
|
|
return inst->getKind() == IK_Composite;
|
|
return inst->getKind() == IK_Composite;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvComposite)
|
|
|
|
+
|
|
bool isConstantComposite() const {
|
|
bool isConstantComposite() const {
|
|
return getopcode() == spv::Op::OpConstantComposite;
|
|
return getopcode() == spv::Op::OpConstantComposite;
|
|
}
|
|
}
|
|
@@ -871,6 +938,8 @@ public:
|
|
return inst->getKind() == IK_CompositeExtract;
|
|
return inst->getKind() == IK_CompositeExtract;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvCompositeExtract)
|
|
|
|
+
|
|
uint32_t getComposite() const { return composite; }
|
|
uint32_t getComposite() const { return composite; }
|
|
llvm::ArrayRef<uint32_t> getIndexes() const { return indices; }
|
|
llvm::ArrayRef<uint32_t> getIndexes() const { return indices; }
|
|
|
|
|
|
@@ -891,6 +960,8 @@ public:
|
|
return inst->getKind() == IK_ExtInst;
|
|
return inst->getKind() == IK_ExtInst;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvExtInst)
|
|
|
|
+
|
|
uint32_t getInstructionSetId() const { return instructionSetId; }
|
|
uint32_t getInstructionSetId() const { return instructionSetId; }
|
|
GLSLstd450 getInstruction() const { return instruction; }
|
|
GLSLstd450 getInstruction() const { return instruction; }
|
|
llvm::ArrayRef<uint32_t> getOperands() const { return operands; }
|
|
llvm::ArrayRef<uint32_t> getOperands() const { return operands; }
|
|
@@ -912,6 +983,8 @@ public:
|
|
return inst->getKind() == IK_FunctionCall;
|
|
return inst->getKind() == IK_FunctionCall;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvFunctionCall)
|
|
|
|
+
|
|
uint32_t getFunction() const { return function; }
|
|
uint32_t getFunction() const { return function; }
|
|
llvm::ArrayRef<uint32_t> getArgs() const { return args; }
|
|
llvm::ArrayRef<uint32_t> getArgs() const { return args; }
|
|
|
|
|
|
@@ -929,6 +1002,8 @@ public:
|
|
inst->getKind() <= IK_GroupNonUniformUnaryOp;
|
|
inst->getKind() <= IK_GroupNonUniformUnaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvGroupNonUniformOp)
|
|
|
|
+
|
|
spv::Scope getExecutionScope() const { return execScope; }
|
|
spv::Scope getExecutionScope() const { return execScope; }
|
|
|
|
|
|
protected:
|
|
protected:
|
|
@@ -952,6 +1027,8 @@ public:
|
|
return inst->getKind() == IK_GroupNonUniformBinaryOp;
|
|
return inst->getKind() == IK_GroupNonUniformBinaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvNonUniformBinaryOp)
|
|
|
|
+
|
|
uint32_t getArg1() const { return arg1; }
|
|
uint32_t getArg1() const { return arg1; }
|
|
uint32_t getArg2() const { return arg2; }
|
|
uint32_t getArg2() const { return arg2; }
|
|
|
|
|
|
@@ -971,6 +1048,8 @@ public:
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
static bool classof(const SpirvInstruction *inst) {
|
|
return inst->getKind() == IK_GroupNonUniformElect;
|
|
return inst->getKind() == IK_GroupNonUniformElect;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvNonUniformElect)
|
|
};
|
|
};
|
|
|
|
|
|
/// \brief OpGroupNonUniform* unary instructions.
|
|
/// \brief OpGroupNonUniform* unary instructions.
|
|
@@ -986,6 +1065,8 @@ public:
|
|
return inst->getKind() == IK_GroupNonUniformUnaryOp;
|
|
return inst->getKind() == IK_GroupNonUniformUnaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvNonUniformUnaryOp)
|
|
|
|
+
|
|
uint32_t getArg() const { return arg; }
|
|
uint32_t getArg() const { return arg; }
|
|
bool hasGroupOp() const { return groupOp.hasValue(); }
|
|
bool hasGroupOp() const { return groupOp.hasValue(); }
|
|
spv::GroupOperation getGroupOp() const { return groupOp.getValue(); }
|
|
spv::GroupOperation getGroupOp() const { return groupOp.getValue(); }
|
|
@@ -1037,6 +1118,8 @@ public:
|
|
return inst->getKind() == IK_ImageOp;
|
|
return inst->getKind() == IK_ImageOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvImageOp)
|
|
|
|
+
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getCoordinate() const { return coordinate; }
|
|
uint32_t getCoordinate() const { return coordinate; }
|
|
spv::ImageOperandsMask getImageOperandsMask() const { return operandsMask; }
|
|
spv::ImageOperandsMask getImageOperandsMask() const { return operandsMask; }
|
|
@@ -1108,6 +1191,8 @@ public:
|
|
return inst->getKind() == IK_ImageQuery;
|
|
return inst->getKind() == IK_ImageQuery;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvImageQuery)
|
|
|
|
+
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t hasLod() const { return lod != 0; }
|
|
uint32_t hasLod() const { return lod != 0; }
|
|
uint32_t getLod() const { return lod; }
|
|
uint32_t getLod() const { return lod; }
|
|
@@ -1131,6 +1216,8 @@ public:
|
|
return inst->getKind() == IK_ImageSparseTexelsResident;
|
|
return inst->getKind() == IK_ImageSparseTexelsResident;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvImageSparseTexelsResident)
|
|
|
|
+
|
|
uint32_t getResidentCode() const { return residentCode; }
|
|
uint32_t getResidentCode() const { return residentCode; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -1149,6 +1236,8 @@ public:
|
|
return inst->getKind() == IK_ImageTexelPointer;
|
|
return inst->getKind() == IK_ImageTexelPointer;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvImageTexelPointer)
|
|
|
|
+
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getCoordinate() const { return coordinate; }
|
|
uint32_t getCoordinate() const { return coordinate; }
|
|
uint32_t getSample() const { return sample; }
|
|
uint32_t getSample() const { return sample; }
|
|
@@ -1170,6 +1259,8 @@ public:
|
|
return inst->getKind() == IK_Load;
|
|
return inst->getKind() == IK_Load;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvLoad)
|
|
|
|
+
|
|
uint32_t getPointer() const { return pointer; }
|
|
uint32_t getPointer() const { return pointer; }
|
|
bool hasMemoryAccessSemantics() const { return memoryAccess.hasValue(); }
|
|
bool hasMemoryAccessSemantics() const { return memoryAccess.hasValue(); }
|
|
spv::MemoryAccessMask getMemoryAccess() const {
|
|
spv::MemoryAccessMask getMemoryAccess() const {
|
|
@@ -1192,6 +1283,8 @@ public:
|
|
return inst->getKind() == IK_SampledImage;
|
|
return inst->getKind() == IK_SampledImage;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSampledImage)
|
|
|
|
+
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getImage() const { return image; }
|
|
uint32_t getSampler() const { return sampler; }
|
|
uint32_t getSampler() const { return sampler; }
|
|
|
|
|
|
@@ -1211,6 +1304,8 @@ public:
|
|
return inst->getKind() == IK_Select;
|
|
return inst->getKind() == IK_Select;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSelect)
|
|
|
|
+
|
|
uint32_t getCondition() const { return condition; }
|
|
uint32_t getCondition() const { return condition; }
|
|
uint32_t getTrueObject() const { return trueObject; }
|
|
uint32_t getTrueObject() const { return trueObject; }
|
|
uint32_t getFalseObject() const { return falseObject; }
|
|
uint32_t getFalseObject() const { return falseObject; }
|
|
@@ -1233,6 +1328,8 @@ public:
|
|
return inst->getKind() == IK_SpecConstantBinaryOp;
|
|
return inst->getKind() == IK_SpecConstantBinaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSpecConstantBinaryOp)
|
|
|
|
+
|
|
spv::Op getSpecConstantopcode() const { return specOp; }
|
|
spv::Op getSpecConstantopcode() const { return specOp; }
|
|
uint32_t getOperand1() const { return operand1; }
|
|
uint32_t getOperand1() const { return operand1; }
|
|
uint32_t getOperand2() const { return operand2; }
|
|
uint32_t getOperand2() const { return operand2; }
|
|
@@ -1255,6 +1352,8 @@ public:
|
|
return inst->getKind() == IK_SpecConstantUnaryOp;
|
|
return inst->getKind() == IK_SpecConstantUnaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvSpecConstantUnaryOp)
|
|
|
|
+
|
|
spv::Op getSpecConstantopcode() const { return specOp; }
|
|
spv::Op getSpecConstantopcode() const { return specOp; }
|
|
uint32_t getOperand() const { return operand; }
|
|
uint32_t getOperand() const { return operand; }
|
|
|
|
|
|
@@ -1274,6 +1373,8 @@ public:
|
|
return inst->getKind() == IK_Store;
|
|
return inst->getKind() == IK_Store;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvStore)
|
|
|
|
+
|
|
uint32_t getPointer() const { return pointer; }
|
|
uint32_t getPointer() const { return pointer; }
|
|
uint32_t getObject() const { return object; }
|
|
uint32_t getObject() const { return object; }
|
|
bool hasMemoryAccessSemantics() const { return memoryAccess.hasValue(); }
|
|
bool hasMemoryAccessSemantics() const { return memoryAccess.hasValue(); }
|
|
@@ -1335,6 +1436,8 @@ public:
|
|
return inst->getKind() == IK_UnaryOp;
|
|
return inst->getKind() == IK_UnaryOp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvUnaryOp)
|
|
|
|
+
|
|
uint32_t getOperand() const { return operand; }
|
|
uint32_t getOperand() const { return operand; }
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -1353,6 +1456,8 @@ public:
|
|
return inst->getKind() == IK_VectorShuffle;
|
|
return inst->getKind() == IK_VectorShuffle;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ DECLARE_INVOKE_VISITOR_FOR_CLASS(SpirvVectorShuffle)
|
|
|
|
+
|
|
uint32_t getVec1() const { return vec1; }
|
|
uint32_t getVec1() const { return vec1; }
|
|
uint32_t getVec2() const { return vec2; }
|
|
uint32_t getVec2() const { return vec2; }
|
|
llvm::ArrayRef<uint32_t> getComponents() const { return components; }
|
|
llvm::ArrayRef<uint32_t> getComponents() const { return components; }
|
|
@@ -1363,6 +1468,8 @@ private:
|
|
llvm::SmallVector<uint32_t, 4> components;
|
|
llvm::SmallVector<uint32_t, 4> components;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+#undef DECLARE_INVOKE_VISITOR_FOR_CLASS
|
|
|
|
+
|
|
} // namespace spirv
|
|
} // namespace spirv
|
|
} // namespace clang
|
|
} // namespace clang
|
|
|
|
|