14 #ifndef LLVM_IR_VALUEHANDLE_H
15 #define LLVM_IR_VALUEHANDLE_H
22 class ValueHandleBase;
23 template<
typename From>
struct simplify_type;
33 enum { NumLowBitsAvailable = 2 };
64 : PrevPair(nullptr, Kind), Next(nullptr), V(nullptr) {}
66 : PrevPair(nullptr, Kind), Next(nullptr), V(V) {
71 : PrevPair(nullptr, Kind), Next(nullptr), V(RHS.V) {
73 AddToExistingUseList(RHS.getPrevPtr());
81 if (V == RHS)
return RHS;
82 if (
isValid(V)) RemoveFromUseList();
89 if (V == RHS.V)
return RHS.V;
90 if (
isValid(V)) RemoveFromUseList();
92 if (
isValid(V)) AddToExistingUseList(RHS.getPrevPtr());
117 void setPrevPtr(ValueHandleBase **Ptr) { PrevPair.setPointer(Ptr); }
123 void AddToExistingUseList(ValueHandleBase **
List);
126 void AddToExistingUseListAfter(ValueHandleBase *Node);
131 void RemoveFromUseList();
186 template <
typename ValueTy>
199 Value *getRawValPtr()
const {
return ThePtr; }
200 void setRawValPtr(
Value *
P) { ThePtr =
P; }
203 static Value *GetAsValue(
Value *V) {
return V; }
204 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
206 ValueTy *getValPtr()
const {
return static_cast<ValueTy *
>(getRawValPtr()); }
207 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
219 operator ValueTy*()
const {
228 setValPtr(RHS.getValPtr());
258 template <
typename T>
261 static const bool value =
true;
279 template<
typename ValueTy>
281 void CheckValidity()
const {
296 assert(isa<ValueTy>(VP) &&
297 "Tracked Value was replaced by one with an invalid type!");
300 ValueTy *getValPtr()
const {
304 void setValPtr(ValueTy *
P) {
311 static Value *GetAsValue(
Value *V) {
return V; }
312 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
319 operator ValueTy*()
const {
328 setValPtr(RHS.getValPtr());
345 virtual void anchor();
This is the common base class of value handles.
ValueTy & operator*() const
CallbackVH(const CallbackVH &RHS)
static void ValueIsDeleted(Value *V)
ValueTy & operator*() const
ValueHandleBase(HandleBaseKind Kind, const ValueHandleBase &RHS)
ValueTy * operator=(const AssertingVH< ValueTy > &RHS)
Value * operator=(Value *RHS)
ValueTy * operator->() const
ValueHandleBase(HandleBaseKind Kind)
PointerLikeTypeTraits - This is a traits object that is used to handle pointer types and things that ...
Value * operator->() const
static void * getAsVoidPointer(ValueHandleBase **P)
Value * operator=(const ValueHandleBase &RHS)
virtual void allUsesReplacedWith(Value *)
Callback for Value RAUW.
Value handle that is nullable, but tries to track the Value.
static void ValueIsRAUWd(Value *Old, Value *New)
static SimpleType getSimplifiedValue(const WeakVH &WVH)
ValueTy * operator->() const
Value * getValPtr() const
PointerIntPair - This class implements a pair of a pointer and small integer.
static bool isValid(Value *V)
Value handle that tracks a Value across RAUW.
Value & operator*() const
ValueHandleBase(HandleBaseKind Kind, Value *V)
Value * operator=(const ValueHandleBase &RHS)
static SimpleType getSimplifiedValue(WeakVH &WVH)
virtual void deleted()
Callback for Value destruction.
static bool isEqual(const AssertingVH< T > &LHS, const AssertingVH< T > &RHS)
static ValueHandleBase ** getFromVoidPointer(void *P)
ValueTy * operator=(const TrackingVH< ValueTy > &RHS)
AssertingVH(const AssertingVH &RHS)
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
ValueTy * operator=(ValueTy *RHS)
Value handle that asserts if the Value is deleted.
static unsigned getHashValue(const AssertingVH< T > &Val)
Value * operator=(Value *RHS)
WeakVH(const WeakVH &RHS)
TrackingVH(const TrackingVH &RHS)
static AssertingVH< T > getEmptyKey()
ValueTy * operator=(ValueTy *RHS)
HandleBaseKind
This indicates what sub class the handle actually is.
const ARM::ArchExtKind Kind
LLVM Value Representation.
static AssertingVH< T > getTombstoneKey()
Value handle with callbacks on RAUW and destruction.