LLVM 20.0.0git
|
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 MDNode * | combine (LLVMContext &Ctx, const MMRAMetadata &A, const MMRAMetadata &B) |
Combines A and B according to MMRA semantics. | |
static MDTuple * | getTagMD (LLVMContext &Ctx, StringRef Prefix, StringRef Suffix) |
Creates !mmra metadata for a single tag. | |
static MDTuple * | getTagMD (LLVMContext &Ctx, const TagT &T) |
static MDTuple * | getMD (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) |
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.
Definition at line 50 of file MemoryModelRelaxationAnnotations.h.
using llvm::MMRAMetadata::SetT = DenseSet<TagT> |
Definition at line 49 of file MemoryModelRelaxationAnnotations.h.
using llvm::MMRAMetadata::TagT = std::pair<StringRef, StringRef> |
Definition at line 48 of file MemoryModelRelaxationAnnotations.h.
|
default |
Referenced by checkCompatibility().
MMRAMetadata::MMRAMetadata | ( | const Instruction & | I | ) |
Definition at line 20 of file MemoryModelRelaxationAnnotations.cpp.
MMRAMetadata::MMRAMetadata | ( | MDNode * | MD | ) |
Definition at line 23 of file MemoryModelRelaxationAnnotations.cpp.
References assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), isTagMD(), and llvm::MDNode::operands().
MMRAMetadata::const_iterator MMRAMetadata::begin | ( | ) | const |
Definition at line 133 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::begin().
|
inlinestatic |
A
and B
are compatible. Definition at line 90 of file MemoryModelRelaxationAnnotations.h.
References A, B, and MMRAMetadata().
|
static |
Combines A
and B
according to MMRA semantics.
Definition at line 79 of file MemoryModelRelaxationAnnotations.cpp.
References A, B, llvm::MDTuple::get(), getTagMD(), and P.
Referenced by llvm::combineMetadata(), and llvm::propagateMetadata().
LLVM_DUMP_METHOD void MMRAMetadata::dump | ( | ) | const |
Definition at line 156 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::dbgs(), and print().
bool MMRAMetadata::empty | ( | ) | const |
Definition at line 139 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty().
MMRAMetadata::const_iterator MMRAMetadata::end | ( | ) | const |
Definition at line 137 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::end().
|
static |
Creates !mmra metadata from Tags
.
Tags
. Definition at line 65 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::front(), llvm::MDTuple::get(), getTagMD(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::ArrayRef< T >::size().
|
inlinestatic |
Definition at line 73 of file MemoryModelRelaxationAnnotations.h.
References getTagMD().
|
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().
Definition at line 102 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count().
Referenced by isCompatibleWith().
Definition at line 126 of file MemoryModelRelaxationAnnotations.cpp.
References P.
Referenced by isCompatibleWith().
bool MMRAMetadata::isCompatibleWith | ( | const MMRAMetadata & | Other | ) | const |
Other
. Definition at line 106 of file MemoryModelRelaxationAnnotations.cpp.
References hasTag(), hasTagWithPrefix(), llvm::Other, and P.
MD
is a well-formed MMRA tag. Definition at line 50 of file MemoryModelRelaxationAnnotations.cpp.
Referenced by MMRAMetadata().
|
inline |
Definition at line 115 of file MemoryModelRelaxationAnnotations.h.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty().
|
inline |
Definition at line 119 of file MemoryModelRelaxationAnnotations.h.
References llvm::Other.
|
inline |
Definition at line 116 of file MemoryModelRelaxationAnnotations.h.
References llvm::Other.
void MMRAMetadata::print | ( | raw_ostream & | OS | ) | const |
Definition at line 143 of file MemoryModelRelaxationAnnotations.cpp.
Referenced by dump().
unsigned MMRAMetadata::size | ( | ) | const |
Definition at line 141 of file MemoryModelRelaxationAnnotations.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::size().