15#ifndef LLVM_IR_METADATA_H
16#define LLVM_IR_METADATA_H
69 const unsigned char SubclassID;
84#define HANDLE_METADATA_LEAF(CLASS) CLASS##Kind,
85#include "llvm/IR/Metadata.def"
91 static_assert(
sizeof(*this) == 8,
"Metadata fields poorly packed");
128 bool IsForDebug =
false)
const;
130 const Module *M =
nullptr,
bool IsForDebug =
false)
const;
141 const Module *M =
nullptr)
const;
143 const Module *M =
nullptr)
const;
148 LLVMContext::MD_range, LLVMContext::MD_nonnull, LLVMContext::MD_align,
149 LLVMContext::MD_nofpclass};
157 return reinterpret_cast<Metadata**
>(MDs);
160#define HANDLE_METADATA(CLASS) class CLASS;
161#include "llvm/IR/Metadata.def"
165#define HANDLE_METADATA_LEAF(CLASS) \
166 template <> struct isa_impl<CLASS, Metadata> { \
167 static inline bool doit(const Metadata &MD) { \
168 return MD.getMetadataID() == Metadata::CLASS##Kind; \
171#include "llvm/IR/Metadata.def"
185class MetadataAsValue :
public Value {
194 void dropUse() { MD =
nullptr; }
206 return V->getValueID() == MetadataAsValueVal;
210 void handleChangedMetadata(
Metadata *MD);
251 retrackDebugValues(
X);
262 untrackDebugValues();
264 retrackDebugValues(
X);
272 untrackDebugValues();
281 untrackDebugValues();
286 assert(Idx < 3 &&
"Invalid debug value index.");
287 untrackDebugValue(Idx);
289 trackDebugValue(Idx);
300 LLVM_ABI void trackDebugValue(
size_t Idx);
303 LLVM_ABI void untrackDebugValue(
size_t Idx);
373 return retrack(&MD, *MD, &New);
406 assert(UseMap.empty() &&
"Cannot destroy in-use replaceable metadata");
434 void dropRef(
void *
Ref);
435 void moveRef(
void *
Ref,
void *New,
const Metadata &MD);
449 static bool isReplaceable(
const Metadata &MD);
459 : Context(Context) {}
485 assert(V &&
"Expected valid value");
639template <
typename U,
typename V>
642template <
typename U,
typename V>
647 static const bool value = std::is_base_of<Constant, V>::value &&
651 static const bool value = std::is_base_of<Constant, V>::value &&
652 std::is_convertible<M, const Metadata &>::value;
661template <
class X,
class Y>
662inline std::enable_if_t<detail::IsValidPointer<X, Y>::value,
bool>
664 assert(MD &&
"Null pointer sent into hasa");
669template <
class X,
class Y>
670inline std::enable_if_t<detail::IsValidReference<X, Y &>::value,
bool>
678template <
class X,
class Y>
679inline std::enable_if_t<detail::IsValidPointer<X, Y>::value,
X *>
683template <
class X,
class Y>
684inline std::enable_if_t<detail::IsValidReference<X, Y &>::value,
X *>
693template <
class X,
class Y>
694inline std::enable_if_t<detail::IsValidPointer<X, Y>::value,
X *>
706template <
class X,
class Y>
707inline std::enable_if_t<detail::IsValidPointer<X, Y>::value,
X *>
719template <
class X,
class Y>
720inline std::enable_if_t<detail::IsValidPointer<X, Y>::value,
X *>
787 explicit operator bool()
const {
815 std::optional<uint64_t> Len);
828 Result.NoAliasAddrSpace =
840 Result.Scope =
Scope;
856 Result.Scope =
Scope;
963 assert(
static_cast<void *
>(
this) == &MD &&
"Expected same address");
1026 std::make_unique<ReplaceableUsesWithContext>(
getContext()));
1038 "Expected same context");
1059#define HANDLE_MDNODE_LEAF(CLASS) \
1060 using Temp##CLASS = std::unique_ptr<CLASS, TempMDNodeDeleter>;
1061#define HANDLE_MDNODE_BRANCH(CLASS) HANDLE_MDNODE_LEAF(CLASS)
1062#include "llvm/IR/Metadata.def"
1099 struct alignas(alignof(size_t)) Header {
1106 unsigned NumUnresolved = 0;
1109 static constexpr size_t NumOpsFitInVector =
1110 sizeof(LargeStorageVector) /
sizeof(
MDOperand);
1112 NumOpsFitInVector *
sizeof(
MDOperand) ==
sizeof(LargeStorageVector),
1113 "sizeof(LargeStorageVector) must be a multiple of sizeof(MDOperand)");
1115 static constexpr size_t MaxSmallSize = 15;
1117 static constexpr size_t getOpSize(
unsigned NumOps) {
1122 static size_t getSmallSize(
size_t NumOps,
bool IsResizable,
bool IsLarge) {
1123 return IsLarge ? NumOpsFitInVector
1124 : std::max(
NumOps, NumOpsFitInVector * IsResizable);
1135 static bool isLarge(
size_t NumOps) {
return NumOps > MaxSmallSize; }
1137 size_t getAllocSize()
const {
1138 return getOpSize(SmallSize) +
sizeof(Header);
1140 void *getAllocation() {
1141 return reinterpret_cast<char *
>(
this + 1) -
1145 void *getLargePtr()
const {
1146 static_assert(
alignof(LargeStorageVector) <=
alignof(Header),
1147 "LargeStorageVector too strongly aligned");
1148 return reinterpret_cast<char *
>(
const_cast<Header *
>(
this)) -
1149 sizeof(LargeStorageVector);
1154 LargeStorageVector &getLarge() {
1156 return *
reinterpret_cast<LargeStorageVector *
>(getLargePtr());
1159 const LargeStorageVector &getLarge()
const {
1161 return *
reinterpret_cast<const LargeStorageVector *
>(getLargePtr());
1175 reinterpret_cast<MDOperand *
>(
this) - SmallSize, SmallNumOps);
1181 return ArrayRef(
reinterpret_cast<const MDOperand *
>(
this) - SmallSize,
1188 return getLarge().size();
1192 Header &getHeader() {
return *(
reinterpret_cast<Header *
>(
this) - 1); }
1194 const Header &getHeader()
const {
1195 return *(
reinterpret_cast<const Header *
>(
this) - 1);
1198 ContextAndReplaceableUses Context;
1206 LLVM_ABI void operator delete(
void *Mem);
1277 return Context.getReplaceableUses()->getNumUses();
1285 if (Context.hasReplaceableUses())
1286 Context.getReplaceableUses()->replaceAllUsesWith(MD);
1305 static std::enable_if_t<std::is_base_of<MDNode, T>::value,
T *>
1307 return cast<T>(
N.release()->replaceWithPermanentImpl());
1317 static std::enable_if_t<std::is_base_of<MDNode, T>::value,
T *>
1319 return cast<T>(
N.release()->replaceWithUniquedImpl());
1327 static std::enable_if_t<std::is_base_of<MDNode, T>::value,
T *>
1329 return cast<T>(
N.release()->replaceWithDistinctImpl());
1341 const Module *M =
nullptr)
const;
1372 template <
class T,
class StoreT>
1381 assert(!
isUniqued() &&
"Resizing is not supported for uniqued nodes");
1383 "Resizing is not supported for this node kind");
1384 getHeader().resize(
NumOps);
1388 void handleChangedOperand(
void *
Ref,
Metadata *New);
1391 void dropReplaceableUses();
1394 void decrementUnresolvedOperandCount();
1395 void countUnresolvedOperands();
1408 void makeDistinct();
1410 void deleteAsSubclass();
1412 void eraseFromStore();
1414 template <
class NodeTy>
struct HasCachedHash;
1415 template <
class NodeTy>
static void dispatchRecalculateHash(NodeTy *
N) {
1416 if constexpr (HasCachedHash<NodeTy>::value)
1417 N->recalculateHash();
1419 template <
class NodeTy>
static void dispatchResetHash(NodeTy *
N) {
1420 if constexpr (HasCachedHash<NodeTy>::value)
1426 const Instruction *AInstr,
1427 const Instruction *BInstr);
1445 return getHeader().operands()[
I];
1456#define HANDLE_MDNODE_LEAF(CLASS) \
1459#include "llvm/IR/Metadata.def"
1518 void recalculateHash();
1520 LLVM_ABI static MDTuple *getImpl(LLVMContext &Context,
1523 bool ShouldCreate =
true);
1525 TempMDTuple cloneImpl()
const {
1535 return getImpl(Context, MDs,
Uniqued);
1539 return getImpl(Context, MDs,
Uniqued,
false);
1546 return getImpl(Context, MDs,
Distinct);
1556 return TempMDTuple(getImpl(Context, MDs,
Temporary));
1560 TempMDTuple
clone()
const {
return cloneImpl(); }
1613 const MDNode *Node =
nullptr;
1625 if (Node->getNumOperands() > 2)
1627 return N->getString();
1643 const MDNode *Node =
nullptr;
1654 if (Node->getNumOperands() < 2)
1659 if (Node->getNumOperands() > 2)
1661 return N->getString();
1714 std::enable_if_t<std::is_convertible<U *, T *>::value> * =
nullptr)
1720 std::enable_if_t<!std::is_convertible<U *, T *>::value> * =
nullptr)
1731 unsigned size()
const {
return N ? N->getNumOperands() : 0u; }
1732 bool empty()
const {
return N ? N->getNumOperands() == 0 :
true; }
1742#define HANDLE_METADATA(CLASS) \
1743 using CLASS##Array = MDTupleTypedArrayWrapper<CLASS>;
1744#include "llvm/IR/Metadata.def"
1794 assert(!Use &&
"Use is still being tracked despite being untracked!");
1811 Module *Parent =
nullptr;
1814 void setParent(
Module *M) { Parent = M; }
1818 template <
class T1>
class op_iterator_impl {
1827 using iterator_category = std::bidirectional_iterator_tag;
1828 using value_type =
T1;
1829 using difference_type = std::ptrdiff_t;
1830 using pointer = value_type *;
1831 using reference = value_type;
1833 op_iterator_impl() =
default;
1835 bool operator==(
const op_iterator_impl &o)
const {
return Idx == o.Idx; }
1836 bool operator!=(
const op_iterator_impl &o)
const {
return Idx !=
o.Idx; }
1838 op_iterator_impl &operator++() {
1843 op_iterator_impl operator++(
int) {
1844 op_iterator_impl tmp(*
this);
1849 op_iterator_impl &operator--() {
1854 op_iterator_impl operator--(
int) {
1855 op_iterator_impl tmp(*
this);
1860 T1 operator*()
const {
return Node->getOperand(Idx); }
1886 bool IsForDebug =
false)
const;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
static ManagedStatic< DebugCounterOwner > Owner
This file defines DenseMapInfo traits for DenseMap.
This file defines the DenseMap class.
static constexpr Value * getValue(Ty &ValueOrUse)
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
bool operator==(const MergedFunctionsInfo &LHS, const MergedFunctionsInfo &RHS)
This file defines the PointerUnion class, which is a discriminated union of pointer types.
This file defines the SmallVector class.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
AliasScopeDomainNode()=default
AliasScopeDomainNode(const MDNode *N)
bool hasDisjointScopes() const
Return true if this domain has disjoint scopes.
StringRef getDescription() const
Get the optional human-readable description of this domain or the empty string otherwise.
const MDNode * getNode() const
Get the MDNode for this AliasScopeDomainNode.
AliasScopeNode(const MDNode *N)
const MDNode * getNode() const
Get the MDNode for this AliasScopeNode.
const MDNode * getDomain() const
Get the MDNode for this AliasScopeNode's domain.
StringRef getName() const
Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an important base class in LLVM.
LLVM_ABI bool isOneValue() const
Returns true if the value is one.
ContextAndReplaceableUses & operator=(const ContextAndReplaceableUses &)=delete
ReplaceableUsesWithContext * getReplaceableUses() const
ReplaceableUsesWithContext * getOrCreateReplaceableUses()
Ensure that this has RAUW support, and then return it.
ContextAndReplaceableUses & operator=(ContextAndReplaceableUses &&)=delete
ContextAndReplaceableUses(ContextAndReplaceableUses &&)=delete
ContextAndReplaceableUses(const ContextAndReplaceableUses &)=delete
LLVMContext & getContext() const
ContextAndReplaceableUses(std::unique_ptr< ReplaceableUsesWithContext > ReplaceableUses)
~ContextAndReplaceableUses()
std::unique_ptr< ReplaceableUsesWithContext > takeReplaceableUses()
Drop RAUW support.
bool hasReplaceableUses() const
Whether this contains RAUW support.
ContextAndReplaceableUses()=delete
ContextAndReplaceableUses(LLVMContext &Context)
void makeReplaceable(std::unique_ptr< ReplaceableUsesWithContext > ReplaceableUses)
Assign RAUW support to this.
A parsed version of the target data layout string in and methods for querying it.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
Base class for tracking ValueAsMetadata/DIArgLists with user lookups and Owner callbacks outside of V...
DebugValueUser(const DebugValueUser &X)
DebugValueUser & operator=(DebugValueUser &&X)
static constexpr size_t AssignIDIdx
LLVM_ABI void handleChangedValue(void *Old, Metadata *NewDebugValue)
To be called by ReplaceableUses::replaceAllUsesWith, where Old is a pointer to one of the pointers in...
bool operator!=(const DebugValueUser &X) const
DebugValueUser(std::array< Metadata *, 3 > DebugValues)
bool operator==(const DebugValueUser &X) const
ArrayRef< Metadata * > getDebugValues() const
DebugValueUser & operator=(const DebugValueUser &X)
std::array< Metadata *, 3 > DebugValues
void resetDebugValue(size_t Idx, Metadata *DebugValue)
LLVM_ABI DbgVariableRecord * getUser()
DebugValueUser(DebugValueUser &&X)
void replaceUseWith(Metadata *MD)
Replace the use of this with MD.
friend class MetadataTracking
DistinctMDOperandPlaceholder()=delete
~DistinctMDOperandPlaceholder()
DistinctMDOperandPlaceholder(const DistinctMDOperandPlaceholder &)=delete
DistinctMDOperandPlaceholder(unsigned ID)
DistinctMDOperandPlaceholder(DistinctMDOperandPlaceholder &&)=delete
This is an important class for using LLVM in a threaded context.
static LLVM_ABI MDNode * getMostGenericAliasScope(MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMergedCallsiteMetadata(MDNode *A, MDNode *B)
LLVM_ABI void printTree(raw_ostream &OS, const Module *M=nullptr) const
Print in tree shape.
LLVM_ABI void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
iterator_range< MDOperand * > mutable_op_range
LLVM_ABI void resolveCycles()
Resolve cycles.
LLVM_ABI bool isTBAAVtableAccess() const
Check whether MDNode is a vtable access.
static LLVM_ABI CaptureComponents toCaptureComponents(const MDNode *MD)
Convert !captures metadata to CaptureComponents. MD may be nullptr.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
mutable_op_range mutable_operands()
static LLVM_ABI MDNode * getMergedCalleeTypeMetadata(const MDNode *A, const MDNode *B)
void replaceAllUsesWith(Metadata *MD)
RAUW a temporary.
static LLVM_ABI MDNode * getMergedPCSectionsMetadata(MDNode *A, MDNode *B)
Merge !pcsections of two merged instructions: the result requests every section that either requests.
static LLVM_ABI MDNode * concatenate(MDNode *A, MDNode *B)
Methods for metadata merging.
static LLVM_ABI void deleteTemporary(MDNode *N)
Deallocate a node created by getTemporary.
LLVM_ABI void resolve()
Resolve a unique, unresolved node.
static LLVM_ABI MDNode * getMostGenericTBAA(MDNode *A, MDNode *B)
const MDOperand & getOperand(unsigned I) const
static LLVM_ABI MDNode * getMostGenericNoaliasAddrspace(MDNode *A, MDNode *B)
LLVM_ABI void storeDistinctInContext()
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
ArrayRef< MDOperand > operands() const
op_iterator op_end() const
static LLVM_ABI MDNode * getMergedCalleesMetadata(MDNode *A, MDNode *B)
MDNode(const MDNode &)=delete
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
static LLVM_ABI MDNode * getMergedProfMetadata(MDNode *A, MDNode *B, const Instruction *AInstr, const Instruction *BInstr)
Merge !prof metadata from two instructions.
static bool classof(const Metadata *MD)
Methods for support type inquiry through isa, cast, and dyn_cast:
static LLVM_ABI MDNode * getMergedAllocTokenMetadata(const MDNode *A, const MDNode *B)
static LLVM_ABI MDNode * getMostGenericFPMath(MDNode *A, MDNode *B)
void setNumUnresolved(unsigned N)
void resize(size_t NumOps)
Resize the node to hold NumOps operands.
unsigned getNumOperands() const
Return number of MDNode operands.
MDOperand * mutable_begin()
LLVM_ABI MDNode(LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2={})
iterator_range< op_iterator > op_range
friend class LLVMContextImpl
LLVM_ABI TempMDNode clone() const
Create a (temporary) clone of this.
static LLVM_ABI MDNode * getMostGenericRange(MDNode *A, MDNode *B)
unsigned getNumTemporaryUses() const
static LLVM_ABI MDNode * getMergedMemProfMetadata(MDNode *A, MDNode *B)
bool isReplaceable() const
LLVM_ABI void setOperand(unsigned I, Metadata *New)
Set an operand.
bool isResolved() const
Check if node is fully resolved.
op_iterator op_begin() const
static LLVM_ABI MDNode * intersect(MDNode *A, MDNode *B)
static LLVM_ABI MDNode * getMostGenericNoFPClass(MDNode *A, MDNode *B)
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
LLVMContext & getContext() const
MDOperand * mutable_end()
static LLVM_ABI MDNode * fromCaptureComponents(LLVMContext &Ctx, CaptureComponents CC)
Convert CaptureComponents to !captures metadata.
static MDTuple * getIfExists(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithPermanent(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a permanent one.
LLVM_ABI void dropAllReferences()
void operator=(const MDNode &)=delete
friend class ReplaceableUses
const MDOperand * op_iterator
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
LLVM_ABI void dumpTree() const
User-friendly dump in tree shape.
static LLVM_ABI MDNode * getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B)
unsigned getNumUnresolved() const
Tracking metadata reference owned by Metadata.
bool equalsStr(StringRef Str) const
void reset(Metadata *MD, Metadata *Owner)
Metadata * operator->() const
MDOperand & operator=(const MDOperand &)=delete
Metadata & operator*() const
MDOperand(const MDOperand &)=delete
MDOperand & operator=(MDOperand &&Op)
MDOperand(MDOperand &&Op)
unsigned getLength() const
const unsigned char * bytes_begin() const
MDString(const MDString &)=delete
static MDString * get(LLVMContext &Context, const char *Str)
MDString & operator=(MDString &&)=delete
static bool classof(const Metadata *MD)
Methods for support type inquiry through isa, cast, and dyn_cast.
const unsigned char * bytes_end() const
iterator begin() const
Pointer to the first byte of the string.
MDString & operator=(const MDString &)=delete
LLVM_ABI StringRef getString() const
static LLVM_ABI MDString * getIfExists(LLVMContext &Context, StringRef Str)
StringRef::iterator iterator
iterator end() const
Pointer to one byte past the end of the string.
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
MDTupleTypedArrayWrapper(const MDTupleTypedArrayWrapper< U > &Other, std::enable_if_t<!std::is_convertible< U *, T * >::value > *=nullptr)
MDTupleTypedArrayWrapper()=default
MDTupleTypedArrayWrapper(const MDTuple *N)
T * operator[](unsigned I) const
MDTuple * operator->() const
MDTuple & operator*() const
MDTupleTypedArrayWrapper(const MDTupleTypedArrayWrapper< U > &Other, std::enable_if_t< std::is_convertible< U *, T * >::value > *=nullptr)
TypedMDOperandIterator< T > iterator
TempMDTuple clone() const
Return a (temporary) clone of this.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a distinct node.
static bool classof(const Metadata *MD)
void push_back(Metadata *MD)
Append an element to the tuple. This will resize the node.
unsigned getHash() const
Get the hash, if any.
friend class LLVMContextImpl
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * getIfExists(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
void pop_back()
Shrink the operands by 1.
MDTuple * filter(T &&Pred)
Filter out tuple elements that do not satisfy predicate.
Manage lifetime of a slot tracker for printing IR.
A Module instance is used to store all the information related to an LLVM module.
const_op_iterator op_begin() const
NamedMDNode(const NamedMDNode &)=delete
op_iterator_impl< const MDNode * > const_op_iterator
LLVM_ABI void dump() const
LLVM_ABI void setOperand(unsigned I, MDNode *New)
LLVM_ABI StringRef getName() const
void dropAllReferences()
Remove all uses and clear node vector.
LLVM_ABI void print(raw_ostream &ROS, bool IsForDebug=false) const
LLVM_ABI void eraseFromParent()
Drop all references and remove the node from parent module.
const_op_iterator op_end() const
iterator_range< const_op_iterator > operands() const
LLVM_ABI MDNode * getOperand(unsigned i) const
friend class LLVMContextImpl
op_iterator_impl< MDNode * > op_iterator
LLVM_ABI unsigned getNumOperands() const
const Module * getParent() const
LLVM_ABI void clearOperands()
Drop all references to this node's operands.
iterator_range< op_iterator > operands()
Module * getParent()
Get the module that holds this named metadata collection.
LLVM_ABI void addOperand(MDNode *M)
A discriminated union of two or more pointer types, with the discriminator in the low bits of the poi...
Replaceable metadata that remembers its LLVMContext, for owners with no other route to it.
ReplaceableUsesWithContext(LLVMContext &Context)
LLVMContext & getContext() const
Shared implementation of use-lists for replaceable metadata.
friend class MetadataTracking
ReplaceableUses & operator=(const ReplaceableUses &)=delete
MetadataTracking::OwnerTy OwnerTy
LLVM_ABI SmallVector< Metadata * > getAllArgListUsers()
Returns the list of all DIArgList users of this.
LLVM_ABI SmallVector< DbgVariableRecord * > getAllDbgVariableRecordUsers()
Returns the list of all DbgVariableRecord users of this.
LLVM_ABI void resolveAllUses(bool ResolveUsers=true)
Resolve all uses of this.
LLVM_ABI void replaceAllUsesWith(Metadata *MD)
Replace all uses of this with MD.
static LLVM_ABI void SalvageDebugInfo(const Constant &C)
Replace all uses of the constant with Undef in debug info metadata.
unsigned getNumUses() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMapEntryStorage - Holds the value in a StringMapEntry.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Represent a constant reference to a string, i.e.
const unsigned char * bytes_end() const
constexpr size_t size() const
Get the string size.
const unsigned char * bytes_begin() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
Typed iterator through MDNode operands.
TypedMDOperandIterator operator++(int)
std::ptrdiff_t difference_type
TypedMDOperandIterator()=default
bool operator==(const TypedMDOperandIterator &X) const
TypedMDOperandIterator & operator++()
std::forward_iterator_tag iterator_category
TypedMDOperandIterator(MDNode::op_iterator I)
bool operator!=(const TypedMDOperandIterator &X) const
LLVM Value Representation.
LLVM_ABI Value(Type *Ty, unsigned scid)
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
struct LLVMOpaqueNamedMDNode * LLVMNamedMDNodeRef
Represents an LLVM Named Metadata Node.
struct LLVMOpaqueMetadata * LLVMMetadataRef
Represents an LLVM Metadata.
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static constexpr bool HasDereference
decltype(static_cast< V >(*std::declval< U & >())) check_has_dereference
Transitional API for extracting constants from Metadata.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > dyn_extract_or_null(Y &&MD)
Extract a Value from Metadata, if any, allowing null.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, bool > hasa(Y &&MD)
Check whether Metadata has a Value.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)
Extract a Value from Metadata, allowing null.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > dyn_extract(Y &&MD)
Extract a Value from Metadata, if any.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
@ Store
The extracted value is stored (ExtractElement only).
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto cast_or_null(const Y &Val)
bool isa_and_nonnull(const Y &Val)
auto dyn_cast_or_null(const Y &Val)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
CaptureComponents
Components of the pointer that may be captured.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
@ Ref
The access may reference the value stored in memory.
Attribute unwrap(LLVMAttributeRef Attr)
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
ArrayRef(const T &OneElt) -> ArrayRef< T >
typename detail::detector< void, Op, Args... >::value_t is_detected
Detects if a given trait holds for some set of arguments 'Args'.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
SmallVector< Out, Size > to_vector_of(R &&Range)
const uint64_t NOMORE_ICP_MAGICNUM
Magic number in the value profile metadata showing a target has been promoted for the instruction and...
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
LLVM_ABI AAMDNodes concat(const AAMDNodes &Other) const
Determine the best AAMDNodes after concatenating two different locations together.
static LLVM_ABI MDNode * shiftTBAAStruct(MDNode *M, size_t off)
bool operator!=(const AAMDNodes &A) const
MDNode * NoAliasAddrSpace
The tag specifying the noalias address spaces.
MDNode * TBAAStruct
The tag for type-based alias analysis (tbaa struct).
MDNode * Scope
The tag for alias scope specification (used with noalias).
AAMDNodes extendTo(std::optional< uint64_t > Len) const
Create a new AAMDNode that describes this AAMDNode after extending it to apply to a series of bytes o...
MDNode * TBAA
The tag for type-based alias analysis.
AAMDNodes shift(size_t Offset) const
Create a new AAMDNode that describes this AAMDNode after applying a constant offset to the start of t...
LLVM_ABI AAMDNodes merge(const AAMDNodes &Other) const
Given two sets of AAMDNodes applying to potentially different locations, determine the best AAMDNodes...
MDNode * NoAlias
The tag specifying the noalias scope.
AAMDNodes intersect(const AAMDNodes &Other) const
Given two sets of AAMDNodes that apply to the same pointer, give the best AAMDNodes that are compatib...
static LLVM_ABI MDNode * extendToTBAA(MDNode *TBAA, std::optional< uint64_t > Len)
LLVM_ABI AAMDNodes adjustForAccess(unsigned AccessSize)
Create a new AAMDNode for accessing AccessSize bytes of this AAMDNode.
AAMDNodes(MDNode *T, MDNode *TS, MDNode *S, MDNode *N, MDNode *NAS)
bool operator==(const AAMDNodes &A) const
static LLVM_ABI MDNode * shiftTBAA(MDNode *M, size_t off)
static unsigned getHashValue(const AAMDNodes &Val)
static bool isEqual(const AAMDNodes &LHS, const AAMDNodes &RHS)
An information struct used to provide DenseMap with the various necessary components for a given valu...
void operator()(MDNode *Node) const
static SimpleType getSimplifiedValue(MDOperand &MD)
static SimpleType getSimplifiedValue(const MDOperand &MD)
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...