13#ifndef MLIR_TARGET_SPIRV_SPIRVBINARYUTILS_H
14#define MLIR_TARGET_SPIRV_SPIRVBINARYUTILS_H
44 spirv::Version version, uint32_t idBound);
56 unsigned &wordIndex) {
57 StringRef str(
reinterpret_cast<const char *
>(words.data() + wordIndex));
58 wordIndex += str.size() / 4 + 1;
65inline std::optional<spirv::Opcode>
68 case spirv::Opcode::OpTypeStruct:
69 return spirv::Opcode::OpTypeStructContinuedINTEL;
70 case spirv::Opcode::OpConstantComposite:
71 return spirv::Opcode::OpConstantCompositeContinuedINTEL;
72 case spirv::Opcode::OpSpecConstantComposite:
73 return spirv::Opcode::OpSpecConstantCompositeContinuedINTEL;
74 case spirv::Opcode::OpCompositeConstruct:
75 return spirv::Opcode::OpCompositeConstructContinuedINTEL;
void encodeStringLiteralInto(SmallVectorImpl< uint32_t > &binary, StringRef literal)
Encodes an SPIR-V literal string into the given binary vector.
constexpr uint32_t kMaxLiteralWordCount
Max number of words for literal.
constexpr uint32_t kGeneratorNumber
The serializer tool ID registered to the Khronos Group.
std::optional< spirv::Opcode > getContinuationOpcode(spirv::Opcode parent)
Returns the SPV_INTEL_long_composites continuation opcode that may follow parent, or std::nullopt if ...
constexpr uint32_t kMagicNumber
SPIR-V magic number.
uint32_t getPrefixedOpcode(uint32_t wordCount, spirv::Opcode opcode)
Returns the word-count-prefixed opcode for an SPIR-V instruction.
constexpr uint32_t kMaxWordCount
Max number of words https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_universal_limits.
void appendModuleHeader(SmallVectorImpl< uint32_t > &header, spirv::Version version, uint32_t idBound)
Appends a SPRI-V module header to header with the given version and idBound.
StringRef decodeStringLiteral(ArrayRef< uint32_t > words, unsigned &wordIndex)
Decodes a string literal in words starting at wordIndex.
constexpr unsigned kHeaderWordCount
SPIR-V binary header word count.
Include the generated interface declarations.