LLVM 22.0.0git
llvm::object::OffloadBinary Class Reference

A simple binary serialization of an offloading file. More...

#include "llvm/Object/OffloadBinary.h"

Inheritance diagram for llvm::object::OffloadBinary:
[legend]

Classes

struct  Entry
struct  Header
struct  OffloadingImage
 The offloading metadata that will be serialized to a memory buffer. More...
struct  StringEntry

Public Types

using string_iterator = MapVector<StringRef, StringRef>::const_iterator
using string_iterator_range = iterator_range<string_iterator>

Public Member Functions

ImageKind getImageKind () const
OffloadKind getOffloadKind () const
uint32_t getVersion () const
uint32_t getFlags () const
uint64_t getSize () const
StringRef getTriple () const
StringRef getArch () const
StringRef getImage () const
string_iterator_range strings () const
StringRef getString (StringRef Key) const
Public Member Functions inherited from llvm::object::Binary
 Binary ()=delete
 Binary (const Binary &other)=delete
virtual ~Binary ()
virtual Error initContent ()
StringRef getData () const
StringRef getFileName () const
MemoryBufferRef getMemoryBufferRef () const
unsigned int getType () const
bool isObject () const
bool isSymbolic () const
bool isArchive () const
bool isMachOUniversalBinary () const
bool isTapiUniversal () const
bool isELF () const
bool isMachO () const
bool isCOFF () const
bool isXCOFF () const
bool isWasm () const
bool isOffloadFile () const
bool isCOFFImportFile () const
bool isIR () const
bool isGOFF () const
bool isMinidump () const
bool isTapiFile () const
bool isLittleEndian () const
bool isWinRes () const
bool isDXContainer () const
Triple::ObjectFormatType getTripleObjectFormat () const

Static Public Member Functions

static LLVM_ABI Expected< std::unique_ptr< OffloadBinary > > create (MemoryBufferRef)
 Attempt to parse the offloading binary stored in Data.
static LLVM_ABI SmallString< 0 > write (const OffloadingImage &)
 Serialize the contents of File to a binary buffer to be read later.
static uint64_t getAlignment ()
static bool classof (const Binary *V)
Static Public Member Functions inherited from llvm::object::Binary
static Error checkOffset (MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)

Static Public Attributes

static const uint32_t Version = 1
 The current version of the binary used for backwards compatibility.

Additional Inherited Members

Protected Types inherited from llvm::object::Binary
enum  {
  ID_Archive , ID_MachOUniversalBinary , ID_COFFImportFile , ID_IR ,
  ID_TapiUniversal , ID_TapiFile , ID_Minidump , ID_WinRes ,
  ID_Offload , ID_StartObjects , ID_COFF , ID_XCOFF32 ,
  ID_XCOFF64 , ID_ELF32L , ID_ELF32B , ID_ELF64L ,
  ID_ELF64B , ID_MachO32L , ID_MachO32B , ID_MachO64L ,
  ID_MachO64B , ID_GOFF , ID_Wasm , ID_DXContainer ,
  ID_EndObjects
}
Protected Member Functions inherited from llvm::object::Binary
 Binary (unsigned int Type, MemoryBufferRef Source)
Static Protected Member Functions inherited from llvm::object::Binary
static unsigned int getELFType (bool isLE, bool is64Bits)
static unsigned int getMachOType (bool isLE, bool is64Bits)
Protected Attributes inherited from llvm::object::Binary
MemoryBufferRef Data

Detailed Description

A simple binary serialization of an offloading file.

We use this format to embed the offloading image into the host executable so it can be extracted and used by the linker.

Many of these could be stored in the same section by the time the linker sees it so we mark this information with a header. The version is used to detect ABI stability and the size is used to find other offloading entries that may exist in the same section. All offsets are given as absolute byte offsets from the beginning of the file.

Definition at line 64 of file OffloadBinary.h.

Member Typedef Documentation

◆ string_iterator

◆ string_iterator_range

Member Function Documentation

◆ classof()

bool llvm::object::OffloadBinary::classof ( const Binary * V)
inlinestatic

Definition at line 109 of file OffloadBinary.h.

References llvm::object::Binary::Binary().

◆ create()

◆ getAlignment()

uint64_t llvm::object::OffloadBinary::getAlignment ( )
inlinestatic

◆ getArch()

StringRef llvm::object::OffloadBinary::getArch ( ) const
inline

Definition at line 97 of file OffloadBinary.h.

References getString().

◆ getFlags()

uint32_t llvm::object::OffloadBinary::getFlags ( ) const
inline

Definition at line 93 of file OffloadBinary.h.

◆ getImage()

StringRef llvm::object::OffloadBinary::getImage ( ) const
inline

Definition at line 98 of file OffloadBinary.h.

◆ getImageKind()

ImageKind llvm::object::OffloadBinary::getImageKind ( ) const
inline

Definition at line 90 of file OffloadBinary.h.

◆ getOffloadKind()

OffloadKind llvm::object::OffloadBinary::getOffloadKind ( ) const
inline

Definition at line 91 of file OffloadBinary.h.

◆ getSize()

uint64_t llvm::object::OffloadBinary::getSize ( ) const
inline

Definition at line 94 of file OffloadBinary.h.

◆ getString()

StringRef llvm::object::OffloadBinary::getString ( StringRef Key) const
inline

◆ getTriple()

StringRef llvm::object::OffloadBinary::getTriple ( ) const
inline

Definition at line 96 of file OffloadBinary.h.

References getString().

◆ getVersion()

uint32_t llvm::object::OffloadBinary::getVersion ( ) const
inline

Definition at line 92 of file OffloadBinary.h.

◆ strings()

string_iterator_range llvm::object::OffloadBinary::strings ( ) const
inline

Definition at line 103 of file OffloadBinary.h.

◆ write()

Member Data Documentation

◆ Version

const uint32_t llvm::object::OffloadBinary::Version = 1
static

The current version of the binary used for backwards compatibility.

Definition at line 70 of file OffloadBinary.h.

Referenced by create().


The documentation for this class was generated from the following files: