LLVM 22.0.0git
llvm::DebugHandlerBase Class Referenceabstract

Base class for debug information backends. More...

#include "llvm/CodeGen/DebugHandlerBase.h"

Inheritance diagram for llvm::DebugHandlerBase:
[legend]

Public Member Functions

virtual ~DebugHandlerBase () override
void beginModule (Module *M) override
void beginInstruction (const MachineInstr *MI) override
 Process beginning of an instruction.
void endInstruction () override
 Process end of an instruction.
void beginFunction (const MachineFunction *MF) override
 Gather pre-function debug information.
void endFunction (const MachineFunction *MF) override
 Gather post-function debug information.
void beginBasicBlockSection (const MachineBasicBlock &MBB) override
 Process the beginning of a new basic-block-section within a function.
void endBasicBlockSection (const MachineBasicBlock &MBB) override
 Process the end of a basic-block-section within a function.
MCSymbolgetLabelBeforeInsn (const MachineInstr *MI)
 Return Label preceding the instruction.
MCSymbolgetLabelAfterInsn (const MachineInstr *MI)
 Return Label immediately following the instruction.
const InstructionOrderinggetInstOrdering () const
Public Member Functions inherited from llvm::AsmPrinterHandler
virtual ~AsmPrinterHandler ()
 Pin vtables to this file.
virtual void endModule ()=0
 Emit all sections that should come after the content.
virtual void markFunctionEnd ()
virtual void setSymbolSize (const MCSymbol *Sym, uint64_t Size)
 For symbols that have a size designated (e.g.
virtual void beginCodeAlignment (const MachineBasicBlock &MBB)
virtual void beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr)
 Emit target-specific EH funclet machinery.
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.
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

AsmPrinterAsm = nullptr
 Target of debug info emission.
MachineModuleInfoMMI = nullptr
 Collected machine module information.
DebugLoc PrevInstLoc
 Previous instruction's location information.
MCSymbolPrevLabel = nullptr
const MachineBasicBlockPrevInstBB = nullptr
const MachineInstrPrologEndLoc
 This location indicates end of function prologue and beginning of function body.
const MachineBasicBlockEpilogBeginBlock = nullptr
 This block includes epilogue instructions.
const MachineInstrCurMI = 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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ DebugHandlerBase()

DebugHandlerBase::DebugHandlerBase ( AsmPrinter * A)
protected

◆ ~DebugHandlerBase()

DebugHandlerBase::~DebugHandlerBase ( )
overridevirtualdefault

References MBB, and MI.

Member Function Documentation

◆ beginBasicBlockSection()

void DebugHandlerBase::beginBasicBlockSection ( const MachineBasicBlock & MBB)
overridevirtual

Process the beginning of a new basic-block-section within a function.

Always called immediately after beginFunction for the first basic-block. When basic-block-sections are enabled, called before the first block of each such section.

Reimplemented from llvm::AsmPrinterHandler.

Definition at line 431 of file DebugHandlerBase.cpp.

References EpilogBeginBlock, MBB, and PrevLabel.

◆ beginFunction()

◆ beginFunctionImpl()

virtual void llvm::DebugHandlerBase::beginFunctionImpl ( const MachineFunction * MF)
protectedpure virtual

◆ beginInstruction()

void DebugHandlerBase::beginInstruction ( const MachineInstr * MI)
overridevirtual

Process beginning of an instruction.

Reimplemented from llvm::AsmPrinterHandler.

Reimplemented in llvm::DwarfDebug.

Definition at line 360 of file DebugHandlerBase.cpp.

References Asm, assert(), CurMI, I, LabelsBeforeInsn, MI, MMI, and PrevLabel.

Referenced by llvm::BTFDebug::beginInstruction(), llvm::CodeViewDebug::beginInstruction(), and llvm::DwarfDebug::beginInstruction().

◆ beginModule()

void DebugHandlerBase::beginModule ( Module * M)
overridevirtual

Reimplemented from llvm::AsmPrinterHandler.

Reimplemented in llvm::DwarfDebug.

Definition at line 105 of file DebugHandlerBase.cpp.

References Asm.

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

◆ endBasicBlockSection()

void DebugHandlerBase::endBasicBlockSection ( const MachineBasicBlock & MBB)
overridevirtual

Process the end of a basic-block-section within a function.

When basic-block-sections are enabled, called after the last block in each such section (including the last section in the function). When basic-block-sections are disabled, called at the end of a function, immediately prior to markFunctionEnd.

Reimplemented from llvm::AsmPrinterHandler.

Definition at line 437 of file DebugHandlerBase.cpp.

References MBB, and PrevLabel.

◆ endFunction()

void DebugHandlerBase::endFunction ( const MachineFunction * MF)
overridevirtual

Gather post-function debug information.

Implements llvm::AsmPrinterHandler.

Definition at line 421 of file DebugHandlerBase.cpp.

References Asm, DbgLabels, DbgValues, endFunctionImpl(), hasDebugInfo(), LabelsAfterInsn, and LabelsBeforeInsn.

◆ endFunctionImpl()

virtual void llvm::DebugHandlerBase::endFunctionImpl ( const MachineFunction * MF)
protectedpure virtual

Implemented in llvm::BTFDebug, llvm::CodeViewDebug, and llvm::DwarfDebug.

Referenced by endFunction().

◆ endInstruction()

void DebugHandlerBase::endInstruction ( )
overridevirtual

Process end of an instruction.

Reimplemented from llvm::AsmPrinterHandler.

Definition at line 386 of file DebugHandlerBase.cpp.

References Asm, assert(), CurMI, I, LabelsAfterInsn, MMI, PrevInstBB, and PrevLabel.

◆ getBaseTypeSize()

uint64_t DebugHandlerBase::getBaseTypeSize ( const DIType * Ty)
static

If this type is derived from a base type then return base type size.

Definition at line 149 of file DebugHandlerBase.cpp.

References assert(), llvm::dyn_cast(), getBaseTypeSize(), and llvm::Tag.

Referenced by getBaseTypeSize().

◆ getInstOrdering()

const InstructionOrdering & llvm::DebugHandlerBase::getInstOrdering ( ) const
inline

Definition at line 146 of file DebugHandlerBase.h.

◆ getLabelAfterInsn()

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::CodeViewDebug::endFunctionImpl(), and llvm::DwarfDebug::isLexicalScopeDIENull().

◆ getLabelBeforeInsn()

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::CodeViewDebug::endFunctionImpl().

◆ identifyScopeMarkers()

◆ isUnsignedDIType()

bool DebugHandlerBase::isUnsignedDIType ( const DIType * Ty)
static

Return true if type encoding is unsigned.

Definition at line 180 of file DebugHandlerBase.cpp.

References assert(), llvm::cast(), llvm::dyn_cast(), llvm::isa(), isUnsignedDIType(), and T.

Referenced by isUnsignedDIType().

◆ requestLabelAfterInsn()

void llvm::DebugHandlerBase::requestLabelAfterInsn ( const MachineInstr * MI)
inlineprotected

Ensure that a label will be emitted after MI.

Definition at line 108 of file DebugHandlerBase.h.

References LabelsAfterInsn, and MI.

Referenced by beginFunction(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and identifyScopeMarkers().

◆ requestLabelBeforeInsn()

void llvm::DebugHandlerBase::requestLabelBeforeInsn ( const MachineInstr * MI)
inlineprotected

Ensure that a label will be emitted before MI.

Definition at line 103 of file DebugHandlerBase.h.

References LabelsBeforeInsn, and MI.

Referenced by beginFunction(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::DwarfDebug::beginInstruction(), and identifyScopeMarkers().

◆ skippedNonDebugFunction()

virtual void llvm::DebugHandlerBase::skippedNonDebugFunction ( )
inlineprotectedvirtual

Reimplemented in llvm::DwarfDebug.

Definition at line 114 of file DebugHandlerBase.h.

Referenced by beginFunction().

Member Data Documentation

◆ Asm

◆ CurMI

const MachineInstr* llvm::DebugHandlerBase::CurMI = nullptr
protected

If nonnull, stores the current machine instruction we're processing.

Definition at line 79 of file DebugHandlerBase.h.

Referenced by llvm::BTFDebug::beginInstruction(), beginInstruction(), llvm::DwarfDebug::beginInstruction(), endInstruction(), and llvm::DwarfDebug::endModule().

◆ DbgLabels

DbgLabelInstrMap llvm::DebugHandlerBase::DbgLabels
protected

Mapping of inlined labels and DBG_LABEL machine instruction.

Definition at line 88 of file DebugHandlerBase.h.

Referenced by beginFunction(), and endFunction().

◆ DbgValues

DbgValueHistoryMap llvm::DebugHandlerBase::DbgValues
protected

History of DBG_VALUE and clobber instructions for each user variable.

Variables are listed in order of appearance.

Definition at line 85 of file DebugHandlerBase.h.

Referenced by beginFunction(), and endFunction().

◆ EpilogBeginBlock

const MachineBasicBlock* llvm::DebugHandlerBase::EpilogBeginBlock = nullptr
protected

This block includes epilogue instructions.

Definition at line 76 of file DebugHandlerBase.h.

Referenced by beginBasicBlockSection(), and llvm::DwarfDebug::beginInstruction().

◆ LabelsAfterInsn

DenseMap<const MachineInstr *, MCSymbol *> llvm::DebugHandlerBase::LabelsAfterInsn
protected

Maps instruction with label emitted after instruction.

Definition at line 96 of file DebugHandlerBase.h.

Referenced by endFunction(), endInstruction(), getLabelAfterInsn(), and requestLabelAfterInsn().

◆ LabelsBeforeInsn

DenseMap<const MachineInstr *, MCSymbol *> llvm::DebugHandlerBase::LabelsBeforeInsn
protected

Maps instruction with label emitted before instruction.

FIXME: Make this private from DwarfDebug, we have the necessary accessors for it.

Definition at line 93 of file DebugHandlerBase.h.

Referenced by beginFunction(), beginInstruction(), endFunction(), getLabelBeforeInsn(), and requestLabelBeforeInsn().

◆ LScopes

◆ MMI

◆ PrevInstBB

const MachineBasicBlock* llvm::DebugHandlerBase::PrevInstBB = nullptr
protected

◆ PrevInstLoc

DebugLoc llvm::DebugHandlerBase::PrevInstLoc
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 beginFunction(), llvm::BTFDebug::beginInstruction(), and llvm::DwarfDebug::beginInstruction().

◆ PrevLabel

◆ PrologEndLoc

const MachineInstr* llvm::DebugHandlerBase::PrologEndLoc
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().


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