17void SPIRVObjectWriter::writeHeader(
const MCAssembler &Asm) {
19 constexpr uint32_t GeneratorID = 43;
20 constexpr uint32_t GeneratorMagicNumber =
21 (GeneratorID << 16) | (LLVM_VERSION_MAJOR);
22 constexpr uint32_t Schema = 0;
25 W.write<uint32_t>((VersionInfo.Major << 16) | (VersionInfo.Minor << 8));
26 W.write<uint32_t>(GeneratorMagicNumber);
27 W.write<uint32_t>(VersionInfo.Bound);
28 W.write<uint32_t>(Schema);
33 VersionInfo.Major = Major;
34 VersionInfo.Minor = Minor;
35 VersionInfo.Bound = Bound;
43 return W.
OS.
tell() - StartOffset;
46std::unique_ptr<MCObjectWriter>
49 return std::make_unique<SPIRVObjectWriter>(std::move(MOTW), OS);
LLVM_ABI void writeSectionData(raw_ostream &OS, const MCSection *Section) const
Emit the section contents to OS.
virtual uint64_t writeObject()=0
Write the object file and returns the number of bytes written.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
void setBuildVersion(unsigned Major, unsigned Minor, unsigned Bound)
uint64_t tell() const
tell - Return the current offset with the file.
An abstract base class for streams implementations that also support a pwrite operation.
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectWriter > createSPIRVObjectWriter(std::unique_ptr< MCSPIRVObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new SPIR-V writer instance.