9 #ifndef LLVM_ADT_POINTEREMBEDDEDINT_H 10 #define LLVM_ADT_POINTEREMBEDDEDINT_H 18 #include <type_traits> 32 template <
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);
81 template <
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 enum { NumLowBitsAvailable = T::Shift };
102 template <
typename IntT,
int Bits>
111 return IntInfo::getHashValue(Arg);
114 static bool isEqual(
const T &LHS,
const T &RHS) {
return LHS == RHS; }
119 #endif // LLVM_ADT_POINTEREMBEDDEDINT_H static unsigned getHashValue(const T &Arg)
This class represents lattice values for constants.
static T getTombstoneKey()
Utility to embed an integer into a pointer-like type.
PointerEmbeddedInt(IntT I)
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
static T getFromVoidPointer(const void *P)
static T getFromVoidPointer(void *P)
static void * getAsVoidPointer(const T &P)
PointerEmbeddedInt & operator=(IntT I)
static bool isEqual(const T &LHS, const T &RHS)
PointerEmbeddedInt()=default
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.