LLVM API Documentation

llvm::MachOWriter Class Reference

#include <MachOWriter.h>

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

List of all members.

Public Member Functions

ObjectCodeEmitter * getObjectCodeEmitter ()
 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, uintptr_t Offset, const TargetData *TD, MachOSection *mos)

Protected Attributes

raw_ostream & O
TargetMachine & TM
Mangler * Mang
MachOCodeEmitter * MachOCE
bool is64Bit
bool isLittleEndian
const TargetAsmInfo * TAI
MachOHeader Header
std::vector< MachOSym > SymbolTable
std::vector< unsigned char > SymT
std::vector< unsigned char > StrT
std::vector< GlobalValue * > PendingGlobals
std::vector< unsigned > DynamicSymbolTable

Friends

class MachOCodeEmitter

Classes

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 43 of file MachOWriter.h.


Constructor & Destructor Documentation

llvm::MachOWriter::MachOWriter ( raw_ostream &  O,
TargetMachine &  TM 
)

llvm::MachOWriter::~MachOWriter (  )  [virtual]

Definition at line 70 of file MachOWriter.cpp.

References MachOCE.


Member Function Documentation

ObjectCodeEmitter* llvm::MachOWriter::getObjectCodeEmitter (  )  [inline]

Definition at line 48 of file MachOWriter.h.

References MachOCE.

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 55 of file MachOWriter.h.

bool llvm::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 74 of file MachOWriter.cpp.

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

bool llvm::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 87 of file MachOWriter.cpp.

bool llvm::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 93 of file MachOWriter.cpp.

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

void llvm::MachOWriter::InitMem ( const Constant *  C,
uintptr_t  Offset,
const TargetData *  TD,
MachOSection *  mos 
) [static, protected]


Friends And Related Function Documentation

friend class MachOCodeEmitter [friend]

Definition at line 44 of file MachOWriter.h.

Referenced by MachOWriter().


Member Data Documentation

char llvm::MachOWriter::ID = 0 [static]

Definition at line 46 of file MachOWriter.h.

Output stream to send the resultant object file to.

Definition at line 62 of file MachOWriter.h.

Referenced by doFinalization().

Target machine description.

Definition at line 66 of file MachOWriter.h.

Referenced by MachOWriter().

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

Definition at line 70 of file MachOWriter.h.

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

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

Definition at line 74 of file MachOWriter.h.

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

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

Definition at line 78 of file MachOWriter.h.

Referenced by doInitialization(), and MachOWriter().

Definition at line 78 of file MachOWriter.h.

Referenced by doInitialization(), and MachOWriter().

Definition at line 81 of file MachOWriter.h.

Referenced by MachOWriter().

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

Definition at line 85 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 162 of file MachOWriter.h.

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

std::vector<unsigned char> llvm::MachOWriter::SymT [protected]

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

Definition at line 166 of file MachOWriter.h.

Referenced by doFinalization().

std::vector<unsigned char> llvm::MachOWriter::StrT [protected]

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

Definition at line 170 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 175 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 179 of file MachOWriter.h.

Referenced by doFinalization().


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