13 #ifndef LLVM_IR_VALUEHANDLE_H 14 #define LLVM_IR_VALUEHANDLE_H 43 : PrevPair(nullptr, Kind), Val(RHS.
getValPtr()) {
45 AddToExistingUseList(RHS.getPrevPtr());
53 void setValPtr(
Value *V) { Val = V; }
57 : PrevPair(nullptr, Kind) {}
59 : PrevPair(nullptr, Kind), Val(V) {
87 AddToExistingUseList(RHS.getPrevPtr());
255 template <
typename ValueTy>
268 Value *getRawValPtr()
const {
return ThePtr; }
269 void setRawValPtr(
Value *
P) { ThePtr =
P; }
272 static Value *GetAsValue(
Value *V) {
return V; }
273 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
275 ValueTy *
getValPtr()
const {
return static_cast<ValueTy *
>(getRawValPtr()); }
276 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
289 operator ValueTy*()
const {
298 setValPtr(RHS.getValPtr());
353 "TrackingVH must be non-null and valid on dereference!");
359 assert(isa<ValueTy>(InnerHandle) &&
360 "Tracked Value was replaced by one with an invalid type!");
361 return cast<ValueTy>(InnerHandle);
367 InnerHandle = GetAsValue(P);
379 operator ValueTy*()
const {
400 virtual void anchor();
429 virtual void deleted() { setValPtr(
nullptr); }
459 template <
typename ValueTy>
468 static Value *GetAsValue(
Value *V) {
return V; }
469 static Value *GetAsValue(
const Value *V) {
return const_cast<Value *
>(V); }
478 bool Poisoned =
false;
484 void deleted()
override {
485 assert(!Poisoned &&
"Tried to delete an already poisoned handle!");
491 void allUsesReplacedWith(
Value *)
override {
492 assert(!Poisoned &&
"Tried to RAUW an already poisoned handle!");
497 Value *ThePtr =
nullptr;
499 Value *getRawValPtr()
const {
return ThePtr; }
500 void setRawValPtr(
Value *
P) { ThePtr =
P; }
504 assert(!Poisoned &&
"Accessed a poisoned value handle!");
505 return static_cast<ValueTy *
>(getRawValPtr());
507 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
525 Poisoned = RHS.Poisoned;
564 #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
static unsigned getHashValue(const WeakVH &Val)
ValueHandleBase(HandleBaseKind Kind)
ValueTy & operator*() const
static SimpleType getSimplifiedValue(const WeakTrackingVH &WVH)
WeakTrackingVH(const WeakTrackingVH &RHS)
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 setPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION
void RemoveFromUseList()
Remove this ValueHandle from its current use list.
static bool isEqual(const WeakVH &LHS, const WeakVH &RHS)
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)
static WeakVH getEmptyKey()
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)
static unsigned getHashValue(const PoisoningVH< T > &Val)
ValueTy * operator=(ValueTy *RHS)
Value handle that asserts if the Value is deleted.
static WeakVH getTombstoneKey()
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