Go to the documentation of this file.
14 #ifndef LLVM_ADT_POINTERINTPAIR_H
15 #define LLVM_ADT_POINTERINTPAIR_H
26 template <
typename T,
typename Enable>
struct DenseMapInfo;
27 template <
typename Po
interT,
unsigned IntBits,
typename PtrTraits>
43 template <
typename PointerTy,
unsigned IntBits,
typename IntType = unsigned,
73 Value = Info::updatePointer(0, PtrVal);
77 Value = Info::updateInt(Info::updatePointer(0, PtrVal),
87 "Can only return the address if IntBits is cleared and "
88 "PtrTraits doesn't change the pointer");
100 P.setFromOpaqueValue(V);
107 (void)PtrTraits::getFromVoidPointer(V);
133 template <
typename PointerTy,
unsigned IntBits,
typename IntType,
137 #ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
139 "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
144 template <
typename Po
interT,
unsigned IntBits,
typename PtrTraits>
146 static_assert(PtrTraits::NumLowBitsAvailable <
147 std::numeric_limits<uintptr_t>::digits,
148 "cannot use a pointer type that has all bits free");
149 static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
150 "PointerIntPair with integer size too large for pointer");
154 ~(uintptr_t)(((
intptr_t)1 << PtrTraits::NumLowBitsAvailable) - 1),
158 IntShift = (uintptr_t)PtrTraits::NumLowBitsAvailable - IntBits,
168 return PtrTraits::getFromVoidPointer(
178 reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
180 "Pointer is not sufficiently aligned");
187 assert((IntWord & ~
IntMask) == 0 &&
"Integer too large for field");
195 template <
typename Po
interTy,
unsigned IntBits,
typename IntType>
200 uintptr_t Val =
static_cast<uintptr_t
>(-1);
201 Val <<= PointerLikeTypeTraits<Ty>::NumLowBitsAvailable;
202 return Ty::getFromOpaqueValue(
reinterpret_cast<void *
>(Val));
206 uintptr_t Val =
static_cast<uintptr_t
>(-2);
207 Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
208 return Ty::getFromOpaqueValue(
reinterpret_cast<void *
>(Val));
213 return unsigned(
IV) ^ unsigned(
IV >> 9);
220 template <
typename PointerTy,
unsigned IntBits,
typename IntType,
226 return P.getOpaqueValue();
239 static constexpr
int NumLowBitsAvailable =
240 PtrTraits::NumLowBitsAvailable - IntBits;
245 #endif // LLVM_ADT_POINTERINTPAIR_H
constexpr PointerIntPair()=default
This is an optimization pass for GlobalISel generic memory operations.
void setInt(IntType IntVal) &
static PointerIntPair< PointerTy, IntBits, IntType > getFromVoidPointer(const void *P)
@ IntMask
IntMask - This is the unshifted mask for valid bits of the int type.
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
static intptr_t getInt(intptr_t Value)
static Ty getTombstoneKey()
static PointerT getPointer(intptr_t Value)
const PointerTy * getAddrOfPointer() const
static Error getInt(StringRef R, IntTy &Result)
Get an unsigned integer, including error checks.
bool operator>=(const PointerIntPair &RHS) const
PointerIntPair(PointerTy PtrVal, IntType IntVal)
static intptr_t updateInt(intptr_t OrigValue, intptr_t Int)
static unsigned getHashValue(Ty V)
An information struct used to provide DenseMap with the various necessary components for a given valu...
bool operator<(const PointerIntPair &RHS) const
static PointerIntPair< PointerTy, IntBits, IntType > getFromVoidPointer(void *P)
@ PointerBitMask
PointerBitMask - The bits that come from the pointer.
bool operator!=(const PointerIntPair &RHS) const
Analysis containing CSE Info
PointerIntPair(PointerTy PtrVal)
void setPointerAndInt(PointerTy PtrVal, IntType IntVal) &
static constexpr bool value
PointerTy getPointer() const
bool operator>(const PointerIntPair &RHS) const
bool operator==(const PointerIntPair &RHS) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static PointerIntPair getFromOpaqueValue(const void *V)
static void * getAsVoidPointer(const PointerIntPair< PointerTy, IntBits, IntType > &P)
void setFromOpaqueValue(void *Val) &
@ IntShift
IntShift - The number of low bits that we reserve for other uses, and keep zero.
static bool isEqual(const Ty &LHS, const Ty &RHS)
void setPointer(PointerTy PtrVal) &
PointerTy * getAddrOfPointer()
void initWithPointer(PointerTy PtrVal) &
void * getOpaqueValue() const
static intptr_t updatePointer(intptr_t OrigValue, PointerT Ptr)
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
PointerIntPair - This class implements a pair of a pointer and small integer.
static const uint32_t IV[8]
static PointerIntPair getFromOpaqueValue(void *V)
bool operator<=(const PointerIntPair &RHS) const
LLVM Value Representation.