(
sizeof(
Ptr) ==
sizeof(intptr_t),
"");
33 static_assert(std::is_trivially_destructible<Ptr>::value,
"");
34 static_assert(std::is_trivially_copy_constructible<Ptr>::value,
"");
35 static_assert(std::is_trivially_move_constructible<Ptr>::value,
"");
39 constexprintptr_t
asInt()
const{
41std::memcpy(&R, Data,
sizeof(R));
45 constexpr operatorintptr_t()
const{
return asInt(); }
48std::memcpy(Data, &V,
sizeof(Data));
56 alignas(
Ptr)
unsigned charData[
sizeof(
Ptr)];
60template<
typenameT,
typenameEnable>
structDenseMapInfo;
61template<
typenamePo
interT,
unsignedIntBits,
typenamePtrTraits>
62structPointerIntPairInfo;
78 typenamePtrTraits = PointerLikeTypeTraits<PointerTy>,
79 typename Info= PointerIntPairInfo<PointerTy, IntBits, PtrTraits>>
96IntType
getInt()
const{
return(IntType)Info::getInt(
Value); }
103 Value= Info::updateInt(
Value,
static_cast<intptr_t
>(IntVal));
107 Value= Info::updatePointer(0, PtrVal);
111 Value= Info::updateInt(Info::updatePointer(0, PtrVal),
112 static_cast<intptr_t
>(IntVal));
121 "Can only return the address if IntBits is cleared and " 122 "PtrTraits doesn't change the pointer");
123 return Value.getPointerAddress();
127 return reinterpret_cast<void*
>(
Value.asInt());
131 Value=
reinterpret_cast<intptr_t
>(Val);
136 P.setFromOpaqueValue(V);
143(void)PtrTraits::getFromVoidPointer(V);
167template<
typenamePo
interT,
unsignedIntBits,
typenamePtrTraits>
169 static_assert(PtrTraits::NumLowBitsAvailable <
170std::numeric_limits<uintptr_t>::digits,
171 "cannot use a pointer type that has all bits free");
172 static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
173 "PointerIntPair with integer size too large for pointer");
177~(uintptr_t)(((intptr_t)1 << PtrTraits::NumLowBitsAvailable) - 1),
181 IntShift= (uintptr_t)PtrTraits::NumLowBitsAvailable - IntBits,
184 IntMask= (uintptr_t)(((intptr_t)1 << IntBits) - 1),
191 returnPtrTraits::getFromVoidPointer(
201 reinterpret_cast<intptr_t
>(PtrTraits::getAsVoidPointer(
Ptr));
203 "Pointer is not sufficiently aligned");
205 returnPtrWord | (OrigValue & ~PointerBitMask);
209intptr_t IntWord =
static_cast<intptr_t
>(
Int);
210 assert((IntWord & ~
IntMask) == 0 &&
"Integer too large for field");
218template<
typenamePo
interTy,
unsignedIntBits,
typenameIntType>
223uintptr_t Val =
static_cast<uintptr_t
>(-1);
224Val <<= PointerLikeTypeTraits<Ty>::NumLowBitsAvailable;
225 returnTy::getFromOpaqueValue(
reinterpret_cast<void*
>(Val));
229uintptr_t Val =
static_cast<uintptr_t
>(-2);
230Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
231 returnTy::getFromOpaqueValue(
reinterpret_cast<void*
>(Val));
235uintptr_t
IV=
reinterpret_cast<uintptr_t
>(V.getOpaqueValue());
243template<
typename PointerTy,
unsignedIntBits,
typenameIntType,
249 return P.getOpaqueValue();
262 static constexpr intNumLowBitsAvailable =
263PtrTraits::NumLowBitsAvailable - IntBits;
267template<std::size_t
I,
typename PointerTy,
unsignedIntBits,
typenameIntType,
268 typenamePtrTraits,
typename Info>
271 static_assert(
I< 2);
272 if constexpr(
I== 0)
281template<
typename PointerTy,
unsignedIntBits,
typenameIntType,
282 typenamePtrTraits,
typename Info>
284 llvm::PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>>
285: std::integral_constant<std::size_t, 2> {};
287template<std::size_t
I,
typenamePointerTy,
unsignedIntBits,
typenameIntType,
288 typenamePtrTraits,
typename Info>
290 I,
llvm::PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>>
291: std::conditional<I == 0, PointerTy, IntType> {};
Analysis containing CSE Info
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const uint32_t IV[8]
PointerIntPair - This class implements a pair of a pointer and small integer.
bool operator<(const PointerIntPair &RHS) const
void setPointer(PointerTy PtrVal) &
PointerIntPair(PointerTy PtrVal)
bool operator!=(const PointerIntPair &RHS) const
static PointerIntPair getFromOpaqueValue(const void *V)
bool operator==(const PointerIntPair &RHS) const
PointerIntPair(PointerTy PtrVal, IntType IntVal)
void initWithPointer(PointerTy PtrVal) &
bool operator<=(const PointerIntPair &RHS) const
void setInt(IntType IntVal) &
void setPointerAndInt(PointerTy PtrVal, IntType IntVal) &
void * getOpaqueValue() const
constexpr PointerIntPair()=default
bool operator>=(const PointerIntPair &RHS) const
static PointerIntPair getFromOpaqueValue(void *V)
PointerTy * getAddrOfPointer()
bool operator>(const PointerIntPair &RHS) const
PointerTy const * getAddrOfPointer() const
PointerTy getPointer() const
void setFromOpaqueValue(void *Val) &
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Implement std::hash so that hash_code can be used in STL containers.
static unsigned getHashValue(Ty V)
static Ty getTombstoneKey()
static bool isEqual(const Ty &LHS, const Ty &RHS)
An information struct used to provide DenseMap with the various necessary components for a given valu...
static PointerT getPointer(intptr_t Value)
static intptr_t updateInt(intptr_t OrigValue, intptr_t Int)
static intptr_t getInt(intptr_t Value)
@ IntShift
IntShift - The number of low bits that we reserve for other uses, and keep zero.
@ PointerBitMask
PointerBitMask - The bits that come from the pointer.
@ IntMask
IntMask - This is the unshifted mask for valid bits of the int type.
static intptr_t updatePointer(intptr_t OrigValue, PointerT Ptr)
static void * getAsVoidPointer(const PointerIntPair< PointerTy, IntBits, IntType > &P)
static PointerIntPair< PointerTy, IntBits, IntType > getFromVoidPointer(void *P)
static PointerIntPair< PointerTy, IntBits, IntType > getFromVoidPointer(const void *P)
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
constexpr intptr_t asInt() const
constexpr PunnedPointer(intptr_t i=0)
const Ptr * getPointerAddress() const
Ptr * getPointerAddress()
constexpr PunnedPointer & operator=(intptr_t V)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4