14 #ifndef LLVM_IR_VALUEHANDLE_H 15 #define LLVM_IR_VALUEHANDLE_H 44 : PrevPair(nullptr, Kind), Val(RHS.
getValPtr()) {
46 AddToExistingUseList(RHS.getPrevPtr());
54 void setValPtr(
Value *V) { Val = V; }
58 : PrevPair(nullptr, Kind) {}
60 : PrevPair(nullptr, Kind), Val(V) {
88 AddToExistingUseList(RHS.getPrevPtr());
237 template <
typename ValueTy>
250 Value *getRawValPtr()
const {
return ThePtr; }
251 void setRawValPtr(
Value *
P) { ThePtr =
P; }
254 static Value *GetAsValue(
Value *V) {
return V; }
255 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
257 ValueTy *
getValPtr()
const {
return static_cast<ValueTy *
>(getRawValPtr()); }
258 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
270 operator ValueTy*()
const {
279 setValPtr(RHS.getValPtr());
312 template <
typename T>
315 static const bool value =
true;
317 static const bool value =
false;
343 "TrackingVH must be non-null and valid on dereference!");
349 assert(isa<ValueTy>(InnerHandle) &&
350 "Tracked Value was replaced by one with an invalid type!");
351 return cast<ValueTy>(InnerHandle);
357 InnerHandle = GetAsValue(P);
369 operator ValueTy*()
const {
390 virtual void anchor();
419 virtual void deleted() { setValPtr(
nullptr); }
449 template <
typename ValueTy>
458 static Value *GetAsValue(
Value *V) {
return V; }
459 static Value *GetAsValue(
const Value *V) {
return const_cast<Value *
>(V); }
468 bool Poisoned =
false;
474 void deleted()
override {
475 assert(!Poisoned &&
"Tried to delete an already poisoned handle!");
481 void allUsesReplacedWith(
Value *)
override {
482 assert(!Poisoned &&
"Tried to RAUW an already poisoned handle!");
487 Value *ThePtr =
nullptr;
489 Value *getRawValPtr()
const {
return ThePtr; }
490 void setRawValPtr(
Value *
P) { ThePtr =
P; }
494 assert(!Poisoned &&
"Accessed a poisoned value handle!");
495 return static_cast<ValueTy *
>(getRawValPtr());
497 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
515 Poisoned = RHS.Poisoned;
554 static const bool value =
true;
556 static const bool value =
false;
562 #endif // LLVM_IR_VALUEHANDLE_H This is the common base class of value handles.
static void ValueIsDeleted(Value *V)
PoisoningVH & operator=(const PoisoningVH &RHS)
static PoisoningVH< T > getEmptyKey()
This class represents lattice values for constants.
PointerTy getPointer() const
ValueHandleBase(HandleBaseKind Kind, const ValueHandleBase &RHS)
ValueTy * operator=(const AssertingVH< ValueTy > &RHS)
Value * operator=(Value *RHS)
CallbackVH & operator=(const CallbackVH &)=default
ValueHandleBase(HandleBaseKind Kind)
ValueTy & operator*() const
static SimpleType getSimplifiedValue(const WeakTrackingVH &WVH)
WeakTrackingVH(const WeakTrackingVH &RHS)
void setPointer(PointerTy PtrVal)
static PoisoningVH< T > getTombstoneKey()
PoisoningVH(const PoisoningVH &RHS)
static unsigned getInt(StringRef R)
Get an unsigned integer, including error checks.
Value * operator=(const ValueHandleBase &RHS)
ValueTy * operator->() const
virtual void allUsesReplacedWith(Value *)
Callback for Value RAUW.
Value handle that is nullable, but tries to track the Value.
static bool isEqual(const Function &Caller, const Function &Callee)
static Value * GetAsValue(const Value *V)
A nullable Value handle that is nullable.
ValueTy * operator->() const
static SimpleType getSimplifiedValue(WeakTrackingVH &WVH)
ValueTy & operator*() const
static Value * GetAsValue(Value *V)
static void ValueIsRAUWd(Value *Old, Value *New)
static SimpleType getSimplifiedValue(const WeakVH &WVH)
Value * operator=(const ValueHandleBase &RHS)
bool pointsToAliveValue() const
Value handle that poisons itself if the Value is deleted.
void RemoveFromUseList()
Remove this ValueHandle from its current use list.
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)
void setValPtr(ValueTy *P)
Value & operator*() const
ValueHandleBase(HandleBaseKind Kind, Value *V)
ValueTy & operator*() const
Value * operator=(const ValueHandleBase &RHS)
static SimpleType getSimplifiedValue(WeakVH &WVH)
Value * operator->() const
virtual void deleted()
Callback for Value destruction.
static bool isEqual(const AssertingVH< T > &LHS, const AssertingVH< T > &RHS)
void clearValPtr()
Clear the underlying pointer without clearing the use list.
static bool isEqual(const PoisoningVH< T > &LHS, const PoisoningVH< 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 ...
static unsigned getHashValue(const PoisoningVH< T > &Val)
ValueTy * operator=(ValueTy *RHS)
Value handle that asserts if the Value is deleted.
Value * operator=(Value *RHS)
ValueTy * operator->() const
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.
ValueTy * getValPtr() const
Value * getValPtr() const