LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::AsmPrinter Class Reference

#include <AsmPrinter.h>

Inheritance diagram for llvm::AsmPrinter:

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

Collaboration graph
[legend]
List of all members.

Protected Member Functions

 AsmPrinter (std::ostream &o, TargetMachine &tm)
bool doInitialization (Module &M)
bool doFinalization (Module &M)
void setupMachineFunction (MachineFunction &MF)
void emitAlignment (unsigned NumBits) const
void emitZeros (unsigned NumZeros) const
void emitConstantValueOnly (const Constant *CV)
void emitGlobalConstant (const Constant *CV)

Protected Attributes

std::ostream & O
TargetMachineTM
ManglerMang
std::string CurrentFnName
const char * CommentString
const char * GlobalPrefix
const char * ZeroDirective
const char * AsciiDirective
const char * Data8bitsDirective
const char * Data16bitsDirective
const char * Data32bitsDirective
const char * Data64bitsDirective
const char * AlignDirective
bool AlignmentIsInBytes

Detailed Description

Definition at line 25 of file AsmPrinter.h.


Constructor & Destructor Documentation

llvm::AsmPrinter::AsmPrinter std::ostream &  o,
TargetMachine tm
[inline, protected]
 

Definition at line 85 of file AsmPrinter.h.


Member Function Documentation

bool AsmPrinter::doFinalization Module M  )  [protected, virtual]
 

doFinalization - Shut down the asmprinter. If you override this in your pass, you must make sure to call it explicitly.

Reimplemented from llvm::FunctionPass.

Definition at line 26 of file AsmPrinter.cpp.

References Mang.

bool AsmPrinter::doInitialization Module M  )  [protected, virtual]
 

doInitialization - Set up the AsmPrinter when we are working on a new module. If your pass overrides this, it must make sure to explicitly call this implementation.

Reimplemented from llvm::FunctionPass.

Definition at line 21 of file AsmPrinter.cpp.

References GlobalPrefix, and Mang.

void AsmPrinter::emitAlignment unsigned  NumBits  )  const [protected]
 

emitAlignment - Emit an alignment directive to the specified power of two boundary. For example, if you pass in 3 here, you will get an 8 byte alignment.

Definition at line 37 of file AsmPrinter.cpp.

References AlignDirective, AlignmentIsInBytes, and O.

void AsmPrinter::emitConstantValueOnly const Constant CV  )  [protected]
 

emitConstantValueOnly - Print out the specified constant, without a storage class. Only constants of first-class type are allowed here.

Definition at line 57 of file AsmPrinter.cpp.

References Add(), llvm::Instruction::Cast, llvm::TargetData::getIndexedOffset(), llvm::TargetMachine::getTargetData(), llvm::Value::getType(), llvm::TargetData::getTypeSize(), llvm::Mangler::getValueName(), llvm::Type::IntTy, llvm::Constant::isNullValue(), llvm::Type::LongTy, Mang, O, TM, llvm::ConstantBool::True, llvm::Type::UIntTy, and llvm::Type::ULongTy.

Referenced by emitGlobalConstant().

void AsmPrinter::emitGlobalConstant const Constant CV  )  [protected]
 

emitGlobalConstant - Print a general LLVM constant to the .s file.

Definition at line 171 of file AsmPrinter.cpp.

References AsciiDirective, llvm::Type::BoolTyID, CommentString, Data16bitsDirective, Data32bitsDirective, Data64bitsDirective, Data8bitsDirective, llvm::Type::DoubleTy, llvm::Type::DoubleTyID, emitConstantValueOnly(), emitZeros(), llvm::Type::FloatTyID, llvm::TargetData::getStructLayout(), llvm::TargetMachine::getTargetData(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::TargetData::getTypeSize(), llvm::Type::IntTyID, llvm::TargetData::isBigEndian(), llvm::Constant::isNullValue(), llvm::Type::LongTy, llvm::Type::LongTyID, llvm::StructLayout::MemberOffsets, O, llvm::Type::PointerTyID, printAsCString(), llvm::Type::SByteTyID, llvm::Type::ShortTyID, llvm::StructLayout::StructSize, TM, U, llvm::Type::UByteTyID, llvm::Type::UIntTyID, llvm::Type::ULongTy, llvm::Type::ULongTyID, and llvm::Type::UShortTyID.

void AsmPrinter::emitZeros unsigned  NumZeros  )  const [protected]
 

emitZeros - Emit a block of zeros.

Definition at line 44 of file AsmPrinter.cpp.

References Data8bitsDirective, O, and ZeroDirective.

Referenced by emitGlobalConstant().

void AsmPrinter::setupMachineFunction MachineFunction MF  )  [protected]
 

setupMachineFunction - This should be called when a new MachineFunction is being processed from runOnMachineFunction.

Definition at line 31 of file AsmPrinter.cpp.

References CurrentFnName, llvm::MachineFunction::getFunction(), llvm::Mangler::getValueName(), and Mang.


Member Data Documentation

const char* llvm::AsmPrinter::AlignDirective [protected]
 

AlignDirective - The directive used to emit round up to an alignment boundary.

Definition at line 77 of file AsmPrinter.h.

Referenced by emitAlignment().

bool llvm::AsmPrinter::AlignmentIsInBytes [protected]
 

AlignmentIsInBytes - If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number of bytes to align to. Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary.

Definition at line 83 of file AsmPrinter.h.

Referenced by emitAlignment().

const char* llvm::AsmPrinter::AsciiDirective [protected]
 

AsciiDirective - This directive allows emission of an ascii string with the standard C escape characters embedded into it.

Definition at line 64 of file AsmPrinter.h.

Referenced by emitGlobalConstant().

const char* llvm::AsmPrinter::CommentString [protected]
 

CommentString - This indicates the comment character used by the assembler.

Definition at line 50 of file AsmPrinter.h.

Referenced by emitGlobalConstant().

std::string llvm::AsmPrinter::CurrentFnName [protected]
 

Cache of mangled name for current function. This is recalculated at the beginning of each call to runOnMachineFunction().

Definition at line 42 of file AsmPrinter.h.

Referenced by setupMachineFunction().

const char* llvm::AsmPrinter::Data16bitsDirective [protected]
 

Definition at line 70 of file AsmPrinter.h.

Referenced by emitGlobalConstant().

const char* llvm::AsmPrinter::Data32bitsDirective [protected]
 

Definition at line 71 of file AsmPrinter.h.

Referenced by emitGlobalConstant().

const char* llvm::AsmPrinter::Data64bitsDirective [protected]
 

Definition at line 72 of file AsmPrinter.h.

Referenced by emitGlobalConstant().

const char* llvm::AsmPrinter::Data8bitsDirective [protected]
 

DataDirectives - These directives are used to output some unit of integer data to the current section. If a data directive is set to null, smaller data directives will be used to emit the large sizes.

Definition at line 69 of file AsmPrinter.h.

Referenced by emitGlobalConstant(), and emitZeros().

const char* llvm::AsmPrinter::GlobalPrefix [protected]
 

GlobalPrefix - If this is set to a non-empty string, it is prepended onto all global symbols. This is often used for "_" or ".".

Definition at line 54 of file AsmPrinter.h.

Referenced by doInitialization().

Mangler* llvm::AsmPrinter::Mang [protected]
 

Name-mangler for global names.

Definition at line 37 of file AsmPrinter.h.

Referenced by doFinalization(), doInitialization(), emitConstantValueOnly(), and setupMachineFunction().

std::ostream& llvm::AsmPrinter::O [protected]
 

Output stream on which we're printing assembly code.

Definition at line 29 of file AsmPrinter.h.

Referenced by emitAlignment(), emitConstantValueOnly(), emitGlobalConstant(), and emitZeros().

TargetMachine& llvm::AsmPrinter::TM [protected]
 

Target machine description.

Definition at line 33 of file AsmPrinter.h.

Referenced by emitConstantValueOnly(), and emitGlobalConstant().

const char* llvm::AsmPrinter::ZeroDirective [protected]
 

ZeroDirective - this should be set to the directive used to get some number of zero bytes emitted to the current section. Common cases are "\t.zero\t" and "\t.space\t". If this is set to null, the Data*bitsDirective's will be used to emit zero bytes.

Definition at line 60 of file AsmPrinter.h.

Referenced by emitZeros().


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