LLVM
13.0.0git
|
Base class for debug information backends. More...
#include "llvm/CodeGen/DebugHandlerBase.h"
Public Member Functions | |
void | beginModule (Module *M) override |
void | beginInstruction (const MachineInstr *MI) override |
Process beginning of an instruction. More... | |
void | endInstruction () override |
Process end of an instruction. More... | |
void | beginFunction (const MachineFunction *MF) override |
Gather pre-function debug information. More... | |
void | endFunction (const MachineFunction *MF) override |
Gather post-function debug information. More... | |
void | beginBasicBlock (const MachineBasicBlock &MBB) override |
Process beginning of a basic block during basic block sections. More... | |
void | endBasicBlock (const MachineBasicBlock &MBB) override |
Process end of a basic block during basic block sections. More... | |
MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
Return Label preceding the instruction. More... | |
MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
Return Label immediately following the instruction. More... | |
const InstructionOrdering & | getInstOrdering () const |
![]() | |
virtual | ~AsmPrinterHandler () |
Pin vtable to this file. More... | |
virtual void | setSymbolSize (const MCSymbol *Sym, uint64_t Size)=0 |
For symbols that have a size designated (e.g. More... | |
virtual void | endModule ()=0 |
Emit all sections that should come after the content. More... | |
virtual void | markFunctionEnd () |
virtual void | beginFragment (const MachineBasicBlock *MBB, ExceptionSymbolProvider ESP) |
virtual void | endFragment () |
virtual void | beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr) |
Emit target-specific EH funclet machinery. More... | |
virtual void | endFunclet () |
Static Public Member Functions | |
static uint64_t | getBaseTypeSize (const DIType *Ty) |
If this type is derived from a base type then return base type size. More... | |
static bool | isUnsignedDIType (const DIType *Ty) |
Return true if type encoding is unsigned. More... | |
Protected Member Functions | |
DebugHandlerBase (AsmPrinter *A) | |
void | identifyScopeMarkers () |
Indentify instructions that are marking the beginning of or ending of a scope. More... | |
void | requestLabelBeforeInsn (const MachineInstr *MI) |
Ensure that a label will be emitted before MI. More... | |
void | requestLabelAfterInsn (const MachineInstr *MI) |
Ensure that a label will be emitted after MI. More... | |
virtual void | beginFunctionImpl (const MachineFunction *MF)=0 |
virtual void | endFunctionImpl (const MachineFunction *MF)=0 |
virtual void | skippedNonDebugFunction () |
Protected Attributes | |
AsmPrinter * | Asm |
Target of debug info emission. More... | |
MachineModuleInfo * | MMI |
Collected machine module information. More... | |
DebugLoc | PrevInstLoc |
Previous instruction's location information. More... | |
MCSymbol * | PrevLabel = nullptr |
const MachineBasicBlock * | PrevInstBB = nullptr |
DebugLoc | PrologEndLoc |
This location indicates end of function prologue and beginning of function body. More... | |
const MachineInstr * | CurMI = nullptr |
If nonnull, stores the current machine instruction we're processing. More... | |
LexicalScopes | LScopes |
DbgValueHistoryMap | DbgValues |
History of DBG_VALUE and clobber instructions for each user variable. More... | |
DbgLabelInstrMap | DbgLabels |
Mapping of inlined labels and DBG_LABEL machine instruction. More... | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsBeforeInsn |
Maps instruction with label emitted before instruction. More... | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsAfterInsn |
Maps instruction with label emitted after instruction. More... | |
Base class for debug information backends.
Common functionality related to tracking which variables and scopes are alive at a given PC live here.
Definition at line 53 of file DebugHandlerBase.h.
|
protected |
Definition at line 92 of file DebugHandlerBase.cpp.
|
overridevirtual |
Process beginning of a basic block during basic block sections.
Reimplemented from llvm::AsmPrinterHandler.
Definition at line 399 of file DebugHandlerBase.cpp.
References llvm::MachineBasicBlock::getSymbol(), llvm::MachineBasicBlock::isBeginSection(), MBB, and PrevLabel.
|
overridevirtual |
Gather pre-function debug information.
Every beginFunction(MF) call should be followed by an endFunction(MF) call.
Implements llvm::AsmPrinterHandler.
Definition at line 228 of file DebugHandlerBase.cpp.
References Asm, assert(), beginFunctionImpl(), llvm::calculateDbgEntityHistory(), DbgLabels, DbgValues, llvm::DbgValueHistoryMap::dump(), llvm::DbgValueHistoryMap::empty(), llvm::DbgLabelInstrMap::empty(), llvm::LexicalScopes::empty(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), hasDebugInfo(), I, identifyScopeMarkers(), llvm::InstructionOrdering::initialize(), llvm::LexicalScopes::initialize(), LLVM_DEBUG, LScopes, llvm::AsmPrinter::MF, MMI, PrevInstBB, skippedNonDebugFunction(), llvm::DbgValueHistoryMap::trimLocationRanges(), and TrimVarLocs.
|
protectedpure virtual |
Implemented in llvm::DwarfDebug, llvm::CodeViewDebug, and llvm::BTFDebug.
Referenced by beginFunction().
|
overridevirtual |
Process beginning of an instruction.
Implements llvm::AsmPrinterHandler.
Reimplemented in llvm::DwarfDebug, llvm::CodeViewDebug, and llvm::BTFDebug.
Definition at line 331 of file DebugHandlerBase.cpp.
References Asm, assert(), llvm::MCContext::createTempSymbol(), CurMI, llvm::MachineModuleInfo::getContext(), llvm::MachineModuleInfo::hasDebugInfo(), I, LabelsBeforeInsn, MI, MMI, llvm::AsmPrinter::OutStreamer, and PrevLabel.
Referenced by llvm::BTFDebug::beginInstruction(), llvm::CodeViewDebug::beginInstruction(), and llvm::DwarfDebug::beginInstruction().
|
overridevirtual |
Reimplemented from llvm::AsmPrinterHandler.
Reimplemented in llvm::DwarfDebug, and llvm::CodeViewDebug.
Definition at line 94 of file DebugHandlerBase.cpp.
Referenced by llvm::DwarfDebug::beginModule().
|
overridevirtual |
Process end of a basic block during basic block sections.
Reimplemented from llvm::AsmPrinterHandler.
Definition at line 406 of file DebugHandlerBase.cpp.
References llvm::MachineBasicBlock::isEndSection(), MBB, and PrevLabel.
|
overridevirtual |
Gather post-function debug information.
Please note that some AsmPrinter implementations may not call beginFunction at all.
Implements llvm::AsmPrinterHandler.
Definition at line 389 of file DebugHandlerBase.cpp.
References Asm, llvm::InstructionOrdering::clear(), llvm::DbgValueHistoryMap::clear(), llvm::DbgLabelInstrMap::clear(), DbgLabels, DbgValues, endFunctionImpl(), hasDebugInfo(), LabelsAfterInsn, LabelsBeforeInsn, and MMI.
|
protectedpure virtual |
Implemented in llvm::DwarfDebug, llvm::BTFDebug, and llvm::CodeViewDebug.
Referenced by endFunction().
|
overridevirtual |
Process end of an instruction.
Implements llvm::AsmPrinterHandler.
Definition at line 357 of file DebugHandlerBase.cpp.
References Asm, assert(), llvm::MCContext::createTempSymbol(), CurMI, llvm::MachineModuleInfo::getContext(), llvm::MachineInstr::getParent(), llvm::MachineModuleInfo::hasDebugInfo(), I, llvm::MachineInstr::isMetaInstruction(), LabelsAfterInsn, MMI, llvm::AsmPrinter::OutStreamer, PrevInstBB, and PrevLabel.
If this type is derived from a base type then return base type size.
Definition at line 138 of file DebugHandlerBase.cpp.
References assert(), llvm::DIType::getSizeInBits(), and llvm::DINode::getTag().
|
inline |
Definition at line 141 of file DebugHandlerBase.h.
MCSymbol * DebugHandlerBase::getLabelAfterInsn | ( | const MachineInstr * | MI | ) |
Return Label immediately following the instruction.
Definition at line 133 of file DebugHandlerBase.cpp.
References LabelsAfterInsn, and MI.
Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), llvm::CodeViewDebug::endFunctionImpl(), and llvm::DwarfDebug::isLexicalScopeDIENull().
MCSymbol * DebugHandlerBase::getLabelBeforeInsn | ( | const MachineInstr * | MI | ) |
Return Label preceding the instruction.
Definition at line 126 of file DebugHandlerBase.cpp.
References assert(), LabelsBeforeInsn, and MI.
Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), and llvm::CodeViewDebug::endFunctionImpl().
|
protected |
Indentify instructions that are marking the beginning of or ending of a scope.
Definition at line 103 of file DebugHandlerBase.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::LexicalScopes::getCurrentFunctionScope(), LScopes, llvm::SmallVectorImpl< T >::pop_back_val(), requestLabelAfterInsn(), requestLabelBeforeInsn(), and S.
Referenced by beginFunction().
Return true if type encoding is unsigned.
Definition at line 166 of file DebugHandlerBase.cpp.
References assert(), llvm::DIType::getName(), llvm::DINode::getTag(), and T.
Referenced by llvm::DwarfUnit::addConstantValue(), and llvm::DwarfUnit::constructTypeDIE().
|
inlineprotected |
Ensure that a label will be emitted after MI.
Definition at line 105 of file DebugHandlerBase.h.
References LabelsAfterInsn, and MI.
Referenced by llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and identifyScopeMarkers().
|
inlineprotected |
Ensure that a label will be emitted before MI.
Definition at line 100 of file DebugHandlerBase.h.
References LabelsBeforeInsn, and MI.
Referenced by llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and identifyScopeMarkers().
|
inlineprotectedvirtual |
Reimplemented in llvm::DwarfDebug.
Definition at line 111 of file DebugHandlerBase.h.
Referenced by beginFunction().
|
protected |
Target of debug info emission.
Definition at line 58 of file DebugHandlerBase.h.
Referenced by llvm::DwarfDebug::addDwarfTypeUnitType(), beginFunction(), llvm::BTFDebug::beginFunctionImpl(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginFunctionImpl(), beginInstruction(), llvm::BTFDebug::beginInstruction(), llvm::CodeViewDebug::beginInstruction(), llvm::DwarfDebug::beginInstruction(), beginModule(), llvm::CodeViewDebug::beginModule(), llvm::DwarfDebug::beginModule(), llvm::DwarfDebug::DwarfDebug(), llvm::DwarfDebug::emitInitialLocDirective(), endFunction(), llvm::CodeViewDebug::endFunctionImpl(), llvm::DwarfDebug::endFunctionImpl(), endInstruction(), llvm::CodeViewDebug::endModule(), llvm::DwarfDebug::endModule(), llvm::DwarfDebug::getDwarfSectionOffsetForm(), and llvm::DwarfDebug::getDwarfVersion().
|
protected |
If nonnull, stores the current machine instruction we're processing.
Definition at line 76 of file DebugHandlerBase.h.
Referenced by beginInstruction(), llvm::BTFDebug::beginInstruction(), llvm::DwarfDebug::beginInstruction(), endInstruction(), and llvm::DwarfDebug::endModule().
|
protected |
Mapping of inlined labels and DBG_LABEL machine instruction.
Definition at line 85 of file DebugHandlerBase.h.
Referenced by beginFunction(), and endFunction().
|
protected |
History of DBG_VALUE and clobber instructions for each user variable.
Variables are listed in order of appearance.
Definition at line 82 of file DebugHandlerBase.h.
Referenced by beginFunction(), and endFunction().
|
protected |
Maps instruction with label emitted after instruction.
Definition at line 93 of file DebugHandlerBase.h.
Referenced by endFunction(), endInstruction(), getLabelAfterInsn(), and requestLabelAfterInsn().
|
protected |
Maps instruction with label emitted before instruction.
FIXME: Make this private from DwarfDebug, we have the necessary accessors for it.
Definition at line 90 of file DebugHandlerBase.h.
Referenced by beginInstruction(), endFunction(), getLabelBeforeInsn(), and requestLabelBeforeInsn().
|
protected |
Definition at line 78 of file DebugHandlerBase.h.
Referenced by beginFunction(), llvm::DwarfDebug::beginFunctionImpl(), llvm::CodeViewDebug::endFunctionImpl(), llvm::DwarfDebug::endFunctionImpl(), and identifyScopeMarkers().
|
protected |
Collected machine module information.
Definition at line 61 of file DebugHandlerBase.h.
Referenced by beginFunction(), beginInstruction(), llvm::CodeViewDebug::beginModule(), llvm::DwarfDebug::beginModule(), llvm::DwarfDebug::DwarfDebug(), endFunction(), endInstruction(), llvm::CodeViewDebug::endModule(), and llvm::DwarfDebug::endModule().
|
protected |
Definition at line 69 of file DebugHandlerBase.h.
Referenced by beginFunction(), llvm::CodeViewDebug::beginInstruction(), llvm::DwarfDebug::beginInstruction(), and endInstruction().
|
protected |
Previous instruction's location information.
This is used to determine label location to indicate scope boundaries in debug info. We track the previous instruction's source location (if not line 0), whether it was a label, and its parent BB.
Definition at line 67 of file DebugHandlerBase.h.
Referenced by llvm::BTFDebug::beginInstruction(), and llvm::DwarfDebug::beginInstruction().
|
protected |
Definition at line 68 of file DebugHandlerBase.h.
Referenced by beginBasicBlock(), beginInstruction(), llvm::DwarfDebug::beginInstruction(), endBasicBlock(), llvm::DwarfDebug::endFunctionImpl(), and endInstruction().
|
protected |
This location indicates end of function prologue and beginning of function body.
Definition at line 73 of file DebugHandlerBase.h.
Referenced by llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and llvm::DwarfDebug::emitInitialLocDirective().