14 #ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H 15 #define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H 19 #include <type_traits> 31 : std::integral_constant<size_t, ConstantLog2<N / 2>::value + 1> {};
32 template <>
struct ConstantLog2<1> : std::integral_constant<size_t, 0> {};
36 static const bool value =
false;
42 static const bool value =
true;
50 static const bool value =
true;
73 enum { NumLowBitsAvailable = 2 };
81 return NonConst::getAsVoidPointer(P);
84 return NonConst::getFromVoidPointer(const_cast<void *>(P));
86 enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
94 return NonConst::getAsVoidPointer(const_cast<T *>(P));
97 return NonConst::getFromVoidPointer(const_cast<void *>(P));
99 enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable };
105 return reinterpret_cast<void *
>(
P);
108 return reinterpret_cast<uintptr_t
>(
P);
111 enum { NumLowBitsAvailable = 0 };
122 template <
int Alignment,
typename FunctionPo
interT>
126 assert((reinterpret_cast<uintptr_t>(P) &
127 ~((uintptr_t)-1 << NumLowBitsAvailable)) == 0 &&
128 "Alignment not satisfied for an actual function pointer!");
129 return reinterpret_cast<void *
>(
P);
132 return reinterpret_cast<FunctionPointerT
>(
P);
143 template <
typename ReturnT,
typename... ParamTs>
static void * getFromVoidPointer(void *P)
This class represents lattice values for constants.
static void * getAsVoidPointer(FunctionPointerT P)
static void * getAsVoidPointer(void *P)
static void * getAsVoidPointer(uintptr_t P)
A tiny meta function to compute the log2 of a compile time constant.
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
static void * getAsVoidPointer(T *P)
static const T * getFromVoidPointer(const void *P)
static const void * getAsVoidPointer(const T *P)
static T * getFromVoidPointer(void *P)
PointerLikeTypeTraits< T > NonConst
Provide suitable custom traits struct for function pointers.
static uintptr_t getFromVoidPointer(void *P)
static FunctionPointerT getFromVoidPointer(void *P)
static const T getFromVoidPointer(const void *P)
PointerLikeTypeTraits< T * > NonConst
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const void * getAsVoidPointer(const T P)