================ @@ -6361,6 +6362,143 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { findHandleTypeOnResource(const Type *RT); }; +/// Instances of this class represent operands to a SPIR-V type instruction. +class SpirvOperand { +public: + enum SpirvOperandKind : unsigned char { + Invalid, ///< Uninitialized. + ConstantId, ///< Integral value to represent as a SPIR-V OpConstant + ///< instruction ID. + Literal, ///< Integral value to represent as an immediate literal. + TypeId, ///< Type to represent as a SPIR-V type ID. + + Max, + }; + +private: + SpirvOperandKind Kind = Invalid; + + QualType ResultType; + llvm::APInt Value; // Signedness of constants is represented by ResultType. + +public: + SpirvOperand() : Kind(Invalid), ResultType(), Value() {} + + SpirvOperand(SpirvOperandKind Kind, QualType ResultType, llvm::APInt Value) + : Kind(Kind), ResultType(ResultType), Value(Value) {} + + SpirvOperand(const SpirvOperand &Other) { *this = Other; } + ~SpirvOperand() {} ---------------- shafik wrote:
It would have been better to just default this. https://github.com/llvm/llvm-project/pull/134034 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits