LLVM API Documentation
#include <AsmPrinter.h>
Inheritance diagram for llvm::AsmPrinter:
Definition at line 27 of file AsmPrinter.h.
AsmPrinter::AsmPrinter | ( | std::ostream & | o, | |
TargetMachine & | TM | |||
) | [protected] |
Definition at line 27 of file AsmPrinter.cpp.
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.
Reimplemented in llvm::X86SharedAsmPrinter.
Definition at line 93 of file AsmPrinter.cpp.
References Mang.
Referenced by llvm::X86SharedAsmPrinter::doFinalization().
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.
Reimplemented in llvm::X86SharedAsmPrinter, and llvm::X86IntelAsmPrinter.
Definition at line 76 of file AsmPrinter.cpp.
References CommentString, llvm::Module::getModuleInlineAsm(), GlobalPrefix, M, Mang, O, and SwitchSection().
Referenced by llvm::X86SharedAsmPrinter::doInitialization().
void AsmPrinter::EmitAlignment | ( | unsigned | NumBits, | |
const GlobalValue * | GV = 0 | |||
) | 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. If a global value is specified, and if that global has an explicit alignment requested, it will override the alignment request.
Definition at line 202 of file AsmPrinter.cpp.
References AlignDirective, AlignmentIsInBytes, llvm::GlobalValue::getAlignment(), GV, llvm::Log2_32(), and O.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), EmitConstantPool(), EmitSpecialLLVMGlobal(), llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
void AsmPrinter::EmitConstantPool | ( | MachineConstantPool * | MCP | ) | [protected] |
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.
Definition at line 109 of file AsmPrinter.cpp.
References CommentString, ConstantPoolSection, CP, EmitAlignment(), EmitGlobalConstant(), EmitZeros(), llvm::MachineConstantPool::getConstantPoolAlignment(), llvm::MachineConstantPool::getConstants(), getFunctionNumber(), llvm::TargetMachine::getTargetData(), llvm::Value::getType(), llvm::TargetData::getTypeSize(), O, Offset, PrivateGlobalPrefix, SwitchSection(), TD, TM, Val, and llvm::WriteTypeSymbolic().
Referenced by llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
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 225 of file AsmPrinter.cpp.
References llvm::Instruction::Cast, FunctionAddrPrefix, FunctionAddrSuffix, llvm::TargetData::getIndexedOffset(), llvm::TargetMachine::getTargetData(), llvm::TargetData::getTypeSize(), llvm::Mangler::getValueName(), GlobalVarAddrPrefix, GlobalVarAddrSuffix, GV, llvm::Type::IntTy, llvm::Constant::isNullValue(), llvm::Type::LongTy, Mang, O, Offset, Op, TD, TM, llvm::ConstantBool::True, Ty, 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 348 of file AsmPrinter.cpp.
References AsciiDirective, AscizDirective, llvm::Type::BoolTyID, CommentString, CP, Data16bitsDirective, Data32bitsDirective, Data64bitsDirective, Data8bitsDirective, llvm::DoubleToBits(), llvm::Type::DoubleTy, llvm::Type::DoubleTyID, E, EmitConstantValueOnly(), EmitZeros(), llvm::FloatToBits(), llvm::Type::FloatTyID, llvm::PackedType::getNumElements(), llvm::Constant::getOperand(), llvm::TargetData::getPointerSize(), llvm::TargetData::getStructLayout(), llvm::TargetMachine::getTargetData(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::TargetData::getTypeSize(), I, 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, TD, TM, llvm::Type::UByteTyID, llvm::Type::UIntTyID, llvm::Type::ULongTy, llvm::Type::ULongTyID, llvm::Type::UShortTyID, and Val.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), and EmitConstantPool().
bool AsmPrinter::EmitSpecialLLVMGlobal | ( | const GlobalVariable * | GV | ) | [protected] |
EmitSpecialLLVMGlobal - Check to see if the specified global is a special global used by LLVM. If so, emit it and return true, otherwise do nothing and return false.
Definition at line 133 of file AsmPrinter.cpp.
References EmitAlignment(), llvm::Value::getName(), llvm::GlobalValue::getSection(), GV, llvm::GlobalValue::hasAppendingLinkage(), StaticCtorsSection, StaticDtorsSection, SwitchSection(), and llvm::Value::use_empty().
Referenced by llvm::X86SharedAsmPrinter::doFinalization().
void AsmPrinter::EmitZeros | ( | uint64_t | NumZeros | ) | const [protected] |
EmitZeros - Emit a block of zeros.
Definition at line 212 of file AsmPrinter.cpp.
References Data8bitsDirective, O, and ZeroDirective.
Referenced by EmitConstantPool(), and EmitGlobalConstant().
unsigned llvm::AsmPrinter::getFunctionNumber | ( | ) | const [inline, protected] |
getFunctionNumber - Return a unique ID for the current function.
Definition at line 220 of file AsmPrinter.h.
Referenced by EmitConstantPool(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86ATTAsmPrinter::printOperand(), llvm::X86IntelAsmPrinter::printPICLabel(), and llvm::X86ATTAsmPrinter::printPICLabel().
unsigned AsmPrinter::getPreferredAlignmentLog | ( | const GlobalVariable * | GV | ) | const |
getPreferredAlignmentLog - Return the preferred alignment of the specified global, returned in log form. This includes an explicitly requested alignment (if the global has one).
Definition at line 182 of file AsmPrinter.cpp.
References llvm::Type::DoubleTy, llvm::GlobalValue::getAlignment(), llvm::SequentialType::getElementType(), llvm::TargetMachine::getTargetData(), llvm::GlobalValue::getType(), llvm::TargetData::getTypeAlignmentShift(), llvm::TargetData::getTypeSize(), GV, llvm::Log2_32(), TM, and U.
Referenced by llvm::X86SharedAsmPrinter::doFinalization().
void llvm::AsmPrinter::IncrementFunctionNumber | ( | ) | [inline, protected] |
IncrementFunctionNumber - Increase Function Number. AsmPrinters should not normally call this, as the counter is automatically bumped by SetupMachineFunction.
Definition at line 225 of file AsmPrinter.h.
Referenced by SetupMachineFunction().
bool AsmPrinter::PrintAsmMemoryOperand | ( | const MachineInstr * | MI, | |
unsigned | OpNo, | |||
unsigned | AsmVariant, | |||
const char * | ExtraCode | |||
) | [protected, 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.
Definition at line 651 of file AsmPrinter.cpp.
Referenced by printInlineAsm().
bool AsmPrinter::PrintAsmOperand | ( | const MachineInstr * | MI, | |
unsigned | OpNo, | |||
unsigned | AsmVariant, | |||
const char * | ExtraCode | |||
) | [protected, 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.
Definition at line 645 of file AsmPrinter.cpp.
Referenced by printInlineAsm().
void AsmPrinter::printInlineAsm | ( | const MachineInstr * | MI | ) | const [protected] |
printInlineAsm - This method formats and prints the specified machine instruction that is an inline asm.
Definition at line 489 of file AsmPrinter.cpp.
References llvm::MachineInstr::dump(), Error(), llvm::MachineOperand::getImmedValue(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getSymbolName(), InlineAsmEnd, InlineAsmStart, llvm::MachineOperand::isDef(), llvm::MachineOperand::isExternalSymbol(), MI, O, PrintAsmMemoryOperand(), PrintAsmOperand(), and Val.
void AsmPrinter::SetupMachineFunction | ( | MachineFunction & | MF | ) | [protected] |
SetupMachineFunction - This should be called when a new MachineFunction is being processed from runOnMachineFunction.
Definition at line 98 of file AsmPrinter.cpp.
References CurrentFnName, llvm::MachineFunction::getFunction(), llvm::Mangler::getValueName(), IncrementFunctionNumber(), Mang, and MF.
Referenced by llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
void AsmPrinter::SwitchSection | ( | const char * | NewSection, | |
const GlobalValue * | GV | |||
) |
SwitchSection - Switch to the specified section of the executable if we are not already in it! If GV is non-null and if the global has an explicitly requested section, we switch to the section indicated for the global instead of NewSection.
If the new section is an empty string, this method forgets what the current section is, but does not emit a .section directive.
Definition at line 61 of file AsmPrinter.cpp.
References llvm::GlobalValue::getSection(), GV, llvm::GlobalValue::hasSection(), O, and SwitchToSectionDirective.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), doInitialization(), EmitConstantPool(), EmitSpecialLLVMGlobal(), llvm::DwarfWriter::EndModule(), llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
const char* llvm::AsmPrinter::AlignDirective |
AlignDirective - The directive used to emit round up to an alignment boundary.
Definition at line 124 of file AsmPrinter.h.
Referenced by llvm::DwarfWriter::EmitAlign(), and EmitAlignment().
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 130 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), llvm::X86SharedAsmPrinter::doInitialization(), and EmitAlignment().
const char* llvm::AsmPrinter::AsciiDirective |
AsciiDirective - This directive allows emission of an ascii string with the standard C escape characters embedded into it.
Definition at line 104 of file AsmPrinter.h.
Referenced by EmitGlobalConstant(), and llvm::DwarfWriter::EmitString().
const char* llvm::AsmPrinter::AscizDirective |
AscizDirective - If not null, this allows for special handling of zero terminated strings on this target. This is commonly supported as ".asciz". If a target doesn't support this, it can be set to null.
Definition at line 109 of file AsmPrinter.h.
Referenced by EmitGlobalConstant().
const char* llvm::AsmPrinter::COMMDirective |
Definition at line 161 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization().
COMMDirectiveTakesAlignment - True if COMMDirective take a third argument that specifies the alignment of the declaration.
Definition at line 165 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), and llvm::X86SharedAsmPrinter::doInitialization().
const char* llvm::AsmPrinter::CommentString |
CommentString - This indicates the comment character used by the assembler.
Definition at line 63 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), doInitialization(), EmitConstantPool(), EmitGlobalConstant(), llvm::DwarfWriter::EOL(), llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
const char* llvm::AsmPrinter::ConstantPoolSection |
ConstantPoolSection - This is the section that we SwitchToSection right before emitting the constant pool for a function.
Definition at line 141 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), and EmitConstantPool().
std::string llvm::AsmPrinter::CurrentFnName |
Cache of mangled name for current function. This is recalculated at the beginning of each call to runOnMachineFunction().
Definition at line 55 of file AsmPrinter.h.
Referenced by llvm::X86IntelAsmPrinter::runOnMachineFunction(), llvm::X86ATTAsmPrinter::runOnMachineFunction(), and SetupMachineFunction().
const char* llvm::AsmPrinter::Data16bitsDirective |
Definition at line 115 of file AsmPrinter.h.
Referenced by EmitGlobalConstant(), and llvm::DwarfWriter::EmitInt16().
const char* llvm::AsmPrinter::Data32bitsDirective |
Definition at line 116 of file AsmPrinter.h.
Referenced by llvm::DwarfWriter::EmitDifference(), EmitGlobalConstant(), llvm::DwarfWriter::EmitInt32(), and llvm::DwarfWriter::EmitReference().
const char* llvm::AsmPrinter::Data64bitsDirective |
Definition at line 117 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), llvm::DwarfWriter::EmitDifference(), EmitGlobalConstant(), llvm::DwarfWriter::EmitInt64(), and llvm::DwarfWriter::EmitReference().
const char* llvm::AsmPrinter::Data8bitsDirective |
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 114 of file AsmPrinter.h.
Referenced by EmitGlobalConstant(), llvm::DwarfWriter::EmitInt8(), llvm::DwarfWriter::EmitSLEB128Bytes(), llvm::DwarfWriter::EmitULEB128Bytes(), and EmitZeros().
const char* llvm::AsmPrinter::FunctionAddrPrefix |
FunctionAddrPrefix/Suffix - If these are nonempty, these strings will enclose any GlobalVariable that points to a function. For example, this is used by the IA64 backend to materialize function descriptors, by decorating the ".data8" object with the ( ) link-relocation operator.
Definition at line 86 of file AsmPrinter.h.
Referenced by EmitConstantValueOnly().
const char* llvm::AsmPrinter::FunctionAddrSuffix |
const char* llvm::AsmPrinter::GlobalPrefix |
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 67 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), doInitialization(), llvm::X86IntelAsmPrinter::printOp(), and llvm::X86ATTAsmPrinter::printOperand().
const char* llvm::AsmPrinter::GlobalVarAddrPrefix |
GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings will enclose any GlobalVariable (that isn't a function)
Definition at line 77 of file AsmPrinter.h.
Referenced by EmitConstantValueOnly().
const char* llvm::AsmPrinter::GlobalVarAddrSuffix |
HasDotTypeDotSizeDirective - True if the target has .type and .size directives, this is true for most ELF targets.
Definition at line 169 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), llvm::X86SharedAsmPrinter::doInitialization(), llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
const char* llvm::AsmPrinter::InlineAsmEnd |
Definition at line 92 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), and printInlineAsm().
const char* llvm::AsmPrinter::InlineAsmStart |
InlineAsmStart/End - If these are nonempty, they contain a directive to emit before and after an inline assmebly statement.
Definition at line 91 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), and printInlineAsm().
const char* llvm::AsmPrinter::LCOMMDirective |
LCOMMDirective - This is the name of a directive (if supported) that can be used to efficiently declare a local (internal) block of zero initialized data in the .bss/.data section. The syntax expected is: <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
Definition at line 159 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), and llvm::X86SharedAsmPrinter::doInitialization().
Name-mangler for global names.
Definition at line 50 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), doFinalization(), doInitialization(), EmitConstantValueOnly(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86ATTAsmPrinter::printOperand(), and SetupMachineFunction().
std::ostream& llvm::AsmPrinter::O |
Output stream on which we're printing assembly code.
Definition at line 42 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), llvm::X86IntelAsmPrinter::doInitialization(), doInitialization(), EmitAlignment(), EmitConstantPool(), EmitConstantValueOnly(), EmitGlobalConstant(), EmitZeros(), llvm::X86IntelAsmPrinter::printf128mem(), llvm::X86IntelAsmPrinter::printf32mem(), llvm::X86IntelAsmPrinter::printf64mem(), llvm::X86IntelAsmPrinter::printi128mem(), llvm::X86IntelAsmPrinter::printi16mem(), llvm::X86IntelAsmPrinter::printi32mem(), llvm::X86IntelAsmPrinter::printi64mem(), llvm::X86IntelAsmPrinter::printi8mem(), printInlineAsm(), llvm::X86ATTAsmPrinter::printMachineInstruction(), llvm::X86IntelAsmPrinter::printMemReference(), llvm::X86ATTAsmPrinter::printMemReference(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86IntelAsmPrinter::printOperand(), llvm::X86ATTAsmPrinter::printOperand(), llvm::X86IntelAsmPrinter::printPICLabel(), llvm::X86ATTAsmPrinter::printPICLabel(), llvm::X86IntelAsmPrinter::printSSECC(), llvm::X86ATTAsmPrinter::printSSECC(), llvm::X86IntelAsmPrinter::runOnMachineFunction(), llvm::X86ATTAsmPrinter::runOnMachineFunction(), and SwitchSection().
const char* llvm::AsmPrinter::PrivateGlobalPrefix |
PrivateGlobalPrefix - This prefix is used for globals like constant pool entries that are completely private to the .o file and should not have names in the .o file. This is often "." or "L".
Definition at line 72 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), EmitConstantPool(), llvm::DwarfWriter::PrintLabelName(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86ATTAsmPrinter::printOperand(), llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().
const char* llvm::AsmPrinter::StaticCtorsSection |
StaticCtorsSection - This is the directive that is emitted to switch to a section to emit the static constructor list. Defaults to "\t.section .ctors,\"aw\",@progbits".
Definition at line 146 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), and EmitSpecialLLVMGlobal().
const char* llvm::AsmPrinter::StaticDtorsSection |
StaticDtorsSection - This is the directive that is emitted to switch to a section to emit the static destructor list. Defaults to "\t.section .dtors,\"aw\",@progbits".
Definition at line 151 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), and EmitSpecialLLVMGlobal().
const char* llvm::AsmPrinter::SwitchToSectionDirective |
SwitchToSectionDirective - This is the directive used when we want to emit a global to an arbitrary section. The section name is emited after this.
Definition at line 137 of file AsmPrinter.h.
Referenced by SwitchSection().
Target machine description.
Definition at line 46 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doFinalization(), llvm::X86SharedAsmPrinter::doInitialization(), EmitConstantPool(), EmitConstantValueOnly(), EmitGlobalConstant(), getPreferredAlignmentLog(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86IntelAsmPrinter::printOperand(), and llvm::X86ATTAsmPrinter::printOperand().
const char* llvm::AsmPrinter::ZeroDirective |
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 100 of file AsmPrinter.h.
Referenced by llvm::X86SharedAsmPrinter::doInitialization(), and EmitZeros().