16using namespace OffloadYAML;
22 for (
const auto &Member : Doc.
Members) {
25 Image.TheImageKind = *Member.ImageKind;
26 if (Member.OffloadKind)
27 Image.TheOffloadKind = *Member.OffloadKind;
29 Image.Flags = *Member.Flags;
31 if (Member.StringEntries)
32 for (
const auto &Entry : *Member.StringEntries)
33 Image.StringData[Entry.Key] = Entry.Value;
38 Member.Content->writeAsBinary(
OS);
48 TheHeader->Size = *Doc.
Size;
54 Out.
write(Buffer.begin(), Buffer.size());
This file declares classes for handling the YAML representation of offloading binaries.
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An efficient, type-erasing, non-owning reference to a callable.
static SmallString< 0 > write(const OffloadingImage &)
Serialize the contents of File to a binary buffer to be read later.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & write(unsigned char C)
A raw_ostream that writes to an SmallVector or SmallString.
bool yaml2offload(OffloadYAML::Binary &Doc, raw_ostream &Out, ErrorHandler EH)
This is an optimization pass for GlobalISel generic memory operations.
std::optional< uint32_t > Version
std::optional< uint64_t > EntryOffset
std::optional< uint64_t > Size
std::optional< uint64_t > EntrySize
std::vector< Member > Members
The offloading metadata that will be serialized to a memory buffer.
Common declarations for yaml2obj.