LLVM  6.0.0svn
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::DebugHandlerBase Class Referenceabstract

Base class for debug information backends. More...

#include "CodeGen/AsmPrinter/DebugHandlerBase.h"

Inheritance diagram for llvm::DebugHandlerBase:
Inheritance graph
[legend]
Collaboration diagram for llvm::DebugHandlerBase:
Collaboration graph
[legend]

Public Member Functions

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...
 
MCSymbolgetLabelBeforeInsn (const MachineInstr *MI)
 Return Label preceding the instruction. More...
 
MCSymbolgetLabelAfterInsn (const MachineInstr *MI)
 Return Label immediately following the instruction. More...
 
- Public Member Functions inherited from llvm::AsmPrinterHandler
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 int fragmentCmp (const DIExpression *P1, const DIExpression *P2)
 Determine the relative position of the fragments described by P1 and P2. More...
 
static bool fragmentsOverlap (const DIExpression *P1, const DIExpression *P2)
 Determine whether two variable fragments overlap. More...
 
static uint64_t getBaseTypeSize (const DITypeRef TyRef)
 If this type is derived from a base type then return base type size. 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

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

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 54 of file DebugHandlerBase.h.

Constructor & Destructor Documentation

◆ DebugHandlerBase()

DebugHandlerBase::DebugHandlerBase ( AsmPrinter A)
protected

Definition at line 86 of file DebugHandlerBase.cpp.

Member Function Documentation

◆ beginFunction()

void DebugHandlerBase::beginFunction ( const MachineFunction MF)
overridevirtual

◆ beginFunctionImpl()

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

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

Referenced by beginFunction().

◆ beginInstruction()

void DebugHandlerBase::beginInstruction ( const MachineInstr MI)
overridevirtual

◆ endFunction()

void DebugHandlerBase::endFunction ( const MachineFunction MF)
overridevirtual

Gather post-function debug information.

Please note that some AsmPrinter implementations may not call beginFunction at all.

Implements llvm::AsmPrinterHandler.

Definition at line 314 of file DebugHandlerBase.cpp.

References llvm::DbgValueHistoryMap::clear(), DbgValues, endFunctionImpl(), hasDebugInfo(), LabelsAfterInsn, LabelsBeforeInsn, and MMI.

◆ endFunctionImpl()

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

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

Referenced by endFunction().

◆ endInstruction()

void DebugHandlerBase::endInstruction ( )
overridevirtual

◆ fragmentCmp()

int DebugHandlerBase::fragmentCmp ( const DIExpression P1,
const DIExpression P2 
)
static

Determine the relative position of the fragments described by P1 and P2.

Returns -1 if P1 is entirely before P2, 0 if P1 and P2 overlap, 1 if P1 is entirely after P2.

Definition at line 126 of file DebugHandlerBase.cpp.

References llvm::DIExpression::getFragmentInfo(), r1(), and r2().

Referenced by fragmentsOverlap(), and llvm::DebugLocEntry::MergeValues().

◆ fragmentsOverlap()

bool DebugHandlerBase::fragmentsOverlap ( const DIExpression P1,
const DIExpression P2 
)
static

Determine whether two variable fragments overlap.

Definition at line 142 of file DebugHandlerBase.cpp.

References fragmentCmp(), and llvm::DIExpression::isFragment().

Referenced by beginFunction(), llvm::DebugLocEntry::MergeValues(), and needsReferenceType().

◆ getBaseTypeSize()

uint64_t DebugHandlerBase::getBaseTypeSize ( const DITypeRef  TyRef)
static

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

Definition at line 150 of file DebugHandlerBase.cpp.

References assert(), llvm::dyn_cast(), llvm::DIType::getSizeInBits(), llvm::DINode::getTag(), and llvm::TypedDINodeRef< T >::resolve().

Referenced by llvm::DwarfUnit::constructContainingTypeDIEs(), and shouldEmitUdt().

◆ getLabelAfterInsn()

MCSymbol * DebugHandlerBase::getLabelAfterInsn ( const MachineInstr MI)

◆ getLabelBeforeInsn()

MCSymbol * DebugHandlerBase::getLabelBeforeInsn ( const MachineInstr MI)

Return Label preceding the instruction.

Definition at line 115 of file DebugHandlerBase.cpp.

References assert(), and LabelsBeforeInsn.

Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), mapArchToCVCPUType(), llvm::DebugLocEntry::MergeValues(), and needsReferenceType().

◆ identifyScopeMarkers()

void DebugHandlerBase::identifyScopeMarkers ( )
protected

◆ requestLabelAfterInsn()

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

Ensure that a label will be emitted after MI.

Definition at line 103 of file DebugHandlerBase.h.

References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::insert().

Referenced by beginFunction(), and identifyScopeMarkers().

◆ requestLabelBeforeInsn()

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

Ensure that a label will be emitted before MI.

Definition at line 98 of file DebugHandlerBase.h.

References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::insert().

Referenced by beginFunction(), and identifyScopeMarkers().

◆ skippedNonDebugFunction()

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

Reimplemented in llvm::DwarfDebug.

Definition at line 109 of file DebugHandlerBase.h.

References MI.

Referenced by beginFunction().

Member Data Documentation

◆ Asm

AsmPrinter* llvm::DebugHandlerBase::Asm
protected

◆ CurMI

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

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

Definition at line 77 of file DebugHandlerBase.h.

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

◆ 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 83 of file DebugHandlerBase.h.

Referenced by beginFunction(), endFunction(), needsReferenceType(), and validThroughout().

◆ LabelsAfterInsn

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

Maps instruction with label emitted after instruction.

Definition at line 91 of file DebugHandlerBase.h.

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

◆ 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 88 of file DebugHandlerBase.h.

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

◆ LScopes

LexicalScopes llvm::DebugHandlerBase::LScopes
protected

◆ MMI

MachineModuleInfo* llvm::DebugHandlerBase::MMI
protected

◆ 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 68 of file DebugHandlerBase.h.

Referenced by addLocIfNotPresent(), beginFunction(), and llvm::DwarfDebug::beginInstruction().

◆ PrevLabel

MCSymbol* llvm::DebugHandlerBase::PrevLabel = nullptr
protected

◆ PrologEndLoc

DebugLoc llvm::DebugHandlerBase::PrologEndLoc
protected

This location indicates end of function prologue and beginning of function body.

Definition at line 74 of file DebugHandlerBase.h.

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


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