Go to the documentation of this file.
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;
51 static const bool value =
true;
60 static constexpr
int NumLowBitsAvailable =
75 static constexpr
int NumLowBitsAvailable = 2;
83 return NonConst::getAsVoidPointer(
P);
86 return NonConst::getFromVoidPointer(
const_cast<void *
>(
P));
88 static constexpr
int NumLowBitsAvailable = NonConst::NumLowBitsAvailable;
96 return NonConst::getAsVoidPointer(
const_cast<T *
>(
P));
99 return NonConst::getFromVoidPointer(
const_cast<void *
>(
P));
101 static constexpr
int NumLowBitsAvailable = NonConst::NumLowBitsAvailable;
107 return reinterpret_cast<void *
>(
P);
110 return reinterpret_cast<uintptr_t
>(
P);
113 static constexpr
int NumLowBitsAvailable = 0;
124 template <
int Alignment,
typename FunctionPo
interT>
129 assert((
reinterpret_cast<uintptr_t
>(
P) &
131 "Alignment not satisfied for an actual function pointer!");
132 return reinterpret_cast<void *
>(
P);
135 return reinterpret_cast<FunctionPointerT
>(
P);
146 template <
typename ReturnT,
typename... ParamTs>
static void * getAsVoidPointer(uintptr_t P)
This is an optimization pass for GlobalISel generic memory operations.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
A tiny meta function to compute the log2 of a compile time constant.
static void * getAsVoidPointer(void *P)
static const void * getAsVoidPointer(const T *P)
static const T getFromVoidPointer(const void *P)
static constexpr int NumLowBitsAvailable
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void * getAsVoidPointer(FunctionPointerT P)
static const void * getAsVoidPointer(const T P)
PointerLikeTypeTraits< T * > NonConst
static FunctionPointerT getFromVoidPointer(void *P)
static const T * getFromVoidPointer(const void *P)
static uintptr_t getFromVoidPointer(void *P)
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
PointerLikeTypeTraits< T > NonConst
static void * getAsVoidPointer(T *P)
static void * getFromVoidPointer(void *P)
Provide suitable custom traits struct for function pointers.
static T * getFromVoidPointer(void *P)