LLVM 20.0.0git
|
Base class for debug information backends. More...
#include "llvm/CodeGen/DebugHandlerBase.h"
Public Member Functions | |
virtual | ~DebugHandlerBase () |
virtual void | setSymbolSize (const MCSymbol *Sym, uint64_t Size) |
For symbols that have a size designated (e.g. | |
virtual void | beginModule (Module *M) |
virtual void | endModule ()=0 |
virtual void | beginInstruction (const MachineInstr *MI) |
virtual void | endInstruction () |
void | beginFunction (const MachineFunction *MF) |
void | endFunction (const MachineFunction *MF) |
void | beginBasicBlockSection (const MachineBasicBlock &MBB) |
void | endBasicBlockSection (const MachineBasicBlock &MBB) |
virtual void | beginCodeAlignment (const MachineBasicBlock &MBB) |
MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
Return Label preceding the instruction. | |
MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
Return Label immediately following the instruction. | |
const InstructionOrdering & | getInstOrdering () const |
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. | |
static bool | isUnsignedDIType (const DIType *Ty) |
Return true if type encoding is unsigned. | |
Protected Member Functions | |
DebugHandlerBase (AsmPrinter *A) | |
void | identifyScopeMarkers () |
Indentify instructions that are marking the beginning of or ending of a scope. | |
void | requestLabelBeforeInsn (const MachineInstr *MI) |
Ensure that a label will be emitted before MI. | |
void | requestLabelAfterInsn (const MachineInstr *MI) |
Ensure that a label will be emitted after MI. | |
virtual void | beginFunctionImpl (const MachineFunction *MF)=0 |
virtual void | endFunctionImpl (const MachineFunction *MF)=0 |
virtual void | skippedNonDebugFunction () |
Protected Attributes | |
AsmPrinter * | Asm = nullptr |
Target of debug info emission. | |
MachineModuleInfo * | MMI = nullptr |
Collected machine module information. | |
DebugLoc | PrevInstLoc |
Previous instruction's location information. | |
MCSymbol * | PrevLabel = nullptr |
const MachineBasicBlock * | PrevInstBB = nullptr |
DebugLoc | PrologEndLoc |
This location indicates end of function prologue and beginning of function body. | |
const MachineBasicBlock * | EpilogBeginBlock = nullptr |
This block includes epilogue instructions. | |
const MachineInstr * | CurMI = nullptr |
If nonnull, stores the current machine instruction we're processing. | |
LexicalScopes | LScopes |
DbgValueHistoryMap | DbgValues |
History of DBG_VALUE and clobber instructions for each user variable. | |
DbgLabelInstrMap | DbgLabels |
Mapping of inlined labels and DBG_LABEL machine instruction. | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsBeforeInsn |
Maps instruction with label emitted before instruction. | |
DenseMap< const MachineInstr *, MCSymbol * > | LabelsAfterInsn |
Maps instruction with label emitted after instruction. | |
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 101 of file DebugHandlerBase.cpp.
|
virtualdefault |
void DebugHandlerBase::beginBasicBlockSection | ( | const MachineBasicBlock & | MBB | ) |
Definition at line 424 of file DebugHandlerBase.cpp.
References EpilogBeginBlock, llvm::MachineBasicBlock::getSymbol(), llvm::MachineBasicBlock::isEntryBlock(), MBB, and PrevLabel.
|
inlinevirtual |
Reimplemented in llvm::DwarfDebug.
Definition at line 140 of file DebugHandlerBase.h.
void DebugHandlerBase::beginFunction | ( | const MachineFunction * | MF | ) |
Definition at line 255 of file DebugHandlerBase.cpp.
References llvm::any_of(), Asm, assert(), beginFunctionImpl(), llvm::calculateDbgEntityHistory(), DbgLabels, DbgValues, llvm::DbgValueHistoryMap::dump(), llvm::LexicalScopes::empty(), llvm::DbgValueHistoryMap::empty(), llvm::DbgLabelInstrMap::empty(), llvm::getDISubprogram(), llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionBegin(), llvm::MachineFunction::getName(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::DILocalVariable::getScope(), llvm::MachineFunction::getSubtarget(), hasDebugInfo(), I, identifyScopeMarkers(), llvm::LexicalScopes::initialize(), llvm::InstructionOrdering::initialize(), llvm::DILocalVariable::isParameter(), LabelsBeforeInsn, LLVM_DEBUG, LScopes, llvm::AsmPrinter::MF, MI, PrevInstBB, PrevInstLoc, PrevLabel, requestLabelAfterInsn(), requestLabelBeforeInsn(), skippedNonDebugFunction(), llvm::DbgValueHistoryMap::trimLocationRanges(), and TrimVarLocs.
|
protectedpure virtual |
Implemented in llvm::CodeViewDebug, llvm::DwarfDebug, and llvm::BTFDebug.
Referenced by beginFunction().
|
virtual |
Reimplemented in llvm::CodeViewDebug, llvm::DwarfDebug, and llvm::BTFDebug.
Definition at line 353 of file DebugHandlerBase.cpp.
References Asm, assert(), llvm::MCContext::createTempSymbol(), CurMI, llvm::MachineModuleInfo::getContext(), llvm::AsmPrinter::hasDebugInfo(), I, LabelsBeforeInsn, MI, MMI, llvm::AsmPrinter::OutStreamer, and PrevLabel.
Referenced by llvm::CodeViewDebug::beginInstruction(), llvm::DwarfDebug::beginInstruction(), and llvm::BTFDebug::beginInstruction().
|
virtual |
Reimplemented in llvm::CodeViewDebug, and llvm::DwarfDebug.
Definition at line 105 of file DebugHandlerBase.cpp.
References Asm.
Referenced by llvm::DwarfDebug::beginModule().
void DebugHandlerBase::endBasicBlockSection | ( | const MachineBasicBlock & | MBB | ) |
Definition at line 430 of file DebugHandlerBase.cpp.
References PrevLabel.
void DebugHandlerBase::endFunction | ( | const MachineFunction * | MF | ) |
Definition at line 414 of file DebugHandlerBase.cpp.
References Asm, llvm::InstructionOrdering::clear(), llvm::DbgValueHistoryMap::clear(), llvm::DbgLabelInstrMap::clear(), DbgLabels, DbgValues, endFunctionImpl(), hasDebugInfo(), LabelsAfterInsn, and LabelsBeforeInsn.
|
protectedpure virtual |
Implemented in llvm::CodeViewDebug, llvm::DwarfDebug, and llvm::BTFDebug.
Referenced by endFunction().
|
virtual |
Definition at line 379 of file DebugHandlerBase.cpp.
References Asm, assert(), llvm::MCContext::createTempSymbol(), CurMI, llvm::MachineModuleInfo::getContext(), llvm::MachineBasicBlock::getEndSymbol(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::MachineInstr::getParent(), llvm::AsmPrinter::hasDebugInfo(), I, llvm::MachineBasicBlock::isEndSection(), llvm::MachineInstr::isMetaInstruction(), LabelsAfterInsn, MMI, llvm::AsmPrinter::OutStreamer, PrevInstBB, and PrevLabel.
|
pure virtual |
Implemented in llvm::CodeViewDebug, llvm::DwarfDebug, and llvm::BTFDebug.
If this type is derived from a base type then return base type size.
Definition at line 149 of file DebugHandlerBase.cpp.
References assert(), getBaseTypeSize(), llvm::DIType::getSizeInBits(), and llvm::DINode::getTag().
Referenced by getBaseTypeSize().
|
inline |
Definition at line 154 of file DebugHandlerBase.h.
MCSymbol * DebugHandlerBase::getLabelAfterInsn | ( | const MachineInstr * | MI | ) |
Return Label immediately following the instruction.
Definition at line 144 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 137 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 114 of file DebugHandlerBase.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::SmallVectorBase< Size_T >::empty(), llvm::LexicalScope::getChildren(), llvm::LexicalScopes::getCurrentFunctionScope(), llvm::LexicalScope::getRanges(), llvm::LexicalScope::isAbstractScope(), LScopes, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), requestLabelAfterInsn(), and requestLabelBeforeInsn().
Referenced by beginFunction().
Return true if type encoding is unsigned.
Definition at line 179 of file DebugHandlerBase.cpp.
References assert(), llvm::DIType::getName(), llvm::DINode::getTag(), and isUnsignedDIType().
Referenced by llvm::DwarfUnit::addConstantValue(), llvm::DwarfUnit::constructTypeDIE(), and isUnsignedDIType().
|
inlineprotected |
Ensure that a label will be emitted after MI.
Definition at line 112 of file DebugHandlerBase.h.
References LabelsAfterInsn, and MI.
Referenced by beginFunction(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and identifyScopeMarkers().
|
inlineprotected |
Ensure that a label will be emitted before MI.
Definition at line 107 of file DebugHandlerBase.h.
References LabelsBeforeInsn, and MI.
Referenced by beginFunction(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and identifyScopeMarkers().
|
inlinevirtual |
For symbols that have a size designated (e.g.
common symbols), this tracks that size. Only used by DWARF.
Reimplemented in llvm::DwarfDebug.
Definition at line 126 of file DebugHandlerBase.h.
|
inlineprotectedvirtual |
Reimplemented in llvm::DwarfDebug.
Definition at line 118 of file DebugHandlerBase.h.
Referenced by beginFunction().
|
protected |
Target of debug info emission.
Definition at line 62 of file DebugHandlerBase.h.
Referenced by llvm::DwarfDebug::addDwarfTypeUnitType(), llvm::DwarfDebug::beginCodeAlignment(), beginFunction(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginFunctionImpl(), llvm::BTFDebug::beginFunctionImpl(), beginInstruction(), llvm::CodeViewDebug::beginInstruction(), llvm::DwarfDebug::beginInstruction(), llvm::BTFDebug::beginInstruction(), beginModule(), llvm::CodeViewDebug::beginModule(), llvm::DwarfDebug::beginModule(), llvm::DwarfDebug::DwarfDebug(), llvm::DwarfDebug::emitDebugLocEntry(), llvm::DwarfDebug::emitDebugLocEntryLocation(), llvm::DwarfDebug::emitInitialLocDirective(), endFunction(), llvm::CodeViewDebug::endFunctionImpl(), llvm::DwarfDebug::endFunctionImpl(), endInstruction(), llvm::CodeViewDebug::endModule(), llvm::DwarfDebug::endModule(), llvm::DwarfDebug::getDwarfCompileUnitIDForLineTable(), llvm::DwarfDebug::getDwarfSectionOffsetForm(), llvm::DwarfDebug::getDwarfVersion(), and llvm::DwarfDebug::terminateLineTable().
|
protected |
If nonnull, stores the current machine instruction we're processing.
Definition at line 83 of file DebugHandlerBase.h.
Referenced by beginInstruction(), llvm::DwarfDebug::beginInstruction(), llvm::BTFDebug::beginInstruction(), endInstruction(), and llvm::DwarfDebug::endModule().
|
protected |
Mapping of inlined labels and DBG_LABEL machine instruction.
Definition at line 92 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 89 of file DebugHandlerBase.h.
Referenced by beginFunction(), and endFunction().
|
protected |
This block includes epilogue instructions.
Definition at line 80 of file DebugHandlerBase.h.
Referenced by beginBasicBlockSection(), and llvm::DwarfDebug::beginInstruction().
|
protected |
Maps instruction with label emitted after instruction.
Definition at line 100 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 97 of file DebugHandlerBase.h.
Referenced by beginFunction(), beginInstruction(), endFunction(), getLabelBeforeInsn(), and requestLabelBeforeInsn().
|
protected |
Definition at line 85 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 65 of file DebugHandlerBase.h.
Referenced by llvm::CodeViewDebug::beginFunctionImpl(), beginInstruction(), llvm::DwarfDebug::DwarfDebug(), llvm::CodeViewDebug::endFunctionImpl(), and endInstruction().
|
protected |
Definition at line 73 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 71 of file DebugHandlerBase.h.
Referenced by beginFunction(), llvm::DwarfDebug::beginInstruction(), and llvm::BTFDebug::beginInstruction().
|
protected |
Definition at line 72 of file DebugHandlerBase.h.
Referenced by beginBasicBlockSection(), beginFunction(), beginInstruction(), llvm::DwarfDebug::beginInstruction(), endBasicBlockSection(), llvm::DwarfDebug::endFunctionImpl(), and endInstruction().
|
protected |
This location indicates end of function prologue and beginning of function body.
Definition at line 77 of file DebugHandlerBase.h.
Referenced by llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and llvm::DwarfDebug::emitInitialLocDirective().