LLVM 20.0.0git
Public Types | Public Member Functions | List of all members
llvm::MMRAMetadata Class Reference

Helper class to manipulate !mmra metadata nodes. More...

#include "llvm/IR/MemoryModelRelaxationAnnotations.h"

Public Types

using TagT = std::pair< StringRef, StringRef >
 
using SetT = DenseSet< TagT >
 
using const_iterator = SetT::const_iterator
 

Public Member Functions

void print (raw_ostream &OS) const
 
void dump () const
 
 operator bool () const
 
bool operator== (const MMRAMetadata &Other) const
 
bool operator!= (const MMRAMetadata &Other) const
 
Constructors
 MMRAMetadata ()=default
 
 MMRAMetadata (const Instruction &I)
 
 MMRAMetadata (MDNode *MD)
 
Content Queries
bool hasTag (StringRef Prefix, StringRef Suffix) const
 
bool hasTagWithPrefix (StringRef Prefix) const
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 
unsigned size () const
 

Static Public Member Functions

Metadata Helpers & Builders
static MDNodecombine (LLVMContext &Ctx, const MMRAMetadata &A, const MMRAMetadata &B)
 Combines A and B according to MMRA semantics.
 
static MDTuplegetTagMD (LLVMContext &Ctx, StringRef Prefix, StringRef Suffix)
 Creates !mmra metadata for a single tag.
 
static MDTuplegetTagMD (LLVMContext &Ctx, const TagT &T)
 
static MDTuplegetMD (LLVMContext &Ctx, ArrayRef< TagT > Tags)
 Creates !mmra metadata from Tags.
 
static bool isTagMD (const Metadata *MD)
 

Compatibility Helpers

bool isCompatibleWith (const MMRAMetadata &Other) const
 
static bool checkCompatibility (const Instruction &A, const Instruction &B)
 

Detailed Description

Helper class to manipulate !mmra metadata nodes.

This can be visualized as a set of "tags", with each tag representing a particular property of an instruction, as explained in the MemoryModelRelaxationAnnotations docs.

This class (and the optimizer in general) does not reason about the exact nature of the tags and the properties they imply. It just sees the metadata as a collection of tags, which are a prefix/suffix pair of strings.

Definition at line 46 of file MemoryModelRelaxationAnnotations.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 50 of file MemoryModelRelaxationAnnotations.h.

◆ SetT

Definition at line 49 of file MemoryModelRelaxationAnnotations.h.

◆ TagT

Definition at line 48 of file MemoryModelRelaxationAnnotations.h.

Constructor & Destructor Documentation

◆ MMRAMetadata() [1/3]

llvm::MMRAMetadata::MMRAMetadata ( )
default

Referenced by checkCompatibility().

◆ MMRAMetadata() [2/3]

MMRAMetadata::MMRAMetadata ( const Instruction I)

Definition at line 20 of file MemoryModelRelaxationAnnotations.cpp.

◆ MMRAMetadata() [3/3]

MMRAMetadata::MMRAMetadata ( MDNode MD)

Member Function Documentation

◆ begin()

MMRAMetadata::const_iterator MMRAMetadata::begin ( ) const

◆ checkCompatibility()

static bool llvm::MMRAMetadata::checkCompatibility ( const Instruction A,
const Instruction B 
)
inlinestatic
Returns
whether the MMRAs on A and B are compatible.

Definition at line 90 of file MemoryModelRelaxationAnnotations.h.

References A, B, and MMRAMetadata().

◆ combine()

MDNode * MMRAMetadata::combine ( LLVMContext Ctx,
const MMRAMetadata A,
const MMRAMetadata B 
)
static

Combines A and B according to MMRA semantics.

Returns
!mmra metadata for the combined MMRAs.

Definition at line 79 of file MemoryModelRelaxationAnnotations.cpp.

References A, B, llvm::MDTuple::get(), getTagMD(), and P.

Referenced by llvm::combineMetadata(), and llvm::propagateMetadata().

◆ dump()

LLVM_DUMP_METHOD void MMRAMetadata::dump ( ) const

Definition at line 156 of file MemoryModelRelaxationAnnotations.cpp.

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

◆ empty()

bool MMRAMetadata::empty ( ) const

◆ end()

MMRAMetadata::const_iterator MMRAMetadata::end ( ) const

◆ getMD()

MDTuple * MMRAMetadata::getMD ( LLVMContext Ctx,
ArrayRef< TagT Tags 
)
static

◆ getTagMD() [1/2]

static MDTuple * llvm::MMRAMetadata::getTagMD ( LLVMContext Ctx,
const TagT T 
)
inlinestatic

Definition at line 73 of file MemoryModelRelaxationAnnotations.h.

References getTagMD().

◆ getTagMD() [2/2]

MDTuple * MMRAMetadata::getTagMD ( LLVMContext Ctx,
StringRef  Prefix,
StringRef  Suffix 
)
static

Creates !mmra metadata for a single tag.

!mmra metadata can either be a single tag, or a MDTuple containing multiple tags.

Definition at line 59 of file MemoryModelRelaxationAnnotations.cpp.

References llvm::MDTuple::get(), and llvm::MDString::get().

Referenced by combine(), getMD(), and getTagMD().

◆ hasTag()

bool MMRAMetadata::hasTag ( StringRef  Prefix,
StringRef  Suffix 
) const

◆ hasTagWithPrefix()

bool MMRAMetadata::hasTagWithPrefix ( StringRef  Prefix) const

Definition at line 126 of file MemoryModelRelaxationAnnotations.cpp.

References P.

Referenced by isCompatibleWith().

◆ isCompatibleWith()

bool MMRAMetadata::isCompatibleWith ( const MMRAMetadata Other) const
Returns
whether this set of tags is compatible with Other.

Definition at line 106 of file MemoryModelRelaxationAnnotations.cpp.

References hasTag(), hasTagWithPrefix(), llvm::Other, and P.

◆ isTagMD()

bool MMRAMetadata::isTagMD ( const Metadata MD)
static
Returns
true if MD is a well-formed MMRA tag.

Definition at line 50 of file MemoryModelRelaxationAnnotations.cpp.

Referenced by MMRAMetadata().

◆ operator bool()

llvm::MMRAMetadata::operator bool ( ) const
inline

◆ operator!=()

bool llvm::MMRAMetadata::operator!= ( const MMRAMetadata Other) const
inline

Definition at line 119 of file MemoryModelRelaxationAnnotations.h.

References llvm::Other.

◆ operator==()

bool llvm::MMRAMetadata::operator== ( const MMRAMetadata Other) const
inline

Definition at line 116 of file MemoryModelRelaxationAnnotations.h.

References llvm::Other.

◆ print()

void MMRAMetadata::print ( raw_ostream OS) const

Definition at line 143 of file MemoryModelRelaxationAnnotations.cpp.

References OS, and P.

Referenced by dump().

◆ size()

unsigned MMRAMetadata::size ( ) const

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