LLVM 22.0.0git
llvm::Metadata Class Reference

Root of the metadata hierarchy. More...

#include "llvm/IR/Metadata.h"

Inheritance diagram for llvm::Metadata:
[legend]

Public Types

enum  MetadataKind

Public Member Functions

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

Static Public Attributes

static constexpr const unsigned PoisonGeneratingIDs []
 Metadata IDs that may generate poison.

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 63 of file Metadata.h.

Member Enumeration Documentation

◆ MetadataKind

Definition at line 81 of file Metadata.h.

◆ StorageType

Active type of storage.

Enumerator
Uniqued 
Distinct 
Temporary 

Definition at line 71 of file Metadata.h.

Constructor & Destructor Documentation

◆ Metadata()

◆ ~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 5515 of file AsmWriter.cpp.

References llvm::dump(), and dump().

Referenced by dump(), dump(), and llvm::SDValue::dump().

◆ dump() [2/2]

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

Definition at line 5518 of file AsmWriter.cpp.

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

◆ getMetadataID()

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

Definition at line 103 of file Metadata.h.

Referenced by llvm::ConstantAsMetadata::classof(), llvm::DIArgList::classof(), llvm::DIAssignID::classof(), llvm::DIBasicType::classof(), llvm::DICommonBlock::classof(), llvm::DICompileUnit::classof(), llvm::DICompositeType::classof(), llvm::DIDerivedType::classof(), llvm::DIEnumerator::classof(), llvm::DIExpression::classof(), llvm::DIFile::classof(), llvm::DIFixedPointType::classof(), llvm::DIGenericSubrange::classof(), llvm::DIGlobalVariable::classof(), llvm::DIGlobalVariableExpression::classof(), llvm::DILabel::classof(), llvm::DILexicalBlock::classof(), llvm::DILexicalBlockBase::classof(), llvm::DILexicalBlockFile::classof(), llvm::DILocalScope::classof(), llvm::DILocalVariable::classof(), llvm::DILocation::classof(), llvm::DIMacro::classof(), llvm::DIMacroFile::classof(), llvm::DIMacroNode::classof(), llvm::DINamespace::classof(), llvm::DINode::classof(), llvm::DIObjCProperty::classof(), llvm::DIScope::classof(), llvm::DIStringType::classof(), llvm::DISubprogram::classof(), llvm::DISubrange::classof(), llvm::DISubrangeType::classof(), llvm::DISubroutineType::classof(), llvm::DITemplateParameter::classof(), llvm::DITemplateTypeParameter::classof(), llvm::DITemplateValueParameter::classof(), llvm::DIType::classof(), llvm::DIVariable::classof(), llvm::GenericDINode::classof(), llvm::LocalAsMetadata::classof(), llvm::MDNode::classof(), llvm::MDString::classof(), llvm::MDTuple::classof(), llvm::ValueAsMetadata::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 98 of file Metadata.h.

References llvm_unreachable, and Metadata().

◆ 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 5438 of file AsmWriter.cpp.

References llvm::isa(), print(), and printMetadataImpl().

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

◆ print() [2/2]

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

Definition at line 5444 of file AsmWriter.cpp.

References print(), 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 5428 of file AsmWriter.cpp.

References llvm::isa(), printAsOperand(), and printMetadataImpl().

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

◆ printAsOperand() [2/2]

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

Definition at line 5433 of file AsmWriter.cpp.

References printAsOperand(), and printMetadataImpl().

◆ ReplaceableMetadataImpl

friend class ReplaceableMetadataImpl
friend

Definition at line 64 of file Metadata.h.

References ReplaceableMetadataImpl.

Referenced by ReplaceableMetadataImpl.

Member Data Documentation

◆ PoisonGeneratingIDs

const unsigned llvm::Metadata::PoisonGeneratingIDs[]
staticconstexpr
Initial value:
= {
LLVMContext::MD_range, LLVMContext::MD_nonnull, LLVMContext::MD_align}

Metadata IDs that may generate poison.

Definition at line 145 of file Metadata.h.

Referenced by doPromotion(), and llvm::InstCombinerImpl::visitLoadInst().

◆ Storage

unsigned char llvm::Metadata::Storage
protected

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

Definition at line 74 of file Metadata.h.

Referenced by llvm::DIBasicType::DIBasicType(), llvm::DIBasicType::DIBasicType(), llvm::DILexicalBlockBase::DILexicalBlockBase(), llvm::DILocalScope::DILocalScope(), llvm::DIMacroNode::DIMacroNode(), llvm::DINode::DINode(), llvm::DIScope::DIScope(), llvm::DITemplateParameter::DITemplateParameter(), llvm::DIType::DIType(), llvm::DIVariable::DIVariable(), llvm::DIBasicType::getImpl(), llvm::DIBasicType::getImpl(), llvm::DIBasicType::getImpl(), llvm::MDNode::isDistinct(), llvm::MDNode::isTemporary(), llvm::MDNode::isUniqued(), llvm::DIAssignID::MDNode, llvm::DICommonBlock::MDNode, llvm::DICompositeType::MDNode, llvm::DIDerivedType::MDNode, llvm::DIEnumerator::MDNode, llvm::DIExpression::MDNode, llvm::DIFixedPointType::MDNode, llvm::DIGenericSubrange::MDNode, llvm::DIGlobalVariable::MDNode, llvm::DIGlobalVariableExpression::MDNode, llvm::DIImportedEntity::MDNode, llvm::DILabel::MDNode, llvm::DILexicalBlock::MDNode, llvm::DILexicalBlockFile::MDNode, llvm::DILocalVariable::MDNode, llvm::DILocation::MDNode, llvm::DIMacro::MDNode, llvm::DIMacroFile::MDNode, llvm::DIModule::MDNode, llvm::DINamespace::MDNode, llvm::DIObjCProperty::MDNode, llvm::DIStringType::MDNode, llvm::DISubrange::MDNode, llvm::DISubrangeType::MDNode, llvm::DISubroutineType::MDNode, llvm::DITemplateTypeParameter::MDNode, llvm::DITemplateValueParameter::MDNode, llvm::GenericDINode::MDNode, llvm::MDNode::MDNode(), llvm::MDTuple::MDNode, Metadata(), llvm::MDNode::operator new(), llvm::MDNode::storeDistinctInContext(), llvm::MDNode::storeImpl(), llvm::MDNode::storeImpl(), and llvm::MDNode::~MDNode().

◆ SubclassData1

◆ SubclassData16

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

◆ SubclassData32


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