14 #ifndef LLVM_SUPPORT_VALUEHANDLE_H
15 #define LLVM_SUPPORT_VALUEHANDLE_H
22 class ValueHandleBase;
23 template<
typename From>
struct simplify_type;
33 enum { NumLowBitsAvailable = 2 };
67 : PrevPair(0,
Kind), Next(0), VP(0, 0) {}
69 : PrevPair(0, Kind), Next(0), VP(V, 0) {
74 : PrevPair(0, Kind), Next(0), VP(RHS.VP) {
76 AddToExistingUseList(RHS.getPrevPtr());
84 if (VP.getPointer() == RHS)
return RHS;
85 if (
isValid(VP.getPointer())) RemoveFromUseList();
87 if (
isValid(VP.getPointer())) AddToUseList();
92 if (VP.getPointer() == RHS.VP.getPointer())
return RHS.VP.getPointer();
93 if (
isValid(VP.getPointer())) RemoveFromUseList();
94 VP.setPointer(RHS.VP.getPointer());
95 if (
isValid(VP.getPointer())) AddToExistingUseList(RHS.getPrevPtr());
96 return VP.getPointer();
123 void setPrevPtr(ValueHandleBase **Ptr) { PrevPair.setPointer(Ptr); }
128 void AddToExistingUseList(ValueHandleBase **
List);
132 void AddToExistingUseListAfter(ValueHandleBase *Node);
137 void RemoveFromUseList();
186 template <
typename ValueTy>
194 ValueTy *getValPtr()
const {
197 void setValPtr(ValueTy *
P) {
202 ValueTy *getValPtr()
const {
return ThePtr; }
203 void setValPtr(ValueTy *P) { ThePtr =
P; }
208 static Value *GetAsValue(
Value *V) {
return V; }
209 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
221 operator ValueTy*()
const {
230 setValPtr(RHS.getValPtr());
249 return PointerInfo::getHashValue(Val);
256 template <
typename T>
259 static const bool value =
true;
278 template<
typename ValueTy>
280 void CheckValidity()
const {
295 assert(isa<ValueTy>(VP) &&
296 "Tracked Value was replaced by one with an invalid type!");
299 ValueTy *getValPtr()
const {
303 void setValPtr(ValueTy *
P) {
310 static Value *GetAsValue(
Value *V) {
return V; }
311 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
318 operator ValueTy*()
const {
327 setValPtr(RHS.getValPtr());
342 virtual void anchor();
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
Value * operator->() const
static void * getAsVoidPointer(ValueHandleBase **P)
Value * operator=(const ValueHandleBase &RHS)
virtual void allUsesReplacedWith(Value *)
static void ValueIsRAUWd(Value *Old, Value *New)
ValueTy * operator->() const
Value * getValPtr() const
static bool isValid(Value *V)
Value & operator*() const
ValueHandleBase(HandleBaseKind Kind, Value *V)
Value * operator=(const ValueHandleBase &RHS)
static SimpleType getSimplifiedValue(WeakVH &WVH)
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)
ValueTy * operator=(ValueTy *RHS)
#define LLVM_DELETED_FUNCTION
unsigned getValPtrInt() const
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)
static T * getTombstoneKey()
LLVM Value Representation.
void setValPtrInt(unsigned K)
DenseMapInfo< T * > PointerInfo