LLVM 20.0.0git
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::Metadata Class Reference

Root of the metadata hierarchy. More...

#include "llvm/IR/Metadata.h"

Inheritance diagram for llvm::Metadata:
Inheritance graph
[legend]

Public Types

enum  MetadataKind
 

Public Member Functions

unsigned getMetadataID () const
 
void dump () const
 User-friendly dump.
 
void dump (const Module *M) const
 
void print (raw_ostream &OS, const Module *M=nullptr, bool IsForDebug=false) const
 Print.
 
void print (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr, bool IsForDebug=false) const
 
void printAsOperand (raw_ostream &OS, const Module *M=nullptr) const
 Print as operand.
 
void printAsOperand (raw_ostream &OS, ModuleSlotTracker &MST, const Module *M=nullptr) const
 

Protected Types

enum  StorageType { Uniqued , Distinct , Temporary }
 Active type of storage. More...
 

Protected Member Functions

 Metadata (unsigned ID, StorageType Storage)
 
 ~Metadata ()=default
 
void handleChangedOperand (void *, Metadata *)
 Default handling of a changed operand, which asserts.
 

Protected Attributes

unsigned char Storage: 7
 Storage flag for non-uniqued, otherwise unowned, metadata.
 
unsigned char SubclassData1: 1
 
unsigned short SubclassData16 = 0
 
unsigned SubclassData32 = 0
 

Friends

class ReplaceableMetadataImpl
 

Detailed Description

Root of the metadata hierarchy.

This is a root class for typeless data in the IR.

Definition at line 62 of file Metadata.h.

Member Enumeration Documentation

◆ MetadataKind

Definition at line 80 of file Metadata.h.

◆ StorageType

Active type of storage.

Enumerator
Uniqued 
Distinct 
Temporary 

Definition at line 70 of file Metadata.h.

Constructor & Destructor Documentation

◆ Metadata()

llvm::Metadata::Metadata ( unsigned  ID,
StorageType  Storage 
)
inlineprotected

Definition at line 86 of file Metadata.h.

◆ ~Metadata()

llvm::Metadata::~Metadata ( )
protecteddefault

Member Function Documentation

◆ dump() [1/2]

LLVM_DUMP_METHOD void Metadata::dump ( ) const

User-friendly dump.

If M is provided, metadata nodes will be numbered canonically; otherwise, pointer addresses are substituted.

Note: this uses an explicit overload instead of default arguments so that the nullptr version is easy to call from a debugger.

Definition at line 5299 of file AsmWriter.cpp.

References dump().

Referenced by dump(), llvm::SDDbgValue::print(), and llvm::VPlan::printDOT().

◆ dump() [2/2]

LLVM_DUMP_METHOD void Metadata::dump ( const Module M) const

Definition at line 5302 of file AsmWriter.cpp.

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

◆ getMetadataID()

unsigned llvm::Metadata::getMetadataID ( ) const
inline

Definition at line 102 of file Metadata.h.

Referenced by llvm::DINode::classof(), llvm::GenericDINode::classof(), llvm::DIAssignID::classof(), llvm::DISubrange::classof(), llvm::DIGenericSubrange::classof(), llvm::DIEnumerator::classof(), llvm::DIScope::classof(), llvm::DIFile::classof(), llvm::DIType::classof(), llvm::DIBasicType::classof(), llvm::DIStringType::classof(), llvm::DIDerivedType::classof(), llvm::DICompositeType::classof(), llvm::DISubroutineType::classof(), llvm::DICompileUnit::classof(), llvm::DILocalScope::classof(), llvm::DISubprogram::classof(), llvm::DILocation::classof(), llvm::DILexicalBlockBase::classof(), llvm::DILexicalBlock::classof(), llvm::DILexicalBlockFile::classof(), llvm::DINamespace::classof(), llvm::DITemplateParameter::classof(), llvm::DITemplateTypeParameter::classof(), llvm::DITemplateValueParameter::classof(), llvm::DIVariable::classof(), llvm::DIExpression::classof(), llvm::DIGlobalVariable::classof(), llvm::DICommonBlock::classof(), llvm::DILocalVariable::classof(), llvm::DILabel::classof(), llvm::DIObjCProperty::classof(), llvm::DIGlobalVariableExpression::classof(), llvm::DIMacroNode::classof(), llvm::DIMacro::classof(), llvm::DIMacroFile::classof(), llvm::DIArgList::classof(), llvm::ValueAsMetadata::classof(), llvm::ConstantAsMetadata::classof(), llvm::LocalAsMetadata::classof(), llvm::MDString::classof(), llvm::MDNode::classof(), llvm::MDTuple::classof(), llvm::MDNode::clone(), llvm::ReplaceableMetadataImpl::getAllArgListUsers(), llvm::MDNode::isAlwaysReplaceable(), llvm::ReplaceableMetadataImpl::replaceAllUsesWith(), llvm::MDNode::resize(), and llvm::MDNode::storeDistinctInContext().

◆ handleChangedOperand()

void llvm::Metadata::handleChangedOperand ( void *  ,
Metadata  
)
inlineprotected

Default handling of a changed operand, which asserts.

If subclasses pass themselves in as owners to a tracking node reference, they must provide an implementation of this method.

Definition at line 97 of file Metadata.h.

References llvm_unreachable.

◆ print() [1/2]

void Metadata::print ( raw_ostream OS,
const Module M = nullptr,
bool  IsForDebug = false 
) const

Print.

Prints definition of this.

If M is provided, metadata nodes will be numbered canonically; otherwise, pointer addresses are substituted.

Definition at line 5222 of file AsmWriter.cpp.

References OS, and printMetadataImpl().

Referenced by dump(), llvm::operator<<(), llvm::ValueEnumerator::print(), and llvm::printMIR().

◆ print() [2/2]

void Metadata::print ( raw_ostream OS,
ModuleSlotTracker MST,
const Module M = nullptr,
bool  IsForDebug = false 
) const

Definition at line 5228 of file AsmWriter.cpp.

References OS, and printMetadataImpl().

◆ printAsOperand() [1/2]

void Metadata::printAsOperand ( raw_ostream OS,
const Module M = nullptr 
) const

Print as operand.

Prints reference of this.

If M is provided, metadata nodes will be numbered canonically; otherwise, pointer addresses are substituted.

Definition at line 5212 of file AsmWriter.cpp.

References OS, and printMetadataImpl().

Referenced by llvm::MachineInstr::print(), llvm::MachineOperand::print(), and llvm::MachineMemOperand::print().

◆ printAsOperand() [2/2]

void Metadata::printAsOperand ( raw_ostream OS,
ModuleSlotTracker MST,
const Module M = nullptr 
) const

Definition at line 5217 of file AsmWriter.cpp.

References OS, and printMetadataImpl().

Friends And Related Function Documentation

◆ ReplaceableMetadataImpl

friend class ReplaceableMetadataImpl
friend

Definition at line 63 of file Metadata.h.

Member Data Documentation

◆ Storage

unsigned char llvm::Metadata::Storage
protected

Storage flag for non-uniqued, otherwise unowned, metadata.

Definition at line 73 of file Metadata.h.

Referenced by llvm::MDNode::isDistinct(), llvm::MDNode::isTemporary(), llvm::MDNode::isUniqued(), llvm::MDNode::storeDistinctInContext(), and llvm::MDNode::storeImpl().

◆ SubclassData1

unsigned char llvm::Metadata::SubclassData1
protected

◆ SubclassData16

unsigned short llvm::Metadata::SubclassData16 = 0
protected

◆ SubclassData32

unsigned llvm::Metadata::SubclassData32 = 0
protected

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