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());
236 template <
typename ValueTy>
249 Value *getRawValPtr()
const {
return ThePtr; }
250 void setRawValPtr(
Value *
P) { ThePtr =
P; }
253 static Value *GetAsValue(
Value *V) {
return V; }
254 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
256 ValueTy *
getValPtr()
const {
return static_cast<ValueTy *
>(getRawValPtr()); }
257 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
269 operator ValueTy*()
const {
278 setValPtr(RHS.getValPtr());
333 "TrackingVH must be non-null and valid on dereference!");
339 assert(isa<ValueTy>(InnerHandle) &&
340 "Tracked Value was replaced by one with an invalid type!");
341 return cast<ValueTy>(InnerHandle);
347 InnerHandle = GetAsValue(P);
359 operator ValueTy*()
const {
380 virtual void anchor();
409 virtual void deleted() { setValPtr(
nullptr); }
439 template <
typename ValueTy>
448 static Value *GetAsValue(
Value *V) {
return V; }
449 static Value *GetAsValue(
const Value *V) {
return const_cast<Value *
>(V); }
458 bool Poisoned =
false;
464 void deleted()
override {
465 assert(!Poisoned &&
"Tried to delete an already poisoned handle!");
471 void allUsesReplacedWith(
Value *)
override {
472 assert(!Poisoned &&
"Tried to RAUW an already poisoned handle!");
477 Value *ThePtr =
nullptr;
479 Value *getRawValPtr()
const {
return ThePtr; }
480 void setRawValPtr(
Value *
P) { ThePtr =
P; }
484 assert(!Poisoned &&
"Accessed a poisoned value handle!");
485 return static_cast<ValueTy *
>(getRawValPtr());
487 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(P)); }
505 Poisoned = RHS.Poisoned;
544 #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)
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.
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)
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