10 #ifndef LLVM_ADT_POINTEREMBEDDEDINT_H 11 #define LLVM_ADT_POINTEREMBEDDEDINT_H 19 #include <type_traits> 33 template <
typename IntT,
int Bits = sizeof(IntT) * CHAR_BIT>
39 static_assert(
Bits <
sizeof(uintptr_t) * CHAR_BIT,
40 "Cannot embed more bits than we have in a pointer!");
45 Shift =
sizeof(uintptr_t) * CHAR_BIT -
Bits,
48 Mask = static_cast<uintptr_t>(-1) <<
Bits 52 explicit RawValueTag() =
default;
65 assert((std::is_signed<IntT>::value ? isInt<Bits>(I) : isUInt<Bits>(I)) &&
66 "Integer has bits outside those preserved!");
67 Value =
static_cast<uintptr_t
>(
I) << Shift;
73 operator IntT()
const {
74 if (std::is_signed<IntT>::value)
75 return static_cast<IntT
>(
static_cast<intptr_t>(Value) >> Shift);
76 return static_cast<IntT
>(Value >> Shift);
82 template <
typename IntT,
int Bits>
87 return reinterpret_cast<void *
>(P.Value);
91 return T(reinterpret_cast<uintptr_t>(P),
typename T::RawValueTag());
95 return T(reinterpret_cast<uintptr_t>(P),
typename T::RawValueTag());
98 enum { NumLowBitsAvailable = T::Shift };
103 template <
typename IntT,
int Bits>
112 return IntInfo::getHashValue(Arg);
115 static bool isEqual(
const T &LHS,
const T &RHS) {
return LHS == RHS; }
120 #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 Value Value * Arg
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.