LLVM API Documentation

llvm::MachOWriter Class Reference

#include <MachOWriter.h>

Inheritance diagram for llvm::MachOWriter:

Inheritance graph
[legend]
Collaboration diagram for llvm::MachOWriter:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector< unsigned
char > 
DataBuffer

Public Member Functions

MachineCodeEmittergetMachineCodeEmitter () const
 MachOWriter (raw_ostream &O, TargetMachine &TM)
virtual ~MachOWriter ()
virtual const char * getPassName () const

Static Public Attributes

static char ID = 0

Protected Member Functions

bool doInitialization (Module &M)
bool runOnMachineFunction (MachineFunction &MF)
bool doFinalization (Module &M)

Static Protected Member Functions

static void InitMem (const Constant *C, void *Addr, intptr_t Offset, const TargetData *TD, std::vector< MachineRelocation > &MRs)

Protected Attributes

raw_ostreamO
TargetMachineTM
ManglerMang
MachOCodeEmitterMCE
bool is64Bit
bool isLittleEndian
MachOHeader Header
std::vector< MachOSymSymbolTable
DataBuffer SymT
DataBuffer StrT
std::vector< GlobalValue * > PendingGlobals
std::vector< unsignedDynamicSymbolTable

Friends

class MachOCodeEmitter

Classes

struct  MachODySymTab
struct  MachOHeader
struct  MachOSection
struct  MachOSegment
struct  MachOSymCmp
struct  MachOSymTab


Detailed Description

MachOWriter - This class implements the common target-independent code for writing Mach-O files. Targets should derive a class from this to parameterize the output format.

Definition at line 86 of file MachOWriter.h.


Member Typedef Documentation

typedef std::vector<unsigned char> llvm::MachOWriter::DataBuffer

Definition at line 101 of file MachOWriter.h.


Constructor & Destructor Documentation

MachOWriter::MachOWriter ( raw_ostream O,
TargetMachine TM 
)

MachOWriter::~MachOWriter (  )  [virtual]

Definition at line 347 of file MachOWriter.cpp.

References MCE.


Member Function Documentation

MachineCodeEmitter& llvm::MachOWriter::getMachineCodeEmitter (  )  const [inline]

Definition at line 90 of file MachOWriter.h.

References MCE.

Referenced by llvm::AddMachOWriter().

virtual const char* llvm::MachOWriter::getPassName (  )  const [inline, virtual]

getPassName - Return a nice clean name for a pass. This usually implemented in terms of the name that is registered by one of the Registration templates, but can be overloaded directly.

getPassName - Return a nice clean name for a pass. This usually implemented in terms of the name that is registered by one of the Registration templates, but can be overloaded directly.

Reimplemented from llvm::Pass.

Definition at line 97 of file MachOWriter.h.

bool MachOWriter::doInitialization ( Module M  )  [protected, virtual]

doInitialization - Emit the file header and all of the global variables for the module to the Mach-O file.

Reimplemented from llvm::FunctionPass.

Definition at line 440 of file MachOWriter.cpp.

References llvm::MachOWriter::MachOHeader::filetype, Header, is64Bit, isLittleEndian, Mang, llvm::MachOWriter::MachOHeader::MH_OBJECT, and llvm::MachOWriter::MachOHeader::setMagic().

bool MachOWriter::runOnMachineFunction ( MachineFunction MF  )  [protected, virtual]

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.

Implements llvm::MachineFunctionPass.

Definition at line 435 of file MachOWriter.cpp.

bool MachOWriter::doFinalization ( Module M  )  [protected, virtual]

doFinalization - Now that the module has been completely processed, emit the Mach-O file to 'O'.

doFinalization - Now that the module has been completely processed, emit the Mach-O file to 'O'.

Reimplemented from llvm::FunctionPass.

Definition at line 455 of file MachOWriter.cpp.

References DynamicSymbolTable, E, llvm::Module::global_begin(), llvm::Module::global_end(), I, Mang, O, StrT, SymbolTable, SymT, and llvm::raw_ostream::write().

void MachOWriter::InitMem ( const Constant C,
void *  Addr,
intptr_t  Offset,
const TargetData TD,
std::vector< MachineRelocation > &  MRs 
) [static, protected]


Friends And Related Function Documentation

friend class MachOCodeEmitter [friend]

Definition at line 87 of file MachOWriter.h.

Referenced by MachOWriter().


Member Data Documentation

char MachOWriter::ID = 0 [static]

Definition at line 89 of file MachOWriter.h.

Output stream to send the resultant object file to.

Definition at line 105 of file MachOWriter.h.

Referenced by doFinalization().

Target machine description.

Definition at line 109 of file MachOWriter.h.

Referenced by MachOWriter().

Mang - The object used to perform name mangling for this module.

Definition at line 113 of file MachOWriter.h.

Referenced by doFinalization(), doInitialization(), and llvm::MachOCodeEmitter::finishFunction().

MCE - The MachineCodeEmitter object that we are exposing to emit machine code for functions to the .o file.

Definition at line 117 of file MachOWriter.h.

Referenced by getMachineCodeEmitter(), MachOWriter(), and ~MachOWriter().

bool llvm::MachOWriter::is64Bit [protected]

is64Bit/isLittleEndian - This information is inferred from the target machine directly, indicating what header values and flags to set.

Definition at line 121 of file MachOWriter.h.

Referenced by doInitialization(), and MachOWriter().

Definition at line 121 of file MachOWriter.h.

Referenced by doInitialization(), and MachOWriter().

Header - An instance of MachOHeader that we will update while we build the file, and then emit during finalization.

Definition at line 240 of file MachOWriter.h.

Referenced by doInitialization().

std::vector<MachOSym> llvm::MachOWriter::SymbolTable [protected]

SymbolTable - This is the list of symbols we have emitted to the file. This actually gets rearranged before emission to the file (to put the local symbols first in the list).

Definition at line 576 of file MachOWriter.h.

Referenced by doFinalization(), and llvm::MachOCodeEmitter::finishFunction().

SymT - A buffer to hold the symbol table before we write it out at the appropriate location in the file.

Definition at line 580 of file MachOWriter.h.

Referenced by doFinalization().

StrT - A buffer to hold the string table before we write it out at the appropriate location in the file.

Definition at line 584 of file MachOWriter.h.

Referenced by doFinalization().

PendingSyms - This is a list of externally defined symbols that we have been asked to emit, but have not seen a reference to. When a reference is seen, the symbol will move from this list to the SymbolTable.

Definition at line 589 of file MachOWriter.h.

Referenced by llvm::MachOCodeEmitter::finishFunction().

DynamicSymbolTable - This is just a vector of indices into SymbolTable to aid in emitting the DYSYMTAB load command.

Definition at line 593 of file MachOWriter.h.

Referenced by doFinalization().


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



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.