15using namespace OffloadYAML;
21 for (
const auto &Member : Doc.
Members) {
24 Image.TheImageKind = *Member.ImageKind;
25 if (Member.OffloadKind)
26 Image.TheOffloadKind = *Member.OffloadKind;
28 Image.Flags = *Member.Flags;
30 if (Member.StringEntries)
31 for (
const auto &Entry : *Member.StringEntries)
32 Image.StringData[Entry.Key] = Entry.Value;
37 Member.Content->writeAsBinary(
OS);
47 TheHeader->Size = *Doc.
Size;
53 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.