LLVM 19.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
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:
Inheritance graph
[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
 
Triple::ObjectFormatType getTripleObjectFormat () const
 

Static Public Member Functions

static Expected< std::unique_ptr< OffloadBinary > > create (MemoryBufferRef)
 Attempt to parse the offloading binary stored in Data.
 
static 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_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 61 of file OffloadBinary.h.

Member Typedef Documentation

◆ string_iterator

Definition at line 63 of file OffloadBinary.h.

◆ string_iterator_range

Definition at line 64 of file OffloadBinary.h.

Member Function Documentation

◆ classof()

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

Definition at line 105 of file OffloadBinary.h.

◆ create()

Expected< std::unique_ptr< OffloadBinary > > OffloadBinary::create ( MemoryBufferRef  Buf)
static

◆ getAlignment()

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

Definition at line 84 of file OffloadBinary.h.

Referenced by create(), and write().

◆ getArch()

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

Definition at line 93 of file OffloadBinary.h.

References getString().

◆ getFlags()

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

Definition at line 89 of file OffloadBinary.h.

References llvm::object::OffloadBinary::Entry::Flags.

◆ getImage()

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

◆ getImageKind()

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

Definition at line 86 of file OffloadBinary.h.

References llvm::object::OffloadBinary::Entry::TheImageKind.

◆ getOffloadKind()

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

◆ getSize()

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

Definition at line 90 of file OffloadBinary.h.

References llvm::object::OffloadBinary::Header::Size.

◆ getString()

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

Definition at line 103 of file OffloadBinary.h.

Referenced by getArch(), and getTriple().

◆ getTriple()

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

Definition at line 92 of file OffloadBinary.h.

References getString().

◆ getVersion()

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

Definition at line 88 of file OffloadBinary.h.

References llvm::object::OffloadBinary::Header::Version.

◆ strings()

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

Definition at line 99 of file OffloadBinary.h.

◆ write()

SmallString< 0 > OffloadBinary::write ( const OffloadingImage OffloadingData)
static

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 67 of file OffloadBinary.h.

Referenced by create().


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