LLVM: lib/IR/Metadata.cpp File Reference (original) (raw)
Go to the source code of this file.
Macros | |
---|---|
#define | HANDLE_METADATA_LEAF(CLASS) |
#define | HANDLE_MDNODE_LEAF(CLASS) |
#define | HANDLE_MDNODE_LEAF(CLASS) |
#define | HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) |
#define | HANDLE_MDNODE_LEAF(CLASS) |
#define | HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) |
#define | HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) |
#define | HANDLE_MDNODE_LEAF(CLASS) |
Functions | |
---|---|
static Metadata * | canonicalizeMetadataForValue (LLVMContext &Context, Metadata *MD) |
Canonicalize metadata arguments to intrinsics. | |
static DISubprogram * | getLocalFunctionMetadata (Value *V) |
static bool | isOperandUnresolved (Metadata *Op) |
static bool | hasSelfReference (MDNode *N) |
template<class T , class InfoT > | |
static T * | uniquifyImpl (T *N, DenseSet< T *, InfoT > &Store) |
static MDNode * | getOrSelfReference (LLVMContext &Context, ArrayRef< Metadata * > Ops) |
Get a node or a self-reference that looks like it. | |
static bool | isContiguous (const ConstantRange &A, const ConstantRange &B) |
static bool | canBeMerged (const ConstantRange &A, const ConstantRange &B) |
static bool | tryMergeRange (SmallVectorImpl< ConstantInt * > &EndPoints, ConstantInt *Low, ConstantInt *High) |
static void | addRange (SmallVectorImpl< ConstantInt * > &EndPoints, ConstantInt *Low, ConstantInt *High) |
static SmallVector< TrackingMDRef, 4 > & | getNMDOps (void *Operands) |
◆ HANDLE_MDNODE_LEAF [1/4]
| #define HANDLE_MDNODE_LEAF | ( | | CLASS | ) | | ---------------------------- | - | | ----- | - |
Value:
static_assert( \
alignof(uint64_t) >= alignof(CLASS), \
"Alignment is insufficient after objects prepended to " #CLASS);
Definition at line 627 of file Metadata.cpp.
◆ HANDLE_MDNODE_LEAF [2/4]
| #define HANDLE_MDNODE_LEAF | ( | | CLASS | ) | | ---------------------------- | - | | ----- | - |
Value:
case CLASS##Kind: \
return cast(this)->cloneImpl();
Definition at line 627 of file Metadata.cpp.
◆ HANDLE_MDNODE_LEAF [3/4]
| #define HANDLE_MDNODE_LEAF | ( | | CLASS | ) | | ---------------------------- | - | | ----- | - |
Value:
case CLASS##Kind: \
delete cast(this); \
break;
Definition at line 627 of file Metadata.cpp.
◆ HANDLE_MDNODE_LEAF [4/4]
| #define HANDLE_MDNODE_LEAF | ( | | CLASS | ) | | ---------------------------- | - | | ----- | - |
Value:
case CLASS##Kind: { \
std::integral_constant<bool, HasCachedHash::value> ShouldResetHash; \
dispatchResetHash(cast(this), ShouldResetHash); \
break; \
}
Definition at line 627 of file Metadata.cpp.
◆ HANDLE_MDNODE_LEAF_UNIQUABLE [1/3]
| #define HANDLE_MDNODE_LEAF_UNIQUABLE | ( | | CLASS | ) | | --------------------------------------- | - | | ----- | - |
Value:
case CLASS##Kind: \
break;
◆ HANDLE_MDNODE_LEAF_UNIQUABLE [2/3]
| #define HANDLE_MDNODE_LEAF_UNIQUABLE | ( | | CLASS | ) | | --------------------------------------- | - | | ----- | - |
Value:
case CLASS##Kind: { \
CLASS *SubclassThis = cast(this); \
std::integral_constant<bool, HasCachedHash::value> \
ShouldRecalculateHash; \
dispatchRecalculateHash(SubclassThis, ShouldRecalculateHash); \
return uniquifyImpl(SubclassThis, getContext().pImpl->CLASS##s); \
}
◆ HANDLE_MDNODE_LEAF_UNIQUABLE [3/3]
| #define HANDLE_MDNODE_LEAF_UNIQUABLE | ( | | CLASS | ) | | --------------------------------------- | - | | ----- | - |
Value:
case CLASS##Kind: \
getContext().pImpl->CLASS##s.erase(cast(this)); \
break;
◆ HANDLE_METADATA_LEAF
| #define HANDLE_METADATA_LEAF | ( | | CLASS | ) | | ------------------------------ | - | | ----- | - |
Value:
case Metadata::CLASS##Kind: \
cast(OwnerMD)->handleChangedOperand(Pair.first, MD); \
continue;
◆ addRange()
◆ canBeMerged()
◆ canonicalizeMetadataForValue()
Canonicalize metadata arguments to intrinsics.
To support bitcode upgrades (and assembly semantic sugar) for MetadataAsValue, we need to canonicalize certain metadata.
- nullptr is replaced by an empty MDNode.
- An MDNode with a single null operand is replaced by an empty MDNode.
- An MDNode whose only operand is a ConstantAsMetadata gets skipped.
This maintains readability of bitcode from when metadata was a type of value, and these bridges were unnecessary.
Definition at line 81 of file Metadata.cpp.
References llvm::CallingConv::C, llvm::MDNode::get(), and N.
Referenced by llvm::MetadataAsValue::get(), and llvm::MetadataAsValue::getIfExists().
◆ getLocalFunctionMetadata()
◆ getNMDOps()
◆ getOrSelfReference()
◆ hasSelfReference()
◆ isContiguous()
◆ isOperandUnresolved()
◆ tryMergeRange()
◆ uniquifyImpl()
template<class T , class InfoT >
static T * uniquifyImpl ( T * N, DenseSet< T *, InfoT > & Store ) | static |
---|