LLVM 22.0.0git
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< ilist_detail::compute_node_options< DbgRecord, Options... >::type >
self_iterator getIterator ()
reverse_self_iterator getReverseIterator ()
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< ilist_detail::compute_node_options< DbgRecord, Options... >::type >, ilist_detail::compute_node_options< DbgRecord, Options... >::type::parent_ty >
const ilist_detail::compute_node_options< DbgRecord, Options... >::type::parent_ty * getParent () const
void setParent (ilist_detail::compute_node_options< DbgRecord, Options... >::type::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< ilist_detail::compute_node_options< DbgRecord, Options... >::type >
 ilist_node_impl ()=default

Protected Attributes

DebugLoc DbgLoc
Kind RecordKind
 Subclass discriminator.

Additional Inherited Members

Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< DbgRecord, Options... >::type >
using self_iterator
using const_self_iterator
using reverse_self_iterator
using const_reverse_self_iterator

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

◆ 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()

◆ ~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

◆ 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 llvm::cast(), 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 llvm::cast(), LabelKind, llvm_unreachable, RecordKind, and ValueKind.

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

◆ dump()

LLVM_DUMP_METHOD void DbgRecord::dump ( ) const

Definition at line 5478 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 Marker.

Referenced by getContext(), getContext(), getFunction(), and getFunction().

◆ getBlock() [2/2]

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

Definition at line 516 of file DebugProgramInstruction.cpp.

References Marker.

◆ getContext() [1/2]

◆ getContext() [2/2]

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

Definition at line 532 of file DebugProgramInstruction.cpp.

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

◆ getDebugLoc()

◆ 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 Marker.

◆ getMarker() [1/2]

◆ getMarker() [2/2]

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

Definition at line 178 of file DebugProgramInstruction.h.

References Marker.

◆ 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()

◆ getParent() [1/2]

BasicBlock * llvm::DbgRecord::getParent ( )

Definition at line 512 of file DebugProgramInstruction.cpp.

References Marker.

◆ getParent() [2/2]

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

Definition at line 508 of file DebugProgramInstruction.cpp.

References Marker.

Referenced by llvm::JumpThreadingPass::updateSSA().

◆ getPrevNode()

◆ getRecordKind()

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

Definition at line 173 of file DebugProgramInstruction.h.

References RecordKind.

◆ insertAfter() [1/2]

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

◆ 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)

◆ 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 DbgRecord(), getDebugLoc(), and isIdenticalToWhenDefined().

◆ isIdenticalToWhenDefined()

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

◆ moveAfter() [1/2]

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

◆ 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)

◆ 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.

References llvm::cast(), LabelKind, RecordKind, and ValueKind.

◆ print() [2/2]

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

◆ removeFromParent()

◆ setDebugLoc()

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

Definition at line 215 of file DebugProgramInstruction.h.

References DbgLoc.

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

◆ setMarker()

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

Definition at line 175 of file DebugProgramInstruction.h.

References Marker.

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

Member Data Documentation

◆ DbgLoc

DebugLoc llvm::DbgRecord::DbgLoc
protected

◆ Marker

◆ RecordKind

Kind llvm::DbgRecord::RecordKind
protected

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