14 #ifndef LLVM_IR_VALUEHANDLE_H
15 #define LLVM_IR_VALUEHANDLE_H
22 class ValueHandleBase;
23 template<
typename From>
struct simplify_type;
48 : PrevPair(nullptr, Kind), Next(nullptr), V(RHS.V) {
50 AddToExistingUseList(RHS.getPrevPtr());
61 : PrevPair(nullptr, Kind), Next(nullptr), V(nullptr) {}
63 : PrevPair(nullptr, Kind), Next(nullptr), V(V) {
74 if (V == RHS)
return RHS;
75 if (
isValid(V)) RemoveFromUseList();
82 if (V == RHS.V)
return RHS.V;
83 if (
isValid(V)) RemoveFromUseList();
85 if (
isValid(V)) AddToExistingUseList(RHS.getPrevPtr());
124 void RemoveFromUseList();
181 template <
typename ValueTy>
194 Value *getRawValPtr()
const {
return ThePtr; }
195 void setRawValPtr(
Value *
P) { ThePtr =
P; }
198 static Value *GetAsValue(
Value *V) {
return V; }
199 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
201 ValueTy *getValPtr()
const {
return static_cast<ValueTy *
>(getRawValPtr()); }
202 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
214 operator ValueTy*()
const {
223 setValPtr(RHS.getValPtr());
253 template <
typename T>
256 static const bool value =
true;
274 template<
typename ValueTy>
276 void CheckValidity()
const {
291 assert(isa<ValueTy>(VP) &&
292 "Tracked Value was replaced by one with an invalid type!");
295 ValueTy *getValPtr()
const {
299 void setValPtr(ValueTy *
P) {
306 static Value *GetAsValue(
Value *V) {
return V; }
307 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
313 operator ValueTy*()
const {
334 virtual void anchor();
This is the common base class of value handles.
ValueTy & operator*() const
static void ValueIsDeleted(Value *V)
ValueTy & operator*() const
ValueHandleBase(HandleBaseKind Kind, const ValueHandleBase &RHS)
ValueTy * operator=(const AssertingVH< ValueTy > &RHS)
Value * operator=(Value *RHS)
CallbackVH & operator=(const CallbackVH &)=default
ValueTy * operator->() const
ValueHandleBase(HandleBaseKind Kind)
Value * operator->() const
static unsigned getInt(StringRef R)
Get an unsigned integer, including error checks.
Value * operator=(const ValueHandleBase &RHS)
virtual void allUsesReplacedWith(Value *)
Callback for Value RAUW.
static bool isEqual(const Function &Caller, const Function &Callee)
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.
ValueHandleBase(const ValueHandleBase &RHS)
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)
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)
WeakVH & operator=(const WeakVH &RHS)=default
Value handle that asserts if the Value is deleted.
static unsigned getHashValue(const AssertingVH< T > &Val)
Value * operator=(Value *RHS)
WeakVH(const WeakVH &RHS)
static AssertingVH< T > getEmptyKey()
ValueTy * operator=(ValueTy *RHS)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
HandleBaseKind
This indicates what sub class the handle actually is.
LLVM Value Representation.
static AssertingVH< T > getTombstoneKey()
Value handle with callbacks on RAUW and destruction.