17#ifndef LLVM_OBJECT_OFFLOADBINARY_H
18#define LLVM_OBJECT_OFFLOADBINARY_H
75 std::unique_ptr<MemoryBuffer>
Image;
108 uint8_t
Magic[4] = {0x10, 0xFF, 0x10, 0xAD};
132 const Entry *TheEntry)
134 TheHeader(TheHeader), TheEntry(TheEntry) {
139 StringData[Key] = &Buffer[StringMapBegin[
I].ValueOffset];
143 OffloadBinary(
const OffloadBinary &
Other) =
delete;
150 const Header *TheHeader;
152 const Entry *TheEntry;
162 std::unique_ptr<MemoryBuffer> Buffer)
168 getBinary()->getMemoryBufferRef().getBuffer());
172 assert(NewBinaryOrErr &&
"Failed to parse a copy of the binary?");
175 return OffloadFile(std::move(*NewBinaryOrErr), std::move(Buffer));
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file implements a map that provides insertion order iteration.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
This class implements a map that also provides access to all stored values in a deterministic order.
typename VectorType::const_iterator const_iterator
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.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
A range adaptor for a pair of iterators.
A simple binary serialization of an offloading file.
static uint64_t getAlignment()
OffloadKind getOffloadKind() const
iterator_range< string_iterator > string_iterator_range
StringRef getString(StringRef Key) const
uint32_t getVersion() const
StringRef getImage() const
static SmallString< 0 > write(const OffloadingImage &)
Serialize the contents of File to a binary buffer to be read later.
uint32_t getFlags() const
StringRef getTriple() const
ImageKind getImageKind() const
static Expected< std::unique_ptr< OffloadBinary > > create(MemoryBufferRef)
Attempt to parse the offloading binary stored in Data.
static bool classof(const Binary *V)
string_iterator_range strings() const
StringRef getArch() const
static const uint32_t Version
The current version of the binary used for backwards compatibility.
MapVector< StringRef, StringRef >::const_iterator string_iterator
A class to contain the binary information for a single OffloadBinary that owns its memory.
std::pair< StringRef, StringRef > TargetID
OffloadFile copy() const
Make a deep copy of this offloading file.
OffloadFile(std::unique_ptr< OffloadBinary > Binary, std::unique_ptr< MemoryBuffer > Buffer)
OffloadBinary * getBinary()
Error extractOffloadBinaries(MemoryBufferRef Buffer, SmallVectorImpl< OffloadFile > &Binaries)
Extracts embedded device offloading code from a memory Buffer to a list of Binaries.
ImageKind getImageKind(StringRef Name)
Convert a string Name to an image kind.
bool areTargetsCompatible(const OffloadFile::TargetID &LHS, const OffloadFile::TargetID &RHS)
If the target is AMD we check the target IDs for mutual compatibility.
OffloadKind
The producer of the associated offloading image.
OffloadKind getOffloadKind(StringRef Name)
Convert a string Name to an offload kind.
StringRef getImageKindName(ImageKind Name)
Convert an image kind to its string representation.
ImageKind
The type of contents the offloading image contains.
StringRef getOffloadKindName(OffloadKind Name)
Convert an offload kind to its string representation.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void consumeError(Error Err)
Consume a Error without doing anything.
Implement std::hash so that hash_code can be used in STL containers.
OffloadKind TheOffloadKind
The offloading metadata that will be serialized to a memory buffer.
OffloadKind TheOffloadKind
std::unique_ptr< MemoryBuffer > Image
MapVector< StringRef, StringRef > StringData