9#ifndef LLVM_ADT_POINTEREMBEDDEDINT_H
10#define LLVM_ADT_POINTEREMBEDDEDINT_H
32template <
typename IntT,
int Bits = sizeof(IntT) * CHAR_BIT>
38 static_assert(Bits <
sizeof(uintptr_t) * CHAR_BIT,
39 "Cannot embed more bits than we have in a pointer!");
44 Shift =
sizeof(uintptr_t) * CHAR_BIT - Bits,
47 Mask =
static_cast<uintptr_t
>(-1) << Bits
51 explicit RawValueTag() =
default;
64 assert((std::is_signed<IntT>::value ? isInt<Bits>(
I) : isUInt<Bits>(
I)) &&
65 "Integer has bits outside those preserved!");
66 Value =
static_cast<uintptr_t
>(
I) << Shift;
72 operator IntT()
const {
73 if (std::is_signed<IntT>::value)
74 return static_cast<IntT
>(
static_cast<intptr_t
>(
Value) >> Shift);
75 return static_cast<IntT
>(
Value >> Shift);
81template <
typename IntT,
int Bits>
86 return reinterpret_cast<void *
>(
P.Value);
90 return T(
reinterpret_cast<uintptr_t
>(
P),
typename T::RawValueTag());
94 return T(
reinterpret_cast<uintptr_t
>(
P),
typename T::RawValueTag());
97 static constexpr int NumLowBitsAvailable = T::Shift;
102template <
typename IntT,
int Bits>
111 return IntInfo::getHashValue(Arg);
This file defines DenseMapInfo traits for DenseMap.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Utility to embed an integer into a pointer-like type.
PointerEmbeddedInt & operator=(IntT I)
PointerEmbeddedInt(IntT I)
PointerEmbeddedInt()=default
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
static unsigned getHashValue(const T &Arg)
static bool isEqual(const T &LHS, const T &RHS)
static T getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
static T getFromVoidPointer(const void *P)
static void * getAsVoidPointer(const T &P)
static T getFromVoidPointer(void *P)
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...