14#ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
15#define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
30 static const bool value =
false;
51 static inline void *getAsVoidPointer(
T *
P) {
return P; }
52 static inline T *getFromVoidPointer(
void *
P) {
return static_cast<T *
>(
P); }
76 return NonConst::getAsVoidPointer(
P);
79 return NonConst::getFromVoidPointer(
const_cast<void *
>(
P));
89 return NonConst::getAsVoidPointer(
const_cast<T *
>(
P));
92 return NonConst::getFromVoidPointer(
const_cast<void *
>(
P));
100 return reinterpret_cast<void *
>(
P);
103 return reinterpret_cast<uintptr_t
>(
P);
117template <
int Alignment,
typename FunctionPo
interT>
121 assert((
reinterpret_cast<uintptr_t
>(
P) &
123 "Alignment not satisfied for an actual function pointer!");
124 return reinterpret_cast<void *
>(
P);
127 return reinterpret_cast<FunctionPointerT
>(
P);
138template <
typename ReturnT,
typename... ParamTs>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This is an optimization pass for GlobalISel generic memory operations.
constexpr size_t CTLog2()
Compile time Log2.
Provide suitable custom traits struct for function pointers.
static constexpr int NumLowBitsAvailable
static FunctionPointerT getFromVoidPointer(void *P)
static void * getAsVoidPointer(FunctionPointerT P)
static constexpr int NumLowBitsAvailable
static const void * getAsVoidPointer(const T P)
PointerLikeTypeTraits< T > NonConst
static const T getFromVoidPointer(const void *P)
static const T * getFromVoidPointer(const void *P)
static constexpr int NumLowBitsAvailable
static const void * getAsVoidPointer(const T *P)
PointerLikeTypeTraits< T * > NonConst
static constexpr int NumLowBitsAvailable
static void * getAsVoidPointer(uintptr_t P)
static uintptr_t getFromVoidPointer(void *P)
static void * getFromVoidPointer(void *P)
static void * getAsVoidPointer(void *P)
static constexpr int NumLowBitsAvailable
Note, we assume here that void* is related to raw malloc'ed memory and that malloc returns objects at...
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...