13#ifndef LLVM_IR_VALUEHANDLE_H
14#define LLVM_IR_VALUEHANDLE_H
46 AddToExistingUseList(
RHS.getPrevPtr());
54 void setValPtr(
Value *V) { Val = V; }
58 : PrevPair(nullptr, Kind) {}
60 : PrevPair(nullptr, Kind), Val(V) {
83 return RHS.getValPtr();
86 setValPtr(
RHS.getValPtr());
88 AddToExistingUseList(
RHS.getPrevPtr());
95 assert(V &&
"Dereferencing deleted ValueHandle");
132 LLVM_ABI void AddToExistingUseList(ValueHandleBase **
List);
135 void AddToExistingUseListAfter(ValueHandleBase *
Node);
260template <
typename ValueTy>
262#
if LLVM_ENABLE_ABI_BREAKING_CHECKS
268#if LLVM_ENABLE_ABI_BREAKING_CHECKS
273 Value *getRawValPtr()
const {
return ThePtr; }
274 void setRawValPtr(
Value *
P) { ThePtr =
P; }
277 static Value *GetAsValue(
Value *V) {
return V; }
278 static Value *GetAsValue(
const Value *V) {
return const_cast<Value*
>(V); }
280 ValueTy *getValPtr()
const {
return static_cast<ValueTy *
>(getRawValPtr()); }
281 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(
P)); }
284#if LLVM_ENABLE_ABI_BREAKING_CHECKS
294 operator ValueTy*()
const {
303 setValPtr(
RHS.getValPtr());
338 "TrackingVH must be non-null and valid on dereference!");
344 assert(isa<ValueTy>(InnerHandle) &&
345 "Tracked Value was replaced by one with an invalid type!");
346 return cast<ValueTy>(InnerHandle);
364 operator ValueTy*()
const {
385 virtual void anchor();
392 ValueHandleBase::operator=(
P);
415 virtual void deleted() { setValPtr(
nullptr); }
445template <
typename ValueTy>
447#
if LLVM_ENABLE_ABI_BREAKING_CHECKS
454 static Value *GetAsValue(
Value *V) {
return V; }
455 static Value *GetAsValue(
const Value *V) {
return const_cast<Value *
>(V); }
457#if LLVM_ENABLE_ABI_BREAKING_CHECKS
464 bool Poisoned =
false;
470 void deleted()
override {
471 assert(!Poisoned &&
"Tried to delete an already poisoned handle!");
477 void allUsesReplacedWith(
Value *)
override {
478 assert(!Poisoned &&
"Tried to RAUW an already poisoned handle!");
483 Value *ThePtr =
nullptr;
485 Value *getRawValPtr()
const {
return ThePtr; }
486 void setRawValPtr(
Value *
P) { ThePtr =
P; }
489 ValueTy *getValPtr()
const {
490#if LLVM_ENABLE_ABI_BREAKING_CHECKS
491 assert(!Poisoned &&
"Accessed a poisoned value handle!");
493 return static_cast<ValueTy *
>(getRawValPtr());
495 void setValPtr(ValueTy *
P) { setRawValPtr(GetAsValue(
P)); }
499#if LLVM_ENABLE_ABI_BREAKING_CHECKS
513 Poisoned =
RHS.Poisoned;
520 operator ValueTy *()
const {
return getValPtr(); }
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines DenseMapInfo traits for DenseMap.
This file defines the PointerIntPair class.
Value handle that asserts if the Value is deleted.
ValueTy * operator=(ValueTy *RHS)
ValueTy & operator*() const
ValueTy * operator=(const AssertingVH< ValueTy > &RHS)
ValueTy * operator->() const
AssertingVH(const AssertingVH &)=default
Value handle with callbacks on RAUW and destruction.
virtual void allUsesReplacedWith(Value *)
Callback for Value RAUW.
CallbackVH(const Value *P)
CallbackVH & operator=(const CallbackVH &)=default
CallbackVH(const CallbackVH &)=default
virtual void deleted()
Callback for Value destruction.
PointerIntPair - This class implements a pair of a pointer and small integer.
void setPointer(PointerTy PtrVal) &
PointerTy getPointer() const
Value handle that poisons itself if the Value is deleted.
ValueTy & operator*() const
ValueTy * operator->() const
Value handle that tracks a Value across RAUW.
ValueTy * operator->() const
ValueTy * getValPtr() const
static Value * GetAsValue(const Value *V)
static Value * GetAsValue(Value *V)
ValueTy & operator*() const
void setValPtr(ValueTy *P)
ValueTy * operator=(ValueTy *RHS)
This is the common base class of value handles.
Value & operator*() const
ValueHandleBase(HandleBaseKind Kind, Value *V)
static bool isValid(Value *V)
LLVM_ABI void RemoveFromUseList()
Remove this ValueHandle from its current use list.
Value * operator->() const
Value * operator=(Value *RHS)
Value * operator=(const ValueHandleBase &RHS)
Value * getValPtr() const
static LLVM_ABI void ValueIsDeleted(Value *V)
void clearValPtr()
Clear the underlying pointer without clearing the use list.
ValueHandleBase(HandleBaseKind Kind)
static LLVM_ABI void ValueIsRAUWd(Value *Old, Value *New)
HandleBaseKind
This indicates what sub class the handle actually is.
ValueHandleBase(HandleBaseKind Kind, const ValueHandleBase &RHS)
ValueHandleBase(const ValueHandleBase &RHS)
LLVM Value Representation.
Value handle that is nullable, but tries to track the Value.
WeakTrackingVH(const WeakTrackingVH &RHS)
Value * operator=(const ValueHandleBase &RHS)
Value * operator=(Value *RHS)
WeakTrackingVH & operator=(const WeakTrackingVH &RHS)=default
bool pointsToAliveValue() const
A nullable Value handle that is nullable.
WeakVH(const WeakVH &RHS)
WeakVH & operator=(const WeakVH &RHS)=default
Value * operator=(const ValueHandleBase &RHS)
Value * operator=(Value *RHS)
This is an optimization pass for GlobalISel generic memory operations.
static bool isEqual(const T *LHS, const PoisoningVH< T > &RHS)
static PoisoningVH< T > getTombstoneKey()
static unsigned getHashValue(const T *Val)
static unsigned getHashValue(const PoisoningVH< T > &Val)
static bool isEqual(const PoisoningVH< T > &LHS, const PoisoningVH< T > &RHS)
static PoisoningVH< T > getEmptyKey()
static bool isEqual(const WeakVH &LHS, const WeakVH &RHS)
static unsigned getHashValue(const WeakVH &Val)
static WeakVH getEmptyKey()
static WeakVH getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
static SimpleType getSimplifiedValue(WeakTrackingVH &WVH)
static SimpleType getSimplifiedValue(WeakVH &WVH)
static SimpleType getSimplifiedValue(const WeakVH &WVH)
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...
static SimpleType & getSimplifiedValue(From &Val)