13 #ifndef MLIR_TARGET_SPIRV_SPIRVBINARYUTILS_H
14 #define MLIR_TARGET_SPIRV_SPIRVBINARYUTILS_H
43 spirv::Version version, uint32_t idBound);
55 unsigned &wordIndex) {
56 StringRef str(
reinterpret_cast<const char *
>(words.data() + wordIndex));
57 wordIndex += str.size() / 4 + 1;
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.
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.