15 #include "llvm/Config/llvm-config.h"
20 spirv::Version version, uint32_t idBound) {
21 uint32_t majorVersion = 1;
22 uint32_t minorVersion = 0;
24 #define MIN_VERSION_CASE(v) \
25 case spirv::Version::V_1_##v: \
36 #undef MIN_VERSION_CASE
55 header.push_back((majorVersion << 16) | (minorVersion << 8));
57 header.push_back(idBound);
63 assert(((wordCount >> 16) == 0) &&
"word count out of range!");
64 return (wordCount << 16) |
static_cast<uint32_t
>(opcode);
70 auto encodingSize = literal.size() / 4 + 1;
71 auto bufferStartSize = binary.size();
72 binary.resize(bufferStartSize + encodingSize, 0);
73 std::memcpy(binary.data() + bufferStartSize, literal.data(), literal.size());
#define MIN_VERSION_CASE(v)
void encodeStringLiteralInto(SmallVectorImpl< uint32_t > &binary, StringRef literal)
Encodes an SPIR-V literal string into the given binary vector.
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.
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.
Include the generated interface declarations.