LLVM API Documentation

Public Types | Public Member Functions | Public Attributes | Protected Member Functions
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.

Public Types

enum  CFIMoveType { CFI_M_None, CFI_M_EH, CFI_M_Debug }

Public Member Functions

virtual ~AsmPrinter ()
bool isVerbose () const
unsigned getFunctionNumber () const
const TargetLoweringObjectFilegetObjFileLowering () const
 getObjFileLowering - Return information about object file lowering.
const DataLayoutgetDataLayout () const
 getDataLayout - Return information about data layout.
StringRef getTargetTriple () const
 getTargetTriple - Return the target triple string.
const MCSectiongetCurrentSection () const
 getCurrentSection() - Return the current section we are emitting to.
void getAnalysisUsage (AnalysisUsage &AU) const
bool doInitialization (Module &M)
bool doFinalization (Module &M)
virtual bool runOnMachineFunction (MachineFunction &MF)
void SetupMachineFunction (MachineFunction &MF)
void EmitFunctionHeader ()
void EmitFunctionBody ()
void emitPrologLabel (const MachineInstr &MI)
CFIMoveType needsCFIMoves ()
bool needsSEHMoves ()
bool needsRelocationsForDwarfStringPool () const
virtual void EmitConstantPool ()
void EmitJumpTableInfo ()
virtual void EmitGlobalVariable (const GlobalVariable *GV)
 EmitGlobalVariable - Emit the specified global variable to the .s file.
bool EmitSpecialLLVMGlobal (const GlobalVariable *GV)
void EmitAlignment (unsigned NumBits, const GlobalValue *GV=0) const
void EmitBasicBlockStart (const MachineBasicBlock *MBB) const
void EmitGlobalConstant (const Constant *CV, unsigned AddrSpace=0)
 EmitGlobalConstant - Print a general LLVM constant to the .s file.
virtual void EmitStartOfAsmFile (Module &)
virtual void EmitEndOfAsmFile (Module &)
virtual void EmitFunctionBodyStart ()
virtual void EmitFunctionBodyEnd ()
virtual void EmitInstruction (const MachineInstr *)
 EmitInstruction - Targets should implement this to emit instructions.
virtual void EmitFunctionEntryLabel ()
virtual void EmitMachineConstantPoolValue (MachineConstantPoolValue *MCPV)
virtual void EmitXXStructor (const Constant *CV)
virtual bool isBlockOnlyReachableByFallthrough (const MachineBasicBlock *MBB) const
MCSymbolGetTempSymbol (StringRef Name, unsigned ID) const
MCSymbolGetTempSymbol (StringRef Name) const
MCSymbolGetSymbolWithGlobalValueBase (const GlobalValue *GV, StringRef Suffix, bool ForcePrivate=true) const
MCSymbolGetExternalSymbolSymbol (StringRef Sym) const
MCSymbolGetCPISymbol (unsigned CPID) const
 GetCPISymbol - Return the symbol for the specified constant pool entry.
MCSymbolGetJTISymbol (unsigned JTID, bool isLinkerPrivate=false) const
 GetJTISymbol - Return the symbol for the specified jump table entry.
MCSymbolGetJTSetSymbol (unsigned UID, unsigned MBBID) const
MCSymbolGetBlockAddressSymbol (const BlockAddress *BA) const
MCSymbolGetBlockAddressSymbol (const BasicBlock *BB) const
void printOffset (int64_t Offset, raw_ostream &OS) const
 printOffset - This is just convenient handler for printing offsets.
void EmitInt8 (int Value) const
void EmitInt16 (int Value) const
void EmitInt32 (int Value) const
void EmitLabelDifference (const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const
void EmitLabelOffsetDifference (const MCSymbol *Hi, uint64_t Offset, const MCSymbol *Lo, unsigned Size) const
void EmitLabelPlusOffset (const MCSymbol *Label, uint64_t Offset, unsigned Size) const
void EmitLabelReference (const MCSymbol *Label, unsigned Size) const
void EmitSLEB128 (int Value, const char *Desc=0) const
 EmitSLEB128 - emit the specified signed leb128 value.
void EmitULEB128 (unsigned Value, const char *Desc=0, unsigned PadTo=0) const
 EmitULEB128 - emit the specified unsigned leb128 value.
void EmitCFAByte (unsigned Val) const
 EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
void EmitEncodingByte (unsigned Val, const char *Desc=0) const
unsigned GetSizeOfEncodedValue (unsigned Encoding) const
 GetSizeOfEncodedValue - Return the size of the encoding in bytes.
void EmitTTypeReference (const GlobalValue *GV, unsigned Encoding) const
 EmitReference - Emit reference to a ttype global with a specified encoding.
void EmitSectionOffset (const MCSymbol *Label, const MCSymbol *SectionLabel) const
virtual MachineLocation getDebugValueLocation (const MachineInstr *MI) const
virtual unsigned getISAEncoding ()
virtual void EmitDwarfRegOp (const MachineLocation &MLoc) const
 EmitDwarfRegOp - Emit dwarf register operation.
void emitCFIInstruction (const MCCFIInstruction &Inst) const
 Emit frame instruction to describe the layout of the frame.
virtual void PrintSpecial (const MachineInstr *MI, raw_ostream &OS, const char *Code) const
virtual bool PrintAsmOperand (const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
virtual bool PrintAsmMemoryOperand (const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)

Public Attributes

TargetMachineTM
const MCAsmInfoMAI
MCContextOutContext
MCStreamerOutStreamer
const MachineFunctionMF
 The current machine function.
MachineModuleInfoMMI
 MMI - This is a pointer to the current MachineModuleInfo.
ManglerMang
MCSymbolCurrentFnSym
MCSymbolCurrentFnSymForSize

Protected Member Functions

 AsmPrinter (TargetMachine &TM, MCStreamer &Streamer)

Detailed Description

AsmPrinter - This class is intended to be used as a driving class for all asm writers.

Definition at line 57 of file AsmPrinter.h.


Member Enumeration Documentation

Enumerator:
CFI_M_None 
CFI_M_EH 
CFI_M_Debug 

Definition at line 189 of file AsmPrinter.h.


Constructor & Destructor Documentation

AsmPrinter::AsmPrinter ( TargetMachine TM,
MCStreamer Streamer 
) [explicit, protected]
AsmPrinter::~AsmPrinter ( ) [virtual]

Member Function Documentation

bool AsmPrinter::doFinalization ( Module M) [virtual]

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

Reimplemented from llvm::Pass.

Reimplemented in llvm::NVPTXAsmPrinter.

Definition at line 848 of file AsmPrinter.cpp.

References llvm::MCStreamer::AddBlankLine(), llvm::Module::alias_begin(), llvm::Module::alias_end(), llvm::GCModuleInfo::begin(), llvm::Module::begin(), llvm::MCSymbolRefExpr::Create(), DbgTimerName, llvm::GlobalValue::DefaultVisibility, DWARFGroupName, EHTimerName, llvm::MCStreamer::EmitAssignment(), EmitEndOfAsmFile(), EmitGlobalVariable(), llvm::TargetLoweringObjectFile::emitModuleFlags(), llvm::MCStreamer::EmitSymbolAttribute(), llvm::SmallVectorBase::empty(), llvm::GCModuleInfo::end(), llvm::Module::end(), llvm::DwarfException::EndModule(), llvm::DwarfDebug::endModule(), F(), llvm::MCStreamer::Finish(), llvm::Module::getFunction(), llvm::Module::getModuleFlagsMetadata(), llvm::MCAsmInfo::getNonexecutableStackSection(), getObjFileLowering(), llvm::Mangler::getSymbol(), llvm::GlobalValue::getVisibility(), llvm::MCAsmInfo::getWeakRefDirective(), llvm::Module::global_begin(), llvm::Module::global_end(), llvm::MCAsmInfo::hasSetDirective(), I, llvm::GlobalValue::isDeclaration(), MAI, Mang, llvm::MCSA_Global, llvm::MCSA_WeakReference, llvm::A64CC::MI, MMI, OutContext, OutStreamer, llvm::MCStreamer::reset(), llvm::MCStreamer::SwitchSection(), T, llvm::TimePassesIsEnabled, TM, and llvm::Value::use_empty().

Referenced by llvm::NVPTXAsmPrinter::doFinalization().

bool AsmPrinter::doInitialization ( Module M) [virtual]
void AsmPrinter::EmitAlignment ( unsigned  NumBits,
const GlobalValue GV = 0 
) const

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. If a global value is specified, and if that global has an explicit alignment requested, it will override the alignment request if required for correctness.

Reimplemented in llvm::HexagonAsmPrinter.

Definition at line 1423 of file AsmPrinter.cpp.

References llvm::MCStreamer::EmitCodeAlignment(), llvm::MCStreamer::EmitValueToAlignment(), getCurrentSection(), llvm::TargetMachine::getDataLayout(), getGVAlignmentLog2(), llvm::MCSection::getKind(), llvm::SectionKind::isText(), OutStreamer, and TM.

Referenced by EmitBasicBlockStart(), EmitConstantPool(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::ARMAsmPrinter::EmitEndOfAsmFile(), llvm::DwarfException::EmitExceptionTable(), EmitFunctionHeader(), EmitGlobalVariable(), llvm::ARMAsmPrinter::EmitInstruction(), and EmitJumpTableInfo().

void AsmPrinter::EmitBasicBlockStart ( const MachineBasicBlock MBB) const
void AsmPrinter::EmitCFAByte ( unsigned  Val) const

EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.

Definition at line 53 of file AsmPrinterDwarf.cpp.

References llvm::MCStreamer::AddComment(), llvm::dwarf::CallFrameString(), llvm::dwarf::DW_CFA_offset, llvm::MCStreamer::EmitIntValue(), isVerbose(), and OutStreamer.

void AsmPrinter::emitCFIInstruction ( const MCCFIInstruction Inst) const
void AsmPrinter::EmitConstantPool ( ) [virtual]

EmitConstantPool - Print to the current output stream assembly representations of the constants in the constant pool MCP. This is used to print out constants which have been "spilled to memory" by the code generator.

Reimplemented in llvm::ARMAsmPrinter.

Definition at line 984 of file AsmPrinter.cpp.

References Align(), llvm::MachineConstantPoolEntry::ConstVal, EmitAlignment(), EmitGlobalConstant(), llvm::MCStreamer::EmitLabel(), EmitMachineConstantPoolValue(), llvm::MCStreamer::EmitZeros(), llvm::MachineConstantPoolEntry::getAlignment(), llvm::MachineFunction::getConstantPool(), llvm::MachineConstantPool::getConstants(), GetCPISymbol(), llvm::TargetMachine::getDataLayout(), llvm::SectionKind::getMergeableConst(), llvm::SectionKind::getMergeableConst16(), llvm::SectionKind::getMergeableConst4(), llvm::SectionKind::getMergeableConst8(), getObjFileLowering(), llvm::SectionKind::getReadOnlyWithRel(), llvm::SectionKind::getReadOnlyWithRelLocal(), llvm::MachineConstantPoolEntry::getRelocationInfo(), llvm::TargetLoweringObjectFile::getSectionForConstant(), llvm::MachineConstantPoolEntry::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::MachineConstantPoolEntry::isMachineConstantPoolEntry(), llvm_unreachable, llvm::Log2_32(), llvm::MachineConstantPoolEntry::MachineCPVal, MF, OutStreamer, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::MCStreamer::SwitchSection(), TM, and llvm::MachineConstantPoolEntry::Val.

Referenced by EmitFunctionHeader().

void AsmPrinter::EmitDwarfRegOp ( const MachineLocation MLoc) const [virtual]
void AsmPrinter::EmitEncodingByte ( unsigned  Val,
const char *  Desc = 0 
) const

EmitEncodingByte - Emit a .byte 42 directive that corresponds to an encoding. If verbose assembly output is enabled, we output comments describing the encoding. Desc is a string saying what the encoding is specifying (e.g. "LSDA").

EmitEncodingByte - Emit a .byte 42 directive that corresponds to an encoding. If verbose assembly output is enabled, we output comments describing the encoding. Desc is an optional string saying what the encoding is specifying (e.g. "LSDA").

Definition at line 95 of file AsmPrinterDwarf.cpp.

References llvm::MCStreamer::AddComment(), DecodeDWARFEncoding(), llvm::MCStreamer::EmitIntValue(), isVerbose(), and OutStreamer.

Referenced by llvm::DwarfException::EmitExceptionTable().

virtual void llvm::AsmPrinter::EmitEndOfAsmFile ( Module ) [inline, virtual]

EmitEndOfAsmFile - This virtual method can be overridden by targets that want to emit something at the end of their file.

Reimplemented in llvm::MipsAsmPrinter, llvm::ARMAsmPrinter, llvm::AArch64AsmPrinter, llvm::SystemZAsmPrinter, and llvm::X86AsmPrinter.

Definition at line 253 of file AsmPrinter.h.

Referenced by doFinalization().

void AsmPrinter::EmitFunctionBody ( )

EmitFunctionBody - This method emits the body and trailer for a function.

Definition at line 654 of file AsmPrinter.cpp.

References llvm::MCStreamer::AddBlankLine(), llvm::MCStreamer::AddComment(), llvm::MachineFunction::begin(), llvm::Function::begin(), llvm::DwarfDebug::beginInstruction(), llvm::MCSymbolRefExpr::Create(), llvm::MCBinaryExpr::CreateSub(), llvm::MCContext::CreateTempSymbol(), CurrentFnSym, CurrentFnSymForSize, llvm::TargetOpcode::DBG_VALUE, DbgTimerName, DWARFGroupName, llvm::TargetOpcode::EH_LABEL, EHTimerName, EmitBasicBlockStart(), emitComments(), emitDebugValueComment(), llvm::MCStreamer::EmitELFSize(), EmitFunctionBodyEnd(), EmitFunctionBodyStart(), emitImplicitDef(), EmitInstruction(), llvm::MCStreamer::EmitInstruction(), EmitJumpTableInfo(), emitKill(), llvm::MCStreamer::EmitLabel(), emitPrologLabel(), llvm::MCStreamer::EmitRawText(), llvm::MachineFunction::end(), llvm::Function::end(), llvm::DwarfException::EndFunction(), llvm::MachineModuleInfo::EndFunction(), llvm::DwarfDebug::endFunction(), llvm::DwarfDebug::endInstruction(), F(), llvm::TargetOpcode::GC_LABEL, GetBlockAddressSymbol(), llvm::MCStreamer::GetCommentOS(), getCurrentSection(), llvm::MachineFunction::getFunction(), llvm::TargetMachine::getInstrInfo(), llvm::TargetInstrInfo::getNoopForMachoTarget(), llvm::MCInst::getOpcode(), llvm::BasicBlock::hasAddressTaken(), llvm::MachineModuleInfo::hasDebugInfo(), llvm::MCAsmInfo::hasDotTypeDotSizeDirective(), llvm::TargetMachine::hasMCUseLoc(), llvm::MCAsmInfo::hasSubsectionsViaSymbols(), I, llvm::ARM_PROC::IE, llvm::TargetOpcode::IMPLICIT_DEF, llvm::TargetOpcode::INLINEASM, llvm::MCSymbol::isDefined(), llvm::MachineInstr::isPrologLabel(), isVerbose(), llvm::TargetOpcode::KILL, MAI, llvm::MCLineEntry::Make(), MF, MMI, OutContext, OutStreamer, llvm::TargetOpcode::PROLOG_LABEL, T, llvm::TimePassesIsEnabled, and TM.

Referenced by llvm::AMDGPUAsmPrinter::runOnMachineFunction(), llvm::X86AsmPrinter::runOnMachineFunction(), and runOnMachineFunction().

virtual void llvm::AsmPrinter::EmitFunctionBodyEnd ( ) [inline, virtual]

EmitFunctionBodyEnd - Targets can override this to emit stuff after the last basic block in the function.

Reimplemented in llvm::ARMAsmPrinter, and llvm::MipsAsmPrinter.

Definition at line 261 of file AsmPrinter.h.

Referenced by EmitFunctionBody().

virtual void llvm::AsmPrinter::EmitFunctionBodyStart ( ) [inline, virtual]

EmitFunctionBodyStart - Targets can override this to emit stuff before the first basic block in the function.

Reimplemented in llvm::MipsAsmPrinter.

Definition at line 257 of file AsmPrinter.h.

Referenced by EmitFunctionBody().

void AsmPrinter::EmitFunctionEntryLabel ( ) [virtual]

EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function. This can be overridden by targets as required to do custom stuff.

Reimplemented in llvm::ARMAsmPrinter, and llvm::MipsAsmPrinter.

Definition at line 483 of file AsmPrinter.cpp.

References CurrentFnSym, llvm::MCStreamer::EmitLabel(), llvm::MCSymbol::getName(), llvm::MCSymbol::isUndefined(), OutStreamer, and llvm::report_fatal_error().

Referenced by EmitFunctionHeader().

void AsmPrinter::EmitFunctionHeader ( )
void AsmPrinter::EmitGlobalConstant ( const Constant CV,
unsigned  AddrSpace = 0 
)
void AsmPrinter::EmitGlobalVariable ( const GlobalVariable GV) [virtual]

EmitGlobalVariable - Emit the specified global variable to the .s file.

Definition at line 262 of file AsmPrinter.cpp.

References llvm::MCStreamer::AddBlankLine(), Align(), llvm::MCConstantExpr::Create(), EmitAlignment(), llvm::MCStreamer::EmitCommonSymbol(), llvm::MCStreamer::EmitELFSize(), EmitGlobalConstant(), llvm::MCStreamer::EmitIntValue(), llvm::MCStreamer::EmitLabel(), llvm::MCStreamer::EmitLocalCommonSymbol(), EmitSpecialLLVMGlobal(), llvm::MCStreamer::EmitSymbolAttribute(), llvm::MCStreamer::EmitSymbolValue(), llvm::MCStreamer::EmitTBSSSymbol(), llvm::MCStreamer::EmitZerofill(), llvm::MCObjectFileInfo::getCommDirectiveSupportsAlignment(), llvm::MCStreamer::GetCommentOS(), llvm::TargetMachine::getDataLayout(), llvm::SequentialType::getElementType(), GetExternalSymbolSymbol(), getGVAlignmentLog2(), llvm::GlobalVariable::getInitializer(), llvm::TargetLoweringObjectFile::getKindForGlobal(), llvm::MCAsmInfo::getLCOMMDirectiveAlignmentType(), llvm::GlobalValue::getLinkage(), llvm::MCSymbol::getName(), getObjFileLowering(), llvm::MCContext::GetOrCreateSymbol(), llvm::GlobalValue::getParent(), llvm::DataLayout::getPointerSizeInBits(), llvm::Mangler::getSymbol(), llvm::MCObjectFileInfo::getTLSExtraDataSection(), llvm::GlobalValue::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::GlobalValue::getVisibility(), llvm::MCAsmInfo::hasDotTypeDotSizeDirective(), llvm::GlobalVariable::hasInitializer(), llvm::MCAsmInfo::hasMachoTBSSDirective(), llvm::MCAsmInfo::hasMachoZeroFillDirective(), llvm::SectionKind::isBSSExtern(), llvm::SectionKind::isBSSLocal(), llvm::SectionKind::isCommon(), llvm::GlobalValue::isDeclaration(), llvm::SectionKind::isThreadBSS(), llvm::SectionKind::isThreadData(), llvm::SectionKind::isThreadLocal(), isVerbose(), MAI, Mang, llvm::MCSA_ELF_TypeObject, llvm::MCSA_Global, llvm::MCSA_Local, llvm::LCOMM::NoAlignment, OutContext, OutStreamer, llvm::TargetLoweringObjectFile::SectionForGlobal(), llvm::MCStreamer::SwitchSection(), TM, and llvm::WriteAsOperand().

Referenced by doFinalization().

virtual void llvm::AsmPrinter::EmitInstruction ( const MachineInstr ) [inline, virtual]

EmitInstruction - Targets should implement this to emit instructions.

Reimplemented in llvm::ARMAsmPrinter, llvm::MipsAsmPrinter, llvm::AArch64AsmPrinter, llvm::X86AsmPrinter, llvm::AMDGPUAsmPrinter, llvm::HexagonAsmPrinter, and llvm::SystemZAsmPrinter.

Definition at line 264 of file AsmPrinter.h.

References llvm_unreachable.

Referenced by EmitFunctionBody().

void AsmPrinter::EmitInt16 ( int  Value) const

EmitInt16 - Emit a short directive and value.

Definition at line 1335 of file AsmPrinter.cpp.

References llvm::MCStreamer::EmitIntValue(), and OutStreamer.

Referenced by llvm::DIEBlock::EmitValue().

void AsmPrinter::EmitInt32 ( int  Value) const

EmitInt32 - Emit a long directive and value.

Definition at line 1341 of file AsmPrinter.cpp.

References llvm::MCStreamer::EmitIntValue(), and OutStreamer.

Referenced by llvm::DIEEntry::EmitValue(), and llvm::DIEBlock::EmitValue().

void AsmPrinter::EmitInt8 ( int  Value) const

EmitInt8 - Emit a byte directive and value.

Definition at line 1329 of file AsmPrinter.cpp.

References llvm::MCStreamer::EmitIntValue(), and OutStreamer.

Referenced by llvm::ARMAsmPrinter::EmitDwarfRegOp(), EmitDwarfRegOp(), and llvm::DIEBlock::EmitValue().

void AsmPrinter::EmitJumpTableInfo ( )
void AsmPrinter::EmitLabelDifference ( const MCSymbol Hi,
const MCSymbol Lo,
unsigned  Size 
) const

EmitLabelDifference - Emit something like ".long Hi-Lo" where the size in bytes of the directive is specified by Size and Hi/Lo specify the labels. This implicitly uses .set if it is available.

Definition at line 1348 of file AsmPrinter.cpp.

References llvm::MCSymbolRefExpr::Create(), llvm::MCBinaryExpr::CreateSub(), llvm::MCStreamer::EmitAssignment(), llvm::MCStreamer::EmitSymbolValue(), llvm::MCStreamer::EmitValue(), GetTempSymbol(), llvm::MCAsmInfo::hasSetDirective(), MAI, OutContext, and OutStreamer.

Referenced by llvm::DwarfException::EmitExceptionTable(), EmitSectionOffset(), and llvm::DIEDelta::EmitValue().

void AsmPrinter::EmitLabelOffsetDifference ( const MCSymbol Hi,
uint64_t  Offset,
const MCSymbol Lo,
unsigned  Size 
) const

EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo" where the size in bytes of the directive is specified by Size and Hi/Lo specify the labels. This implicitly uses .set if it is available.

Definition at line 1370 of file AsmPrinter.cpp.

References llvm::MCConstantExpr::Create(), llvm::MCSymbolRefExpr::Create(), llvm::MCBinaryExpr::CreateAdd(), llvm::MCBinaryExpr::CreateSub(), llvm::MCStreamer::EmitAssignment(), llvm::MCStreamer::EmitSymbolValue(), llvm::MCStreamer::EmitValue(), GetTempSymbol(), llvm::MCAsmInfo::hasSetDirective(), MAI, OutContext, and OutStreamer.

void AsmPrinter::EmitLabelPlusOffset ( const MCSymbol Label,
uint64_t  Offset,
unsigned  Size 
) const

EmitLabelPlusOffset - Emit something like ".long Label+Offset" where the size in bytes of the directive is specified by Size and Label specifies the label. This implicitly uses .set if it is available.

Definition at line 1400 of file AsmPrinter.cpp.

References llvm::MCConstantExpr::Create(), llvm::MCSymbolRefExpr::Create(), llvm::MCBinaryExpr::CreateAdd(), llvm::MCStreamer::EmitValue(), OutContext, and OutStreamer.

Referenced by EmitLabelReference().

void llvm::AsmPrinter::EmitLabelReference ( const MCSymbol Label,
unsigned  Size 
) const [inline]

EmitLabelReference - Emit something like ".long Label" where the size in bytes of the directive is specified by Size and Label specifies the label.

Definition at line 365 of file AsmPrinter.h.

References EmitLabelPlusOffset().

void AsmPrinter::EmitMachineConstantPoolValue ( MachineConstantPoolValue MCPV) [virtual]

Reimplemented in llvm::ARMAsmPrinter, and llvm::SystemZAsmPrinter.

Definition at line 1887 of file AsmPrinter.cpp.

References llvm_unreachable.

Referenced by EmitConstantPool().

void AsmPrinter::emitPrologLabel ( const MachineInstr MI)
void AsmPrinter::EmitSectionOffset ( const MCSymbol Label,
const MCSymbol SectionLabel 
) const

EmitSectionOffset - Emit the 4-byte offset of Label from the start of its section. This can be done with a special directive if the target supports it (e.g. cygwin) or by emitting it as an offset from a label at the start of the section.

SectionLabel is a temporary label emitted at the start of the section that Label lives in.

Definition at line 141 of file AsmPrinterDwarf.cpp.

References llvm::MCStreamer::EmitCOFFSecRel32(), EmitLabelDifference(), llvm::MCStreamer::EmitSymbolValue(), llvm::MCSymbol::getSection(), llvm::MCSection::isBaseAddressKnownZero(), llvm::MCSymbol::isInSection(), MAI, llvm::MCAsmInfo::needsDwarfSectionOffsetDirective(), OutStreamer, and ARMBuildAttrs::Section.

void AsmPrinter::EmitSLEB128 ( int  Value,
const char *  Desc = 0 
) const
bool AsmPrinter::EmitSpecialLLVMGlobal ( const GlobalVariable GV)
virtual void llvm::AsmPrinter::EmitStartOfAsmFile ( Module ) [inline, virtual]

EmitStartOfAsmFile - This virtual method can be overridden by targets that want to emit something at the start of their file.

Reimplemented in llvm::MipsAsmPrinter, llvm::ARMAsmPrinter, and llvm::X86AsmPrinter.

Definition at line 249 of file AsmPrinter.h.

Referenced by doInitialization().

void AsmPrinter::EmitTTypeReference ( const GlobalValue GV,
unsigned  Encoding 
) const
void AsmPrinter::EmitULEB128 ( unsigned  Value,
const char *  Desc = 0,
unsigned  PadTo = 0 
) const
virtual void llvm::AsmPrinter::EmitXXStructor ( const Constant CV) [inline, virtual]

EmitXXStructor - Targets can override this to change how global constants that are part of a C++ static/global constructor list are emitted.

Reimplemented in llvm::ARMAsmPrinter.

Definition at line 275 of file AsmPrinter.h.

References EmitGlobalConstant().

void AsmPrinter::getAnalysisUsage ( AnalysisUsage AU) const [virtual]

getAnalysisUsage - Record analysis usage.

Reimplemented from llvm::MachineFunctionPass.

Definition at line 147 of file AsmPrinter.cpp.

References llvm::AnalysisUsage::addRequired(), isVerbose(), and llvm::AnalysisUsage::setPreservesAll().

MCSymbol * AsmPrinter::GetBlockAddressSymbol ( const BlockAddress BA) const
MCSymbol * AsmPrinter::GetBlockAddressSymbol ( const BasicBlock BB) const

Definition at line 1922 of file AsmPrinter.cpp.

References llvm::MachineModuleInfo::getAddrLabelSymbol(), and MMI.

MCSymbol * AsmPrinter::GetCPISymbol ( unsigned  CPID) const
const MCSection * AsmPrinter::getCurrentSection ( ) const

getCurrentSection() - Return the current section we are emitting to.

Definition at line 141 of file AsmPrinter.cpp.

References llvm::MCStreamer::getCurrentSection(), and OutStreamer.

Referenced by EmitAlignment(), and EmitFunctionBody().

const DataLayout & AsmPrinter::getDataLayout ( ) const
MachineLocation AsmPrinter::getDebugValueLocation ( const MachineInstr MI) const [virtual]

getDebugValueLocation - Get location information encoded by DBG_VALUE operands.

Reimplemented in llvm::ARMAsmPrinter, llvm::MipsAsmPrinter, llvm::X86AsmPrinter, and llvm::AArch64AsmPrinter.

Definition at line 796 of file AsmPrinter.cpp.

Referenced by llvm::CompileUnit::constructVariableDIE(), and getDebugLocEntry().

MCSymbol * AsmPrinter::GetExternalSymbolSymbol ( StringRef  Sym) const
unsigned AsmPrinter::getFunctionNumber ( ) const
virtual unsigned llvm::AsmPrinter::getISAEncoding ( ) [inline, virtual]

getISAEncoding - Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.

Reimplemented in llvm::ARMAsmPrinter.

Definition at line 411 of file AsmPrinter.h.

Referenced by llvm::CompileUnit::getOrCreateSubprogramDIE().

MCSymbol * AsmPrinter::GetJTISymbol ( unsigned  JTID,
bool  isLinkerPrivate = false 
) const
MCSymbol * AsmPrinter::GetJTSetSymbol ( unsigned  UID,
unsigned  MBBID 
) const

GetJTSetSymbol - Return the symbol for the specified jump table .set FIXME: privatize to AsmPrinter.

Definition at line 1940 of file AsmPrinter.cpp.

References getFunctionNumber(), llvm::MCContext::GetOrCreateSymbol(), llvm::MCAsmInfo::getPrivateGlobalPrefix(), MAI, and OutContext.

Referenced by EmitJumpTableInfo().

const TargetLoweringObjectFile & AsmPrinter::getObjFileLowering ( ) const
unsigned AsmPrinter::GetSizeOfEncodedValue ( unsigned  Encoding) const
MCSymbol * AsmPrinter::GetSymbolWithGlobalValueBase ( const GlobalValue GV,
StringRef  Suffix,
bool  ForcePrivate = true 
) const

GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with global value name as its base, with the specified suffix, and where the symbol is forced to have private linkage if ForcePrivate is true.

Definition at line 1949 of file AsmPrinter.cpp.

References llvm::SmallString< InternalLen >::append(), llvm::StringRef::begin(), llvm::StringRef::end(), llvm::Mangler::getNameWithPrefix(), llvm::MCContext::GetOrCreateSymbol(), Mang, OutContext, and llvm::SmallString< InternalLen >::str().

Referenced by llvm::X86AsmPrinter::printSymbolOperand().

StringRef AsmPrinter::getTargetTriple ( ) const

getTargetTriple - Return the target triple string.

Definition at line 136 of file AsmPrinter.cpp.

References llvm::TargetMachine::getTargetTriple(), and TM.

Referenced by llvm::DwarfDebug::DwarfDebug().

MCSymbol * AsmPrinter::GetTempSymbol ( StringRef  Name,
unsigned  ID 
) const
MCSymbol * AsmPrinter::GetTempSymbol ( StringRef  Name) const

GetTempSymbol - Return an assembler temporary label with the specified stem.

Definition at line 1912 of file AsmPrinter.cpp.

References llvm::MCContext::GetOrCreateSymbol(), llvm::MCAsmInfo::getPrivateGlobalPrefix(), MAI, and OutContext.

bool AsmPrinter::isBlockOnlyReachableByFallthrough ( const MachineBasicBlock MBB) const [virtual]
bool llvm::AsmPrinter::isVerbose ( ) const [inline]
AsmPrinter::CFIMoveType AsmPrinter::needsCFIMoves ( )
bool AsmPrinter::needsRelocationsForDwarfStringPool ( ) const

needsRelocationsForDwarfStringPool - Specifies whether the object format expects to use relocations to refer to debug entries. Alternatively we emit section offsets in bytes from the start of the string pool.

Definition at line 622 of file AsmPrinter.cpp.

References llvm::MCAsmInfo::doesDwarfUseRelocationsAcrossSections(), and MAI.

Referenced by llvm::CompileUnit::addLocalString(), and llvm::CompileUnit::addString().

bool AsmPrinter::needsSEHMoves ( )
bool AsmPrinter::PrintAsmMemoryOperand ( const MachineInstr MI,
unsigned  OpNo,
unsigned  AsmVariant,
const char *  ExtraCode,
raw_ostream OS 
) [virtual]

PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as an address. Targets should override this to format as appropriate. This method can return true if the operand is erroneous.

Reimplemented in llvm::MipsAsmPrinter, llvm::ARMAsmPrinter, llvm::X86AsmPrinter, llvm::AArch64AsmPrinter, llvm::HexagonAsmPrinter, and llvm::SystemZAsmPrinter.

Definition at line 547 of file AsmPrinterInlineAsm.cpp.

Referenced by EmitGCCInlineAsmStr(), and EmitMSInlineAsmStr().

bool AsmPrinter::PrintAsmOperand ( const MachineInstr MI,
unsigned  OpNo,
unsigned  AsmVariant,
const char *  ExtraCode,
raw_ostream O 
) [virtual]

PrintAsmOperand - Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant. Targets should override this to format as appropriate. This method can return true if the operand is erroneous.

PrintAsmOperand - Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant. Targets should override this to format as appropriate.

Reimplemented in llvm::MipsAsmPrinter, llvm::ARMAsmPrinter, llvm::X86AsmPrinter, llvm::AArch64AsmPrinter, llvm::HexagonAsmPrinter, and llvm::SystemZAsmPrinter.

Definition at line 521 of file AsmPrinterInlineAsm.cpp.

References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getType(), and llvm::MachineOperand::MO_Immediate.

Referenced by EmitGCCInlineAsmStr(), and EmitMSInlineAsmStr().

void AsmPrinter::printOffset ( int64_t  Offset,
raw_ostream OS 
) const

printOffset - This is just convenient handler for printing offsets.

Definition at line 1892 of file AsmPrinter.cpp.

Referenced by llvm::HexagonAsmPrinter::printOperand(), llvm::ARMAsmPrinter::printOperand(), and llvm::X86AsmPrinter::printSymbolOperand().

void AsmPrinter::PrintSpecial ( const MachineInstr MI,
raw_ostream OS,
const char *  Code 
) const [virtual]

PrintSpecial - Print information related to the specified machine instr that is independent of the operand, and may be independent of the instr itself. This can be useful for portably encoding the comment character or other bits of target-specific knowledge into the asmstrings. The syntax used is ${:comment}. Targets can override this to add support for their own strange codes.

Definition at line 492 of file AsmPrinterInlineAsm.cpp.

References llvm::MCAsmInfo::getCommentString(), getFunctionNumber(), llvm::MCAsmInfo::getPrivateGlobalPrefix(), MAI, llvm::A64CC::MI, llvm::report_fatal_error(), llvm::raw_string_ostream::str(), and llvm::LibFunc::strcmp.

Referenced by EmitGCCInlineAsmStr().

virtual bool llvm::AsmPrinter::runOnMachineFunction ( MachineFunction MF) [inline, virtual]

runOnMachineFunction - Emit the specified function out to the OutStreamer.

Implements llvm::MachineFunctionPass.

Reimplemented in llvm::AArch64AsmPrinter, llvm::ARMAsmPrinter, llvm::X86AsmPrinter, llvm::MipsAsmPrinter, and llvm::AMDGPUAsmPrinter.

Definition at line 164 of file AsmPrinter.h.

References EmitFunctionBody(), EmitFunctionHeader(), and SetupMachineFunction().

void AsmPrinter::SetupMachineFunction ( MachineFunction MF)

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

Definition at line 959 of file AsmPrinter.cpp.

References CurrentFnSym, CurrentFnSymForSize, llvm::MachineFunction::getFunction(), llvm::Mangler::getSymbol(), isVerbose(), Mang, and MF.

Referenced by llvm::AMDGPUAsmPrinter::runOnMachineFunction(), llvm::X86AsmPrinter::runOnMachineFunction(), and runOnMachineFunction().


Member Data Documentation

The symbol used to represent the start of the current function for the purpose of calculating its size (e.g. using the .size directive). By default, this is equal to CurrentFnSym.

Definition at line 96 of file AsmPrinter.h.

Referenced by AsmPrinter(), EmitFunctionBody(), and SetupMachineFunction().

OutContext - This is the context for the output file that we are streaming. This owns all of the global MC-related objects for the generated translation unit.

Definition at line 70 of file AsmPrinter.h.

Referenced by doFinalization(), doInitialization(), EmitCamlGlobal(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::ARMAsmPrinter::EmitEndOfAsmFile(), llvm::DwarfException::EmitExceptionTable(), EmitFunctionBody(), EmitFunctionHeader(), EmitGlobalVariable(), llvm::AMDGPUAsmPrinter::EmitInstruction(), llvm::X86AsmPrinter::EmitInstruction(), llvm::ARMAsmPrinter::EmitInstruction(), llvm::ARMAsmPrinter::EmitJump2Table(), llvm::ARMAsmPrinter::EmitJumpTable(), EmitJumpTableInfo(), EmitLabelDifference(), EmitLabelOffsetDifference(), EmitLabelPlusOffset(), llvm::SystemZAsmPrinter::EmitMachineConstantPoolValue(), llvm::ARMAsmPrinter::EmitMachineConstantPoolValue(), EmitSpecialLLVMGlobal(), llvm::ARMAsmPrinter::EmitStartOfAsmFile(), llvm::ARMAsmPrinter::EmitXXStructor(), llvm::Win64Exception::EndFunction(), GetCPISymbol(), GetExternalSymbolSymbol(), GetJTISymbol(), GetJTSetSymbol(), GetSymbolFromOperand(), GetSymbolRef(), GetSymbolWithGlobalValueBase(), GetTempSymbol(), llvm::HexagonLowerToMC(), nvptx::LowerConstant(), lowerConstant(), llvm::AArch64AsmPrinter::lowerOperand(), llvm::ARMAsmPrinter::lowerOperand(), llvm::LowerPPCMachineInstrToMCInst(), llvm::AArch64AsmPrinter::lowerSymbolOperand(), llvm::X86AsmPrinter::printSymbolOperand(), and llvm::MipsAsmPrinter::runOnMachineFunction().

OutStreamer - This is the MCStreamer object for the file we are generating. This contains the transient state for the current translation unit that we are generating (such as the current section etc).

Definition at line 76 of file AsmPrinter.h.

Referenced by llvm::DwarfCFIException::BeginFunction(), llvm::ARMException::BeginFunction(), llvm::Win64Exception::BeginFunction(), doFinalization(), doInitialization(), llvm::HexagonAsmPrinter::EmitAlignment(), EmitAlignment(), emitBasicBlockLoopComments(), EmitBasicBlockStart(), EmitCamlGlobal(), EmitCFAByte(), emitCFIInstruction(), EmitConstantPool(), emitDebugValueComment(), llvm::ARMAsmPrinter::EmitDwarfRegOp(), EmitDwarfRegOp(), EmitEncodingByte(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::SystemZAsmPrinter::EmitEndOfAsmFile(), llvm::AArch64AsmPrinter::EmitEndOfAsmFile(), llvm::ARMAsmPrinter::EmitEndOfAsmFile(), llvm::MipsAsmPrinter::EmitEndOfAsmFile(), llvm::DwarfException::EmitExceptionTable(), llvm::MipsAsmPrinter::emitFrameDirective(), EmitFunctionBody(), llvm::MipsAsmPrinter::EmitFunctionBodyEnd(), llvm::ARMAsmPrinter::EmitFunctionBodyEnd(), llvm::MipsAsmPrinter::EmitFunctionBodyStart(), llvm::MipsAsmPrinter::EmitFunctionEntryLabel(), llvm::ARMAsmPrinter::EmitFunctionEntryLabel(), EmitFunctionEntryLabel(), EmitFunctionHeader(), EmitGlobalConstant(), emitGlobalConstantArray(), emitGlobalConstantDataSequential(), emitGlobalConstantFP(), emitGlobalConstantImpl(), emitGlobalConstantLargeInt(), emitGlobalConstantStruct(), emitGlobalConstantVector(), EmitGlobalVariable(), emitImplicitDef(), llvm::SystemZAsmPrinter::EmitInstruction(), llvm::HexagonAsmPrinter::EmitInstruction(), llvm::AMDGPUAsmPrinter::EmitInstruction(), llvm::X86AsmPrinter::EmitInstruction(), llvm::AArch64AsmPrinter::EmitInstruction(), llvm::MipsAsmPrinter::EmitInstruction(), llvm::ARMAsmPrinter::EmitInstruction(), EmitInt16(), EmitInt32(), EmitInt8(), llvm::ARMAsmPrinter::EmitJump2Table(), llvm::ARMAsmPrinter::EmitJumpTable(), EmitJumpTableInfo(), emitKill(), EmitLabelDifference(), EmitLabelOffsetDifference(), EmitLabelPlusOffset(), llvm::SystemZAsmPrinter::EmitMachineConstantPoolValue(), llvm::ARMAsmPrinter::EmitMachineConstantPoolValue(), llvm::AMDGPUAsmPrinter::EmitProgramInfoR600(), llvm::AMDGPUAsmPrinter::EmitProgramInfoSI(), emitPrologLabel(), EmitSectionOffset(), emitSectionSym(), EmitSLEB128(), EmitSpecialLLVMGlobal(), llvm::X86AsmPrinter::EmitStartOfAsmFile(), llvm::ARMAsmPrinter::EmitStartOfAsmFile(), llvm::MipsAsmPrinter::EmitStartOfAsmFile(), EmitTTypeReference(), llvm::DwarfException::EmitTypeInfos(), EmitULEB128(), llvm::DIEInteger::EmitValue(), llvm::DIELabel::EmitValue(), llvm::ARMAsmPrinter::EmitXXStructor(), llvm::DwarfCFIException::EndFunction(), llvm::ARMException::EndFunction(), llvm::Win64Exception::EndFunction(), llvm::DwarfCFIException::EndModule(), getCurrentSection(), llvm::DwarfDebug::getOrCreateSourceID(), llvm::SystemZMCInstLower::lower(), llvm::AMDGPUAsmPrinter::runOnMachineFunction(), llvm::X86AsmPrinter::runOnMachineFunction(), and ~AsmPrinter().

Target machine description.

Definition at line 61 of file AsmPrinter.h.

Referenced by llvm::CompileUnit::addRegisterOffset(), llvm::CompileUnit::addRegisterOp(), llvm::CompileUnit::constructVariableDIE(), doFinalization(), doInitialization(), EmitAlignment(), EmitConstantPool(), emitDebugValueComment(), llvm::ARMAsmPrinter::EmitDwarfRegOp(), EmitDwarfRegOp(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::SystemZAsmPrinter::EmitEndOfAsmFile(), llvm::AArch64AsmPrinter::EmitEndOfAsmFile(), llvm::MipsAsmPrinter::emitFrameDirective(), EmitFunctionBody(), EmitFunctionHeader(), EmitGlobalConstant(), emitGlobalConstantArray(), emitGlobalConstantDataSequential(), emitGlobalConstantFP(), emitGlobalConstantImpl(), emitGlobalConstantLargeInt(), emitGlobalConstantStruct(), emitGlobalConstantVector(), EmitGlobalVariable(), emitImplicitDef(), llvm::ARMAsmPrinter::EmitJumpTable(), EmitJumpTableInfo(), emitKill(), llvm::SystemZAsmPrinter::EmitMachineConstantPoolValue(), llvm::ARMAsmPrinter::EmitMachineConstantPoolValue(), llvm::AMDGPUAsmPrinter::EmitProgramInfoR600(), llvm::AMDGPUAsmPrinter::EmitProgramInfoSI(), EmitSpecialLLVMGlobal(), llvm::ARMAsmPrinter::EmitStartOfAsmFile(), llvm::ARMAsmPrinter::EmitXXStructor(), llvm::DwarfCFIException::EndModule(), getDataLayout(), getObjFileLowering(), llvm::DwarfDebug::getOrCreateSourceID(), GetSizeOfEncodedValue(), getTargetTriple(), nvptx::LowerConstant(), lowerConstant(), llvm::MipsAsmPrinter::printSavedRegsBitmask(), llvm::AArch64AsmPrinter::printSymbolicAddress(), llvm::AMDGPUAsmPrinter::runOnMachineFunction(), and llvm::MipsAsmPrinter::runOnMachineFunction().


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