LLVM: lib/CodeGen/AsmPrinter/AsmPrinter.cpp File Reference (original) (raw)
Go to the source code of this file.
Functions | |
---|---|
STATISTIC (EmittedInsts, "Number of machine instrs printed") | |
static bool | canBeHidden (const GlobalValue *GV, const MCAsmInfo &MAI) |
static void | emitComments (const MachineInstr &MI, const MCSubtargetInfo *STI, raw_ostream &CommentOS) |
emitComments - Pretty-print comments for instructions. | |
static void | emitKill (const MachineInstr *MI, AsmPrinter &AP) |
static void | emitFakeUse (const MachineInstr *MI, AsmPrinter &AP) |
static bool | emitDebugValueComment (const MachineInstr *MI, AsmPrinter &AP) |
emitDebugValueComment - This method handles the target-independent form of DBG_VALUE, returning true if it was able to do so. | |
static bool | emitDebugLabelComment (const MachineInstr *MI, AsmPrinter &AP) |
This method handles the target-independent form of DBG_LABEL, returning true if it was able to do so. | |
static uint32_t | getBBAddrMapMetadata (const MachineBasicBlock &MBB) |
Returns the BB metadata to be emitted in the SHT_LLVM_BB_ADDR_MAP section for a given basic block. | |
static llvm::object::BBAddrMap::Features | getBBAddrMapFeature (const MachineFunction &MF, int NumMBBSectionRanges) |
static bool | needFuncLabels (const MachineFunction &MF, const AsmPrinter &Asm) |
Returns true if function begin and end labels should be emitted. | |
static StringRef | getMIMnemonic (const MachineInstr &MI, MCStreamer &Streamer) |
static unsigned | getNumGlobalVariableUses (const Constant *C) |
Compute the number of Global Variables that uses a Constant. | |
static bool | isGOTEquivalentCandidate (const GlobalVariable *GV, unsigned &NumGOTEquivUsers) |
Only consider global GOT equivalents if at least one user is a cstexpr inside an initializer of another global variables. | |
static void | tagGlobalDefinition (Module &M, GlobalVariable *G) |
static void | emitGlobalConstantImpl (const DataLayout &DL, const Constant *C, AsmPrinter &AP, const Constant *BaseCV=nullptr, uint64_t Offset=0, AsmPrinter::AliasMapTy *AliasList=nullptr) |
static void | emitGlobalConstantFP (const ConstantFP *CFP, AsmPrinter &AP) |
static void | emitGlobalConstantFP (APFloat APF, Type *ET, AsmPrinter &AP) |
static int | isRepeatedByteSequence (const ConstantDataSequential *V) |
isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of identical bytes and return the byte value. | |
static int | isRepeatedByteSequence (const Value *V, const DataLayout &DL) |
isRepeatedByteSequence - Determine whether the given value is composed of a repeated sequence of identical bytes and return the byte value. | |
static void | emitGlobalAliasInline (AsmPrinter &AP, uint64_t Offset, AsmPrinter::AliasMapTy *AliasList) |
static void | emitGlobalConstantDataSequential (const DataLayout &DL, const ConstantDataSequential *CDS, AsmPrinter &AP, AsmPrinter::AliasMapTy *AliasList) |
static void | emitGlobalConstantArray (const DataLayout &DL, const ConstantArray *CA, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset, AsmPrinter::AliasMapTy *AliasList) |
static void | emitGlobalConstantLargeInt (const ConstantInt *CI, AsmPrinter &AP) |
static void | emitGlobalConstantVector (const DataLayout &DL, const Constant *CV, AsmPrinter &AP, AsmPrinter::AliasMapTy *AliasList) |
static void | emitGlobalConstantStruct (const DataLayout &DL, const ConstantStruct *CS, AsmPrinter &AP, const Constant *BaseCV, uint64_t Offset, AsmPrinter::AliasMapTy *AliasList) |
static void | handleIndirectSymViaGOTPCRel (AsmPrinter &AP, const MCExpr **ME, const Constant *BaseCst, uint64_t Offset) |
Transform a not absolute MCExpr containing a reference to a GOT equivalent global, by a target specific GOT pc relative access to the final symbol. | |
static void | PrintParentLoopComment (raw_ostream &OS, const MachineLoop *Loop, unsigned FunctionNumber) |
PrintParentLoopComment - Print comments about parent loops of this one. | |
static void | PrintChildLoopComment (raw_ostream &OS, const MachineLoop *Loop, unsigned FunctionNumber) |
PrintChildLoopComment - Print comments about child loops within the loop for this basic block, with nesting. | |
static void | emitBasicBlockLoopComments (const MachineBasicBlock &MBB, const MachineLoopInfo *LI, const AsmPrinter &AP) |
emitBasicBlockLoopComments - Pretty-print comments for basic blocks. | |
Variables | |
---|---|
static cl::bits< PGOMapFeaturesEnum > | PgoAnalysisMapFeatures ("pgo-analysis-map", cl::Hidden, cl::CommaSeparated, cl::values(clEnumValN(PGOMapFeaturesEnum::None, "none", "Disable all options"), clEnumValN(PGOMapFeaturesEnum::FuncEntryCount, "func-entry-count", "Function Entry Count"), clEnumValN(PGOMapFeaturesEnum::BBFreq, "bb-freq", "Basic Block Frequency"), clEnumValN(PGOMapFeaturesEnum::BrProb, "br-prob", "Branch Probability"), clEnumValN(PGOMapFeaturesEnum::All, "all", "Enable all options")), cl::desc("Enable extended information within the SHT_LLVM_BB_ADDR_MAP that is " "extracted from PGO related analysis.")) |
static cl::opt< bool > | BBAddrMapSkipEmitBBEntries ("basic-block-address-map-skip-bb-entries", cl::desc("Skip emitting basic block entries in the SHT_LLVM_BB_ADDR_MAP " "section. It's used to save binary size when BB entries are " "unnecessary for some PGOAnalysisMap features."), cl::Hidden, cl::init(false)) |
static cl::opt< bool > | EmitJumpTableSizesSection ("emit-jump-table-sizes-section", cl::desc("Emit a section containing jump table addresses and sizes"), cl::Hidden, cl::init(false)) |
static cl::opt< bool > | PrintLatency ("asm-print-latency", cl::desc("Print instruction latencies as verbose asm comments"), cl::Hidden, cl::init(false)) |
◆ DEBUG_TYPE
#define DEBUG_TYPE "asm-printer"
◆ PGOMapFeaturesEnum
Enumerator |
---|
None |
FuncEntryCount |
BBFreq |
BrProb |
All |
Definition at line 143 of file AsmPrinter.cpp.
◆ canBeHidden()
◆ emitBasicBlockLoopComments()
emitBasicBlockLoopComments - Pretty-print comments for basic blocks.
Definition at line 4153 of file AsmPrinter.cpp.
References assert(), llvm::AsmPrinter::getFunctionNumber(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopDepth(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::BasicBlock::getNumber(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::raw_ostream::indent(), llvm::LoopBase< BlockT, LoopT >::isInnermost(), MBB, OS, llvm::AsmPrinter::OutStreamer, PrintChildLoopComment(), and PrintParentLoopComment().
Referenced by llvm::AsmPrinter::emitBasicBlockStart().
◆ emitComments()
◆ emitDebugLabelComment()
◆ emitDebugValueComment()
emitDebugValueComment - This method handles the target-independent form of DBG_VALUE, returning true if it was able to do so.
A false return means the target will need to handle MI in EmitInstruction.
Definition at line 1184 of file AsmPrinter.cpp.
References llvm::APFloat::convert(), llvm::APFloat::convertToDouble(), llvm::DIExpression::convertToNonVariadicExpression(), llvm::DIExpression::expr_ops(), llvm::StackOffset::getFixed(), llvm::TargetFrameLowering::getFrameIndexReference(), llvm::TargetSubtargetInfo::getFrameLowering(), llvm::DIExpression::getNumElements(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::APFloatBase::IEEEdouble(), ignored(), llvm::Type::isBFloatTy(), llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isHalfTy(), llvm_unreachable, llvm::AsmPrinter::MF, MI, llvm::MachineOperand::MO_CImmediate, llvm::MachineOperand::MO_FPImmediate, llvm::MachineOperand::MO_FrameIndex, llvm::MachineOperand::MO_Immediate, llvm::MachineOperand::MO_Register, llvm::MachineOperand::MO_TargetIndex, Name, llvm::Offset, llvm::dwarf::OperationEncodingString(), OS, llvm::AsmPrinter::OutStreamer, llvm::DWARFExpression::Operation::print(), llvm::printReg(), and llvm::APFloatBase::rmNearestTiesToEven.
Referenced by llvm::AsmPrinter::emitFunctionBody().
◆ emitFakeUse()
◆ emitGlobalAliasInline()
Definition at line 3562 of file AsmPrinter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::AsmPrinter::getSymbol(), llvm::Offset, and llvm::AsmPrinter::OutStreamer.
Referenced by emitGlobalConstantDataSequential(), emitGlobalConstantImpl(), and emitGlobalConstantVector().
◆ emitGlobalConstantArray()
◆ emitGlobalConstantDataSequential()
Definition at line 3574 of file AsmPrinter.cpp.
References assert(), DL, emitGlobalAliasInline(), emitGlobalConstantFP(), llvm::format(), llvm::ConstantDataSequential::getAsString(), llvm::ConstantDataSequential::getElementAsAPFloat(), llvm::ConstantDataSequential::getElementAsInteger(), llvm::ConstantDataSequential::getElementByteSize(), llvm::ConstantDataSequential::getElementType(), llvm::ConstantDataSequential::getNumElements(), llvm::Value::getType(), I, isRepeatedByteSequence(), llvm::ConstantDataSequential::isString(), llvm::AsmPrinter::isVerbose(), llvm::AsmPrinter::OutStreamer, and Size.
Referenced by emitGlobalConstantImpl().
◆ emitGlobalConstantFP() [1/2]
Definition at line 3708 of file AsmPrinter.cpp.
References assert(), llvm::APFloat::bitcastToAPInt(), DL, llvm::APInt::getBitWidth(), llvm::AsmPrinter::getDataLayout(), llvm::APInt::getNumWords(), llvm::APInt::getRawData(), llvm::DataLayout::isBigEndian(), llvm::Type::isPPC_FP128Ty(), llvm::AsmPrinter::isVerbose(), llvm::AsmPrinter::OutStreamer, llvm::Type::print(), and llvm::APFloat::toString().
◆ emitGlobalConstantFP() [2/2]
◆ emitGlobalConstantImpl()
Definition at line 3900 of file AsmPrinter.cpp.
References assert(), llvm::ConstantFoldConstant(), DL, emitGlobalAliasInline(), emitGlobalConstantArray(), emitGlobalConstantDataSequential(), emitGlobalConstantFP(), emitGlobalConstantImpl(), emitGlobalConstantLargeInt(), emitGlobalConstantStruct(), emitGlobalConstantVector(), llvm::format(), llvm::StructLayout::getElementOffset(), llvm::StructType::getNumElements(), llvm::AsmPrinter::getObjFileLowering(), llvm::TargetMachine::getTargetTriple(), llvm::Value::getType(), handleIndirectSymViaGOTPCRel(), llvm::Value::hasOneUse(), llvm::Triple::isOSBinFormatXCOFF(), llvm::AsmPrinter::isVerbose(), llvm::AsmPrinter::lowerConstant(), llvm::Offset, llvm::AsmPrinter::OutStreamer, Size, llvm::TargetLoweringObjectFile::supportIndirectSymViaGOTPCRel(), llvm::AsmPrinter::TM, and llvm::Value::user_back().
Referenced by llvm::AsmPrinter::emitGlobalConstant(), emitGlobalConstantArray(), emitGlobalConstantImpl(), emitGlobalConstantStruct(), and emitGlobalConstantVector().
◆ emitGlobalConstantLargeInt()
Definition at line 3756 of file AsmPrinter.cpp.
References llvm::alignTo(), assert(), llvm::BitWidth, DL, llvm::ConstantInt::getBitWidth(), llvm::AsmPrinter::getDataLayout(), llvm::APInt::getRawData(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSize(), llvm::ConstantInt::getValue(), llvm::APInt::lshrInPlace(), llvm::AsmPrinter::OutStreamer, and Size.
Referenced by emitGlobalConstantImpl(), and emitGlobalConstantVector().
◆ emitGlobalConstantStruct()
Definition at line 3677 of file AsmPrinter.cpp.
References assert(), DL, emitGlobalConstantImpl(), llvm::StructLayout::getElementOffset(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::StructLayout::getSizeInBytes(), llvm::ConstantStruct::getType(), I, llvm::Offset, llvm::AsmPrinter::OutStreamer, and Size.
Referenced by emitGlobalConstantImpl().
◆ emitGlobalConstantVector()
Definition at line 3639 of file AsmPrinter.cpp.
References llvm::ConstantFoldConstant(), DL, emitGlobalAliasInline(), emitGlobalConstantImpl(), emitGlobalConstantLargeInt(), llvm::IntegerType::get(), llvm::Constant::getAggregateElement(), llvm::ConstantExpr::getBitCast(), llvm::Value::getContext(), llvm::Value::getType(), I, llvm::AsmPrinter::OutStreamer, llvm::report_fatal_error(), and Size.
Referenced by emitGlobalConstantImpl().
◆ emitKill()
◆ getBBAddrMapFeature()
◆ getBBAddrMapMetadata()
Returns the BB metadata to be emitted in the SHT_LLVM_BB_ADDR_MAP section for a given basic block.
This can be used to capture more precise profile information.
Definition at line 1384 of file AsmPrinter.cpp.
References llvm::MachineBasicBlock::back(), llvm::MachineBasicBlock::empty(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getSubtarget(), llvm::MachineBasicBlock::isEHPad(), llvm::MachineBasicBlock::isReturnBlock(), llvm::HexagonInstrInfo::isTailCall(), MBB, llvm::MachineBasicBlock::rbegin(), and TII.
Referenced by llvm::AsmPrinter::emitBBAddrMapSection().
◆ getMIMnemonic()
◆ getNumGlobalVariableUses()
◆ handleIndirectSymViaGOTPCRel()
Transform a not absolute MCExpr containing a reference to a GOT equivalent global, by a target specific GOT pc relative access to the final symbol.
Definition at line 3817 of file AsmPrinter.cpp.
References llvm::MCValue::getConstant(), llvm::TargetLoweringObjectFile::getIndirectSymViaGOTPCRel(), llvm::AsmPrinter::getObjFileLowering(), llvm::User::getOperand(), llvm::MCValue::getSymA(), llvm::MCValue::getSymB(), llvm::MCSymbolRefExpr::getSymbol(), llvm::AsmPrinter::getSymbol(), llvm::AsmPrinter::GlobalGOTEquivs, llvm::MCValue::isAbsolute(), llvm::AsmPrinter::MMI, llvm::Offset, llvm::AsmPrinter::OutStreamer, and llvm::TargetLoweringObjectFile::supportGOTPCRelWithOffset().
Referenced by emitGlobalConstantImpl().
◆ isGOTEquivalentCandidate()
◆ isRepeatedByteSequence() [1/2]
◆ isRepeatedByteSequence() [2/2]
◆ needFuncLabels()
◆ PrintChildLoopComment()
◆ PrintParentLoopComment()
PrintParentLoopComment - Print comments about parent loops of this one.
Definition at line 4128 of file AsmPrinter.cpp.
References llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopDepth(), llvm::BasicBlock::getNumber(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::raw_ostream::indent(), OS, and PrintParentLoopComment().
Referenced by emitBasicBlockLoopComments(), and PrintParentLoopComment().
◆ STATISTIC()
STATISTIC | ( | EmittedInsts | , |
---|---|---|---|
"Number of machine instrs printed" | |||
) |
◆ tagGlobalDefinition()
◆ BBAddrMapSkipEmitBBEntries
cl::opt< bool > BBAddrMapSkipEmitBBEntries("basic-block-address-map-skip-bb-entries", cl::desc("Skip emitting basic block entries in the SHT_LLVM_BB_ADDR_MAP " "section. It's used to save binary size when BB entries are " "unnecessary for some PGOAnalysisMap features."), cl::Hidden, cl::init(false)) ( "basic-block-address-map-skip-bb-entries" , cl::desc("Skip emitting basic block entries in the SHT_LLVM_BB_ADDR_MAP " "section. It's used to save binary size when BB entries are " "unnecessary for some PGOAnalysisMap features.") , cl::Hidden , cl::init(false) ) | static |
---|
◆ EmitJumpTableSizesSection
cl::opt< bool > EmitJumpTableSizesSection("emit-jump-table-sizes-section", cl::desc("Emit a section containing jump table addresses and sizes"), cl::Hidden, cl::init(false)) ( "emit-jump-table-sizes-section" , cl::desc("Emit a section containing jump table addresses and sizes") , cl::Hidden , cl::init(false) ) | static |
---|
◆ PgoAnalysisMapFeatures
cl::bits< PGOMapFeaturesEnum > PgoAnalysisMapFeatures("pgo-analysis-map", cl::Hidden, cl::CommaSeparated, cl::values( clEnumValN(PGOMapFeaturesEnum::None, "none", "Disable all options"), clEnumValN(PGOMapFeaturesEnum::FuncEntryCount, "func-entry-count", "Function Entry Count"), clEnumValN(PGOMapFeaturesEnum::BBFreq, "bb-freq", "Basic Block Frequency"), clEnumValN(PGOMapFeaturesEnum::BrProb, "br-prob", "Branch Probability"), clEnumValN(PGOMapFeaturesEnum::All, "all", "Enable all options")), cl::desc( "Enable extended information within the SHT_LLVM_BB_ADDR_MAP that is " "extracted from PGO related analysis.")) ( "pgo-analysis-map" , cl::Hidden , cl::CommaSeparated , cl::values( clEnumValN(PGOMapFeaturesEnum::None, "none", "Disable all options"), clEnumValN(PGOMapFeaturesEnum::FuncEntryCount, "func-entry-count", "Function Entry Count"), clEnumValN(PGOMapFeaturesEnum::BBFreq, "bb-freq", "Basic Block Frequency"), clEnumValN(PGOMapFeaturesEnum::BrProb, "br-prob", "Branch Probability"), clEnumValN(PGOMapFeaturesEnum::All, "all", "Enable all options")) , cl::desc( "Enable extended information within the SHT_LLVM_BB_ADDR_MAP that is " "extracted from PGO related analysis.") ) | static |
---|
◆ PrintLatency
cl::opt< bool > PrintLatency("asm-print-latency", cl::desc("Print instruction latencies as verbose asm comments"), cl::Hidden, cl::init(false)) ( "asm-print-latency" , cl::desc("Print instruction latencies as verbose asm comments") , cl::Hidden , cl::init(false) ) | static |
---|