Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
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

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

Static Public Member Functions

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

Compatibility Helpers

LLVM_ABI 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 47 of file MemoryModelRelaxationAnnotations.h.

Member Typedef Documentation

◆ const_iterator

◆ SetT

◆ TagT

Definition at line 49 of file MemoryModelRelaxationAnnotations.h.

Constructor & Destructor Documentation

◆ MMRAMetadata() [1/3]

llvm::MMRAMetadata::MMRAMetadata ( )
default

◆ MMRAMetadata() [2/3]

MMRAMetadata::MMRAMetadata ( const Instruction & I)

Definition at line 19 of file MemoryModelRelaxationAnnotations.cpp.

References I, and MMRAMetadata().

◆ MMRAMetadata() [3/3]

MMRAMetadata::MMRAMetadata ( MDNode * MD)

Member Function Documentation

◆ begin()

◆ checkCompatibility()

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

Definition at line 91 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 78 of file MemoryModelRelaxationAnnotations.cpp.

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

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

◆ dump()

LLVM_DUMP_METHOD void MMRAMetadata::dump ( ) const

Definition at line 155 of file MemoryModelRelaxationAnnotations.cpp.

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

◆ empty()

bool MMRAMetadata::empty ( ) const

Definition at line 138 of file MemoryModelRelaxationAnnotations.cpp.

◆ end()

◆ getMD()

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

Creates !mmra metadata from Tags.

Returns
nullptr or a MDTuple* from Tags.

Definition at line 64 of file MemoryModelRelaxationAnnotations.cpp.

References llvm::MDTuple::get(), getTagMD(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Tag.

◆ getTagMD() [1/2]

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

Definition at line 74 of file MemoryModelRelaxationAnnotations.h.

References getTagMD(), and T.

◆ 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 58 of file MemoryModelRelaxationAnnotations.cpp.

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

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

◆ hasTag()

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

Definition at line 101 of file MemoryModelRelaxationAnnotations.cpp.

Referenced by isCompatibleWith().

◆ hasTagWithPrefix()

bool MMRAMetadata::hasTagWithPrefix ( StringRef Prefix) const

Definition at line 125 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 105 of file MemoryModelRelaxationAnnotations.cpp.

References hasTag(), hasTagWithPrefix(), MMRAMetadata(), 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 49 of file MemoryModelRelaxationAnnotations.cpp.

References llvm::dyn_cast(), and llvm::isa().

Referenced by MMRAMetadata().

◆ operator bool()

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

Definition at line 116 of file MemoryModelRelaxationAnnotations.h.

◆ operator!=()

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

Definition at line 120 of file MemoryModelRelaxationAnnotations.h.

References MMRAMetadata(), and llvm::Other.

◆ operator==()

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

Definition at line 117 of file MemoryModelRelaxationAnnotations.h.

References MMRAMetadata(), and llvm::Other.

◆ print()

void MMRAMetadata::print ( raw_ostream & OS) const

Definition at line 142 of file MemoryModelRelaxationAnnotations.cpp.

References P.

Referenced by dump().

◆ size()

unsigned MMRAMetadata::size ( ) const

Definition at line 140 of file MemoryModelRelaxationAnnotations.cpp.


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