LLVM API Documentation

llvm::BinaryObject Class Reference

#include <BinaryObject.h>

Inheritance diagram for llvm::BinaryObject:
[legend]
Collaboration diagram for llvm::BinaryObject:
[legend]

List of all members.

Public Member Functions

 BinaryObject ()
 Constructors and destructor.
 BinaryObject (bool isLittleEndian, bool is64Bit)
 BinaryObject (const std::string &name, bool isLittleEndian, bool is64Bit)
 ~BinaryObject ()
std::string getName () const
 getName - get name of BinaryObject
size_t size () const
 get size of binary data
BinaryData & getData ()
 get binary data
const std::vector
< MachineRelocation > & 
getRelocations () const
 get machine relocations
bool hasRelocations () const
 hasRelocations - Return true if 'Relocations' is not empty
void emitZeros (unsigned Size)
void emitByte (uint8_t B)
void emitWord16 (uint16_t W)
void emitWord16LE (uint16_t W)
void emitWord16BE (uint16_t W)
void emitWord (uint64_t W)
void emitWord32 (uint32_t W)
void emitWord64 (uint64_t W)
void emitWordFP80 (const uint64_t *W, unsigned PadSize)
void emitWordLE (uint32_t W)
void emitWordBE (uint32_t W)
void emitDWordLE (uint64_t W)
void emitDWordBE (uint64_t W)
void fixByte (uint8_t B, uint32_t offset)
void fixWord16 (uint16_t W, uint32_t offset)
void fixWord16LE (uint16_t W, uint32_t offset)
void fixWord16BE (uint16_t W, uint32_t offset)
void fixWord (uint64_t W, uint32_t offset)
void fixWord32 (uint32_t W, uint32_t offset)
void fixWord32LE (uint32_t W, uint32_t offset)
void fixWord32BE (uint32_t W, uint32_t offset)
void fixWord64 (uint64_t W, uint32_t offset)
void fixWord64LE (uint64_t W, uint32_t offset)
void fixWord64BE (uint64_t W, uint32_t offset)
void emitAlignment (unsigned Alignment, uint8_t fill=0)
 emitAlignment - Pad the data to the specified alignment.
void emitULEB128Bytes (uint64_t Value)
void emitSLEB128Bytes (int64_t Value)
void emitString (const std::string &String)
uintptr_t getCurrentPCOffset () const
void addRelocation (const MachineRelocation &relocation)

Protected Attributes

std::string Name
bool IsLittleEndian
bool Is64Bit
BinaryData Data
std::vector< MachineRelocation > Relocations


Detailed Description

Definition at line 28 of file BinaryObject.h.


Constructor & Destructor Documentation

llvm::BinaryObject::BinaryObject (  )  [inline]

Constructors and destructor.

Definition at line 38 of file BinaryObject.h.

llvm::BinaryObject::BinaryObject ( bool  isLittleEndian,
bool  is64Bit 
) [inline]

Definition at line 40 of file BinaryObject.h.

llvm::BinaryObject::BinaryObject ( const std::string &  name,
bool  isLittleEndian,
bool  is64Bit 
) [inline]

Definition at line 43 of file BinaryObject.h.

llvm::BinaryObject::~BinaryObject (  )  [inline]

Definition at line 46 of file BinaryObject.h.


Member Function Documentation

std::string llvm::BinaryObject::getName (  )  const [inline]

getName - get name of BinaryObject

Definition at line 49 of file BinaryObject.h.

References Name.

size_t llvm::BinaryObject::size (  )  const [inline]

BinaryData& llvm::BinaryObject::getData (  )  [inline]

get binary data

Definition at line 57 of file BinaryObject.h.

References Data.

Referenced by llvm::MachOCodeEmitter::emitConstantPool(), and llvm::MachOWriter::InitMem().

const std::vector<MachineRelocation>& llvm::BinaryObject::getRelocations (  )  const [inline]

get machine relocations

Definition at line 62 of file BinaryObject.h.

References Relocations.

bool llvm::BinaryObject::hasRelocations (  )  const [inline]

hasRelocations - Return true if 'Relocations' is not empty

Definition at line 67 of file BinaryObject.h.

References Relocations.

void llvm::BinaryObject::emitZeros ( unsigned  Size  )  [inline]

emitZeros - This callback is invoked to emit a arbitrary number of zero bytes to the data stream.

Definition at line 73 of file BinaryObject.h.

References emitByte().

Referenced by emitWordFP80().

void llvm::BinaryObject::emitByte ( uint8_t  B  )  [inline]

emitByte - This callback is invoked when a byte needs to be written to the data stream.

Definition at line 80 of file BinaryObject.h.

References Data.

Referenced by llvm::ELFWriter::doInitialization(), llvm::ObjectCodeEmitter::emitByte(), llvm::ELFCodeEmitter::emitJumpTables(), emitSLEB128Bytes(), emitString(), emitULEB128Bytes(), and emitZeros().

void llvm::BinaryObject::emitWord16 ( uint16_t  W  )  [inline]

emitWord16 - This callback is invoked when a 16-bit word needs to be written to the data stream in correct endian format and correct size.

Definition at line 86 of file BinaryObject.h.

References emitWord16BE(), emitWord16LE(), and IsLittleEndian.

Referenced by llvm::ELFWriter::doInitialization(), and emitWordFP80().

void llvm::BinaryObject::emitWord16LE ( uint16_t  W  )  [inline]

emitWord16LE - This callback is invoked when a 16-bit word needs to be written to the data stream in correct endian format and correct size.

Definition at line 95 of file BinaryObject.h.

References Data.

Referenced by emitWord16().

void llvm::BinaryObject::emitWord16BE ( uint16_t  W  )  [inline]

emitWord16BE - This callback is invoked when a 16-bit word needs to be written to the data stream in correct endian format and correct size.

Definition at line 102 of file BinaryObject.h.

References Data.

Referenced by emitWord16().

void llvm::BinaryObject::emitWord ( uint64_t  W  )  [inline]

emitWord - This callback is invoked when a word needs to be written to the data stream in correct endian format and correct size.

Definition at line 109 of file BinaryObject.h.

References emitWord32(), emitWord64(), and Is64Bit.

Referenced by llvm::ELFWriter::doInitialization().

void llvm::BinaryObject::emitWord32 ( uint32_t  W  )  [inline]

emitWord32 - This callback is invoked when a 32-bit word needs to be written to the data stream in correct endian format.

Definition at line 118 of file BinaryObject.h.

References emitWordBE(), emitWordLE(), and IsLittleEndian.

Referenced by llvm::ELFWriter::doInitialization(), and emitWord().

void llvm::BinaryObject::emitWord64 ( uint64_t  W  )  [inline]

emitWord64 - This callback is invoked when a 32-bit word needs to be written to the data stream in correct endian format.

Definition at line 127 of file BinaryObject.h.

References emitDWordBE(), emitDWordLE(), and IsLittleEndian.

Referenced by emitWord(), and emitWordFP80().

void llvm::BinaryObject::emitWordFP80 ( const uint64_t *  W,
unsigned  PadSize 
) [inline]

emitWord64 - This callback is invoked when a x86_fp80 needs to be written to the data stream in correct endian format.

Definition at line 136 of file BinaryObject.h.

References emitWord16(), emitWord64(), emitZeros(), and IsLittleEndian.

void llvm::BinaryObject::emitWordLE ( uint32_t  W  )  [inline]

emitWordLE - This callback is invoked when a 32-bit word needs to be written to the data stream in little-endian format.

Definition at line 149 of file BinaryObject.h.

References Data.

Referenced by emitWord32(), and llvm::ObjectCodeEmitter::emitWordLE().

void llvm::BinaryObject::emitWordBE ( uint32_t  W  )  [inline]

emitWordBE - This callback is invoked when a 32-bit word needs to be written to the data stream in big-endian format.

Definition at line 159 of file BinaryObject.h.

References Data.

Referenced by emitWord32(), and llvm::ObjectCodeEmitter::emitWordBE().

void llvm::BinaryObject::emitDWordLE ( uint64_t  W  )  [inline]

emitDWordLE - This callback is invoked when a 64-bit word needs to be written to the data stream in little-endian format.

Definition at line 168 of file BinaryObject.h.

References Data.

Referenced by llvm::ObjectCodeEmitter::emitDWordLE(), and emitWord64().

void llvm::BinaryObject::emitDWordBE ( uint64_t  W  )  [inline]

emitDWordBE - This callback is invoked when a 64-bit word needs to be written to the data stream in big-endian format.

Definition at line 181 of file BinaryObject.h.

References Data.

Referenced by llvm::ObjectCodeEmitter::emitDWordBE(), and emitWord64().

void llvm::BinaryObject::fixByte ( uint8_t  B,
uint32_t  offset 
) [inline]

fixByte - This callback is invoked when a byte needs to be fixup the buffer.

Definition at line 194 of file BinaryObject.h.

References Data.

void llvm::BinaryObject::fixWord16 ( uint16_t  W,
uint32_t  offset 
) [inline]

fixWord16 - This callback is invoked when a 16-bit word needs to fixup the data stream in correct endian format.

Definition at line 200 of file BinaryObject.h.

References fixWord16BE(), fixWord16LE(), and IsLittleEndian.

void llvm::BinaryObject::fixWord16LE ( uint16_t  W,
uint32_t  offset 
) [inline]

emitWord16LE - This callback is invoked when a 16-bit word needs to fixup the data stream in little endian format.

Definition at line 209 of file BinaryObject.h.

References Data.

Referenced by fixWord16().

void llvm::BinaryObject::fixWord16BE ( uint16_t  W,
uint32_t  offset 
) [inline]

fixWord16BE - This callback is invoked when a 16-bit word needs to fixup data stream in big endian format.

Definition at line 216 of file BinaryObject.h.

References Data.

Referenced by fixWord16().

void llvm::BinaryObject::fixWord ( uint64_t  W,
uint32_t  offset 
) [inline]

emitWord - This callback is invoked when a word needs to fixup the data in correct endian format and correct size.

Definition at line 223 of file BinaryObject.h.

References fixWord32(), fixWord64(), and Is64Bit.

void llvm::BinaryObject::fixWord32 ( uint32_t  W,
uint32_t  offset 
) [inline]

fixWord32 - This callback is invoked when a 32-bit word needs to fixup the data in correct endian format.

Definition at line 232 of file BinaryObject.h.

References fixWord32BE(), fixWord32LE(), and IsLittleEndian.

Referenced by fixWord().

void llvm::BinaryObject::fixWord32LE ( uint32_t  W,
uint32_t  offset 
) [inline]

fixWord32LE - This callback is invoked when a 32-bit word needs to fixup the data in little endian format.

Definition at line 241 of file BinaryObject.h.

References Data.

Referenced by fixWord32().

void llvm::BinaryObject::fixWord32BE ( uint32_t  W,
uint32_t  offset 
) [inline]

fixWord32BE - This callback is invoked when a 32-bit word needs to fixup the data in big endian format.

Definition at line 250 of file BinaryObject.h.

References Data.

Referenced by fixWord32().

void llvm::BinaryObject::fixWord64 ( uint64_t  W,
uint32_t  offset 
) [inline]

fixWord64 - This callback is invoked when a 64-bit word needs to fixup the data in correct endian format.

Definition at line 259 of file BinaryObject.h.

References fixWord64BE(), fixWord64LE(), and IsLittleEndian.

Referenced by fixWord().

void llvm::BinaryObject::fixWord64LE ( uint64_t  W,
uint32_t  offset 
) [inline]

fixWord64BE - This callback is invoked when a 64-bit word needs to fixup the data in little endian format.

Definition at line 268 of file BinaryObject.h.

References Data.

Referenced by fixWord64().

void llvm::BinaryObject::fixWord64BE ( uint64_t  W,
uint32_t  offset 
) [inline]

fixWord64BE - This callback is invoked when a 64-bit word needs to fixup the data in big endian format.

Definition at line 281 of file BinaryObject.h.

References Data.

Referenced by fixWord64().

void llvm::BinaryObject::emitAlignment ( unsigned  Alignment,
uint8_t  fill = 0 
) [inline]

emitAlignment - Pad the data to the specified alignment.

Definition at line 293 of file BinaryObject.h.

References Data.

Referenced by llvm::ELFWriter::doInitialization(), llvm::ObjectCodeEmitter::emitAlignment(), and llvm::MachOCodeEmitter::startFunction().

void llvm::BinaryObject::emitULEB128Bytes ( uint64_t  Value  )  [inline]

emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be written to the data stream.

Definition at line 302 of file BinaryObject.h.

References emitByte().

Referenced by llvm::ObjectCodeEmitter::emitULEB128Bytes().

void llvm::BinaryObject::emitSLEB128Bytes ( int64_t  Value  )  [inline]

emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be written to the data stream.

Definition at line 313 of file BinaryObject.h.

References emitByte().

Referenced by llvm::ObjectCodeEmitter::emitSLEB128Bytes().

void llvm::BinaryObject::emitString ( const std::string &  String  )  [inline]

emitString - This callback is invoked when a String needs to be written to the data stream.

Definition at line 328 of file BinaryObject.h.

References llvm::CallingConv::C, and emitByte().

Referenced by llvm::ObjectCodeEmitter::emitString().

uintptr_t llvm::BinaryObject::getCurrentPCOffset (  )  const [inline]

getCurrentPCOffset - Return the offset from the start of the emitted buffer that we are currently writing to.

Definition at line 338 of file BinaryObject.h.

References Data.

Referenced by llvm::ELFCodeEmitter::finishFunction(), llvm::ObjectCodeEmitter::getCurrentPCOffset(), and llvm::ObjectCodeEmitter::getCurrentPCValue().

void llvm::BinaryObject::addRelocation ( const MachineRelocation &  relocation  )  [inline]

addRelocation - Whenever a relocatable address is needed, it should be noted with this interface.

Definition at line 344 of file BinaryObject.h.

References Relocations.

Referenced by llvm::ObjectCodeEmitter::addRelocation(), llvm::ELFCodeEmitter::finishFunction(), llvm::MachOCodeEmitter::finishFunction(), and llvm::MachOWriter::InitMem().


Member Data Documentation

std::string llvm::BinaryObject::Name [protected]

Definition at line 30 of file BinaryObject.h.

Referenced by getName().

Definition at line 32 of file BinaryObject.h.

Referenced by emitWord(), and fixWord().

Definition at line 34 of file BinaryObject.h.

Referenced by addRelocation(), getRelocations(), and hasRelocations().


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