LLVM API Documentation
#include <MachOWriter.h>
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 |
Definition at line 43 of file MachOWriter.h.
| llvm::MachOWriter::MachOWriter | ( | raw_ostream & | O, | |
| TargetMachine & | TM | |||
| ) |
Definition at line 59 of file MachOWriter.cpp.
References llvm::TargetData::getPointerSizeInBits(), llvm::TargetMachine::getTargetAsmInfo(), llvm::TargetMachine::getTargetData(), is64Bit, isLittleEndian, llvm::TargetData::isLittleEndian(), MachOCE, MachOCodeEmitter, TAI, and TM.
| llvm::MachOWriter::~MachOWriter | ( | ) | [virtual] |
| 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.
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.
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] |
Definition at line 601 of file MachOWriter.cpp.
References llvm::BinaryObject::addRelocation(), llvm::ByteSwap_16(), llvm::ByteSwap_32(), llvm::ByteSwap_64(), llvm::cerr(), CP, llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::BinaryObject::getData(), llvm::StructLayout::getElementOffset(), llvm::MachineRelocation::getGV(), llvm::TargetData::getIndexedOffset(), llvm::User::getNumOperands(), llvm::Constant::getOperand(), llvm::TargetData::getPointerSize(), llvm::TargetData::getStructLayout(), llvm::Value::getType(), llvm::TargetData::getTypeAllocSize(), llvm::Type::getTypeID(), llvm::Type::IntegerTyID, llvm::TargetData::isBigEndian(), llvm::Type::isSingleValueType(), llvm::llvm_report_error(), llvm_unreachable, llvm::Intrinsic::memset, llvm::Type::PointerTyID, llvm::raw_string_ostream::str(), llvm::MachineRelocation::VANILLA, and WorkList.
Referenced by llvm::MachOCodeEmitter::emitConstantPool().
friend class MachOCodeEmitter [friend] |
char llvm::MachOWriter::ID = 0 [static] |
Definition at line 46 of file MachOWriter.h.
raw_ostream& llvm::MachOWriter::O [protected] |
Output stream to send the resultant object file to.
Definition at line 62 of file MachOWriter.h.
Referenced by doFinalization().
TargetMachine& llvm::MachOWriter::TM [protected] |
Target machine description.
Definition at line 66 of file MachOWriter.h.
Referenced by MachOWriter().
Mangler* llvm::MachOWriter::Mang [protected] |
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().
MachOCodeEmitter* llvm::MachOWriter::MachOCE [protected] |
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().
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 78 of file MachOWriter.h.
Referenced by doInitialization(), and MachOWriter().
bool llvm::MachOWriter::isLittleEndian [protected] |
const TargetAsmInfo* llvm::MachOWriter::TAI [protected] |
MachOHeader llvm::MachOWriter::Header [protected] |
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().
std::vector<GlobalValue*> llvm::MachOWriter::PendingGlobals [protected] |
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().
std::vector<unsigned> llvm::MachOWriter::DynamicSymbolTable [protected] |
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().