LLVM 19.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:
Inheritance graph
[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)
 
bool isEquivalentTo (const DbgRecord &R) const
 Same as isIdenticalToWhenDefined but checks DebugLoc too.
 
Kind getRecordKind () const
 
void setMarker (DbgMarker *M)
 
DbgMarkergetMarker ()
 
const DbgMarkergetMarker () const
 
BasicBlockgetBlock ()
 
const BasicBlockgetBlock () const
 
FunctiongetFunction ()
 
const FunctiongetFunction () const
 
ModulegetModule ()
 
const ModulegetModule () const
 
LLVMContextgetContext ()
 
const LLVMContextgetContext () const
 
const InstructiongetInstruction () const
 
const BasicBlockgetParent () const
 
BasicBlockgetParent ()
 
void removeFromParent ()
 
void eraseFromParent ()
 
DbgRecordgetNextNode ()
 
DbgRecordgetPrevNode ()
 
void insertBefore (DbgRecord *InsertBefore)
 
void insertAfter (DbgRecord *InsertAfter)
 
void moveBefore (DbgRecord *MoveBefore)
 
void moveAfter (DbgRecord *MoveAfter)
 
DebugLoc getDebugLoc () const
 
void setDebugLoc (DebugLoc Loc)
 
void dump () const
 
void deleteRecord ()
 Methods that dispatch to subclass implementations.
 
DbgRecordclone () const
 
void print (raw_ostream &O, bool IsForDebug=false) const
 
void print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug) const
 
bool isIdenticalToWhenDefined (const DbgRecord &R) const
 
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
 
bool isSentinel () 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 134 of file DebugProgramInstruction.h.

Member Typedef Documentation

◆ const_self_iterator

Definition at line 206 of file DebugProgramInstruction.h.

◆ self_iterator

Definition at line 205 of file DebugProgramInstruction.h.

Member Enumeration Documentation

◆ Kind

enum llvm::DbgRecord::Kind : uint8_t

Subclass discriminator.

Enumerator
ValueKind 
LabelKind 

Definition at line 139 of file DebugProgramInstruction.h.

Constructor & Destructor Documentation

◆ DbgRecord()

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

Definition at line 146 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 384 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 135 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 79 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 5276 of file AsmWriter.cpp.

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

◆ eraseFromParent()

void llvm::DbgRecord::eraseFromParent ( )

Definition at line 647 of file DebugProgramInstruction.cpp.

References deleteRecord(), and removeFromParent().

◆ getBlock() [1/2]

BasicBlock * llvm::DbgRecord::getBlock ( )

Definition at line 512 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 514 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 530 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 518 of file DebugProgramInstruction.cpp.

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

◆ getInstruction()

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

Definition at line 502 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 172 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 524 of file DebugProgramInstruction.cpp.

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

◆ getNextNode()

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

◆ getParent() [1/2]

BasicBlock * llvm::DbgRecord::getParent ( )

◆ getParent() [2/2]

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

◆ getPrevNode()

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

◆ getRecordKind()

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

Definition at line 167 of file DebugProgramInstruction.h.

References RecordKind.

◆ insertAfter()

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

Definition at line 542 of file DebugProgramInstruction.cpp.

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

Referenced by moveAfter().

◆ insertBefore()

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

Definition at line 534 of file DebugProgramInstruction.cpp.

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

Referenced by moveBefore().

◆ isEquivalentTo()

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

Same as isIdenticalToWhenDefined but checks DebugLoc too.

Definition at line 130 of file DebugProgramInstruction.cpp.

References getDebugLoc(), and isIdenticalToWhenDefined().

◆ isIdenticalToWhenDefined()

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

Definition at line 116 of file DebugProgramInstruction.cpp.

References LabelKind, llvm_unreachable, RecordKind, and ValueKind.

Referenced by isEquivalentTo().

◆ moveAfter()

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

Definition at line 556 of file DebugProgramInstruction.cpp.

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

◆ moveBefore()

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

Definition at line 550 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 91 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 103 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 201 of file DebugProgramInstruction.h.

References DbgLoc.

Referenced by llvm::coro::salvageDebugInfo().

◆ setMarker()

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

Definition at line 169 of file DebugProgramInstruction.h.

References Marker.

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

Member Data Documentation

◆ DbgLoc

DebugLoc llvm::DbgRecord::DbgLoc
protected

◆ Marker

DbgMarker* llvm::DbgRecord::Marker = nullptr

◆ RecordKind

Kind llvm::DbgRecord::RecordKind
protected

Subclass discriminator.

Definition at line 143 of file DebugProgramInstruction.h.

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


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