LLVM 22.0.0git
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
llvm::DbgRecord Class Reference

Base class for non-instruction debug metadata records that have positions within IR. More...

#include "llvm/IR/DebugProgramInstruction.h"

Inheritance diagram for llvm::DbgRecord:
[legend]

Public Types

enum  Kind : uint8_t { ValueKind , LabelKind }
 Subclass discriminator. More...
 
using self_iterator = simple_ilist< DbgRecord >::iterator
 
using const_self_iterator = simple_ilist< DbgRecord >::const_iterator
 

Public Member Functions

 DbgRecord (Kind RecordKind, DebugLoc DL)
 
LLVM_ABI bool isEquivalentTo (const DbgRecord &R) const
 Same as isIdenticalToWhenDefined but checks DebugLoc too.
 
Kind getRecordKind () const
 
void setMarker (DbgMarker *M)
 
DbgMarkergetMarker ()
 
const DbgMarkergetMarker () const
 
LLVM_ABI BasicBlockgetBlock ()
 
LLVM_ABI const BasicBlockgetBlock () const
 
LLVM_ABI FunctiongetFunction ()
 
LLVM_ABI const FunctiongetFunction () const
 
LLVM_ABI ModulegetModule ()
 
LLVM_ABI const ModulegetModule () const
 
LLVM_ABI LLVMContextgetContext ()
 
LLVM_ABI const LLVMContextgetContext () const
 
LLVM_ABI const InstructiongetInstruction () const
 
LLVM_ABI const BasicBlockgetParent () const
 
LLVM_ABI BasicBlockgetParent ()
 
LLVM_ABI void removeFromParent ()
 
LLVM_ABI void eraseFromParent ()
 
DbgRecordgetNextNode ()
 
DbgRecordgetPrevNode ()
 
LLVM_ABI void insertBefore (DbgRecord *InsertBefore)
 
LLVM_ABI void insertAfter (DbgRecord *InsertAfter)
 
LLVM_ABI void moveBefore (DbgRecord *MoveBefore)
 
LLVM_ABI void moveAfter (DbgRecord *MoveAfter)
 
LLVM_ABI void insertBefore (self_iterator InsertBefore)
 
LLVM_ABI void insertAfter (self_iterator InsertAfter)
 
LLVM_ABI void moveBefore (self_iterator MoveBefore)
 
LLVM_ABI void moveAfter (self_iterator MoveAfter)
 
DebugLoc getDebugLoc () const
 
void setDebugLoc (DebugLoc Loc)
 
LLVM_ABI void dump () const
 
LLVM_ABI void deleteRecord ()
 Methods that dispatch to subclass implementations.
 
LLVM_ABI DbgRecordclone () const
 
LLVM_ABI void print (raw_ostream &O, bool IsForDebug=false) const
 
LLVM_ABI void print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug) const
 
LLVM_ABI bool isIdenticalToWhenDefined (const DbgRecord &R) const
 
LLVM_ABI DbgInfoIntrinsiccreateDebugIntrinsic (Module *M, Instruction *InsertBefore) const
 Convert this DbgRecord back into an appropriate llvm.dbg.
 
- Public Member Functions inherited from llvm::ilist_node_impl< OptionsT >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
template<typename T = OptionsT>
std::enable_if_t< T::is_sentinel_tracking_explicit, boolisSentinel () const
 Check whether this is the sentinel node.
 
- Public Member Functions inherited from llvm::ilist_detail::node_parent_access< ilist_node_impl< OptionsT >, OptionsT::parent_ty >
const OptionsT::parent_ty * getParent () const
 
OptionsT::parent_ty * getParent ()
 
void setParent (OptionsT::parent_ty *Parent)
 

Public Attributes

DbgMarkerMarker = nullptr
 Marker that this DbgRecord is linked into.
 

Protected Member Functions

 ~DbgRecord ()=default
 Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteRecord dispatch cleanup.
 
- Protected Member Functions inherited from llvm::ilist_node_impl< OptionsT >
 ilist_node_impl ()=default
 

Protected Attributes

DebugLoc DbgLoc
 
Kind RecordKind
 Subclass discriminator.
 

Additional Inherited Members

- Protected Types inherited from llvm::ilist_node_impl< OptionsT >
using self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type
 
using const_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, true >::type
 
using reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, true, false >::type
 
using const_reverse_self_iterator = typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, true, true >::type
 

Detailed Description

Base class for non-instruction debug metadata records that have positions within IR.

Features various methods copied across from the Instruction class to aid ease-of-use. DbgRecords should always be linked into a DbgMarker's StoredDbgRecords list. The marker connects a DbgRecord back to its position in the BasicBlock.

We need a discriminator for dyn/isa casts. In order to avoid paying for a vtable for "virtual" functions too, subclasses must add a new discriminator value (RecordKind) and cases to a few functions in the base class: deleteRecord clone isIdenticalToWhenDefined both print methods createDebugIntrinsic

Definition at line 139 of file DebugProgramInstruction.h.

Member Typedef Documentation

◆ const_self_iterator

Definition at line 220 of file DebugProgramInstruction.h.

◆ self_iterator

Definition at line 219 of file DebugProgramInstruction.h.

Member Enumeration Documentation

◆ Kind

Subclass discriminator.

Enumerator
ValueKind 
LabelKind 

Definition at line 144 of file DebugProgramInstruction.h.

Constructor & Destructor Documentation

◆ DbgRecord()

llvm::DbgRecord::DbgRecord ( Kind  RecordKind,
DebugLoc  DL 
)
inline

Definition at line 151 of file DebugProgramInstruction.h.

◆ ~DbgRecord()

llvm::DbgRecord::~DbgRecord ( )
protecteddefault

Similarly to Value, we avoid paying the cost of a vtable by protecting the dtor and having deleteRecord dispatch cleanup.

Use deleteRecord to delete a generic record.

Member Function Documentation

◆ clone()

DbgRecord * llvm::DbgRecord::clone ( ) const

Definition at line 385 of file DebugProgramInstruction.cpp.

References LabelKind, llvm_unreachable, RecordKind, and ValueKind.

◆ createDebugIntrinsic()

DbgInfoIntrinsic * llvm::DbgRecord::createDebugIntrinsic ( Module M,
Instruction InsertBefore 
) const

Convert this DbgRecord back into an appropriate llvm.dbg.

  • intrinsic. InsertBefore Optional position to insert this intrinsic.
    Returns
    A new llvm.dbg.* intrinsic representiung this DbgRecord.

Definition at line 136 of file DebugProgramInstruction.cpp.

References LabelKind, llvm_unreachable, RecordKind, and ValueKind.

◆ deleteRecord()

void llvm::DbgRecord::deleteRecord ( )

Methods that dispatch to subclass implementations.

These need to be manually updated when a new subclass is added.

Definition at line 80 of file DebugProgramInstruction.cpp.

References RecordKind, and ValueKind.

Referenced by llvm::DbgMarker::dropDbgRecords(), llvm::DbgMarker::dropOneDbgRecord(), and eraseFromParent().

◆ dump()

LLVM_DUMP_METHOD void DbgRecord::dump ( ) const

Definition at line 5476 of file AsmWriter.cpp.

References llvm::dbgs(), and print().

◆ eraseFromParent()

void llvm::DbgRecord::eraseFromParent ( )

◆ getBlock() [1/2]

BasicBlock * llvm::DbgRecord::getBlock ( )

Definition at line 514 of file DebugProgramInstruction.cpp.

References llvm::DbgMarker::getParent(), and Marker.

Referenced by getContext(), and getFunction().

◆ getBlock() [2/2]

const BasicBlock * llvm::DbgRecord::getBlock ( ) const

Definition at line 516 of file DebugProgramInstruction.cpp.

References llvm::DbgMarker::getParent(), and Marker.

◆ getContext() [1/2]

LLVMContext & llvm::DbgRecord::getContext ( )

◆ getContext() [2/2]

const LLVMContext & llvm::DbgRecord::getContext ( ) const

Definition at line 532 of file DebugProgramInstruction.cpp.

References getBlock(), and llvm::BasicBlock::getContext().

◆ getDebugLoc()

DebugLoc llvm::DbgRecord::getDebugLoc ( ) const
inline

◆ getFunction() [1/2]

Function * llvm::DbgRecord::getFunction ( )

◆ getFunction() [2/2]

const Function * llvm::DbgRecord::getFunction ( ) const

Definition at line 520 of file DebugProgramInstruction.cpp.

References getBlock(), and llvm::BasicBlock::getParent().

◆ getInstruction()

const Instruction * llvm::DbgRecord::getInstruction ( ) const

Definition at line 504 of file DebugProgramInstruction.cpp.

References llvm::DbgMarker::MarkedInstr, and Marker.

◆ getMarker() [1/2]

DbgMarker * llvm::DbgRecord::getMarker ( )
inline

◆ getMarker() [2/2]

const DbgMarker * llvm::DbgRecord::getMarker ( ) const
inline

Definition at line 178 of file DebugProgramInstruction.h.

◆ getModule() [1/2]

Module * llvm::DbgRecord::getModule ( )

◆ getModule() [2/2]

const Module * llvm::DbgRecord::getModule ( ) const

Definition at line 526 of file DebugProgramInstruction.cpp.

References getFunction(), and llvm::GlobalValue::getParent().

◆ getNextNode()

DbgRecord * llvm::DbgRecord::getNextNode ( )
inline

Definition at line 199 of file DebugProgramInstruction.h.

◆ getParent() [1/2]

BasicBlock * llvm::DbgRecord::getParent ( )

◆ getParent() [2/2]

const BasicBlock * llvm::DbgRecord::getParent ( ) const

◆ getPrevNode()

DbgRecord * llvm::DbgRecord::getPrevNode ( )
inline

Definition at line 200 of file DebugProgramInstruction.h.

◆ getRecordKind()

Kind llvm::DbgRecord::getRecordKind ( ) const
inline

Definition at line 173 of file DebugProgramInstruction.h.

◆ insertAfter() [1/2]

void llvm::DbgRecord::insertAfter ( DbgRecord InsertAfter)

Definition at line 544 of file DebugProgramInstruction.cpp.

References assert(), getMarker(), and llvm::DbgMarker::insertDbgRecordAfter().

Referenced by moveAfter().

◆ insertAfter() [2/2]

void llvm::DbgRecord::insertAfter ( self_iterator  InsertAfter)

Definition at line 561 of file DebugProgramInstruction.cpp.

References assert(), and getMarker().

◆ insertBefore() [1/2]

void llvm::DbgRecord::insertBefore ( DbgRecord InsertBefore)

Definition at line 536 of file DebugProgramInstruction.cpp.

References assert(), getMarker(), and llvm::DbgMarker::insertDbgRecord().

Referenced by moveBefore().

◆ insertBefore() [2/2]

void llvm::DbgRecord::insertBefore ( self_iterator  InsertBefore)

Definition at line 553 of file DebugProgramInstruction.cpp.

References assert(), and getMarker().

◆ isEquivalentTo()

bool llvm::DbgRecord::isEquivalentTo ( const DbgRecord R) const

Same as isIdenticalToWhenDefined but checks DebugLoc too.

Definition at line 131 of file DebugProgramInstruction.cpp.

References getDebugLoc(), and isIdenticalToWhenDefined().

◆ isIdenticalToWhenDefined()

bool llvm::DbgRecord::isIdenticalToWhenDefined ( const DbgRecord R) const

Definition at line 117 of file DebugProgramInstruction.cpp.

References LabelKind, llvm_unreachable, RecordKind, and ValueKind.

Referenced by isEquivalentTo().

◆ moveAfter() [1/2]

void llvm::DbgRecord::moveAfter ( DbgRecord MoveAfter)

Definition at line 576 of file DebugProgramInstruction.cpp.

References assert(), getMarker(), insertAfter(), and removeFromParent().

◆ moveAfter() [2/2]

void llvm::DbgRecord::moveAfter ( self_iterator  MoveAfter)

Definition at line 589 of file DebugProgramInstruction.cpp.

References assert(), getMarker(), insertAfter(), and removeFromParent().

◆ moveBefore() [1/2]

void llvm::DbgRecord::moveBefore ( DbgRecord MoveBefore)

Definition at line 570 of file DebugProgramInstruction.cpp.

References assert(), getMarker(), insertBefore(), and removeFromParent().

Referenced by migrateDebugInfo().

◆ moveBefore() [2/2]

void llvm::DbgRecord::moveBefore ( self_iterator  MoveBefore)

Definition at line 583 of file DebugProgramInstruction.cpp.

References assert(), getMarker(), insertBefore(), and removeFromParent().

◆ print() [1/2]

void llvm::DbgRecord::print ( raw_ostream O,
bool  IsForDebug = false 
) const

Definition at line 92 of file DebugProgramInstruction.cpp.

Referenced by dump().

◆ print() [2/2]

void llvm::DbgRecord::print ( raw_ostream O,
ModuleSlotTracker MST,
bool  IsForDebug 
) const

Definition at line 104 of file DebugProgramInstruction.cpp.

References LabelKind, llvm_unreachable, RecordKind, and ValueKind.

◆ removeFromParent()

void llvm::DbgRecord::removeFromParent ( )

◆ setDebugLoc()

void llvm::DbgRecord::setDebugLoc ( DebugLoc  Loc)
inline

Definition at line 215 of file DebugProgramInstruction.h.

Referenced by migrateDebugInfo(), and llvm::coro::salvageDebugInfo().

◆ setMarker()

void llvm::DbgRecord::setMarker ( DbgMarker M)
inline

Definition at line 175 of file DebugProgramInstruction.h.

Referenced by llvm::DbgMarker::absorbDebugValues().

Member Data Documentation

◆ DbgLoc

DebugLoc llvm::DbgRecord::DbgLoc
protected

Definition at line 147 of file DebugProgramInstruction.h.

◆ Marker

DbgMarker* llvm::DbgRecord::Marker = nullptr

◆ RecordKind

Kind llvm::DbgRecord::RecordKind
protected

Subclass discriminator.

Definition at line 148 of file DebugProgramInstruction.h.

Referenced by clone(), createDebugIntrinsic(), deleteRecord(), isIdenticalToWhenDefined(), and print().


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