21 if (From == To)
return;
23 assert((!isa<Constant>(
this) || isa<GlobalValue>(
this)) &&
24 "Cannot call User::replaceUsesOfWith on a constant!");
43 "Alignment is insufficient for 'hung-off-uses' pieces");
45 "Alignment is insufficient for 'hung-off-uses' pieces");
52 Use *Begin =
static_cast<Use*
>(::operator
new(
size));
54 (void)
new(End)
Use::UserRef(const_cast<User*>(
this), 1);
65 assert(NewNumUses > OldNumUses &&
"realloc must grow num uses");
72 std::copy(OldOps, OldOps + OldNumUses, NewOps);
77 reinterpret_cast<char *
>(OldOps + OldNumUses) +
sizeof(
Use::UserRef);
79 reinterpret_cast<char *
>(NewOps + NewNumUses) +
sizeof(
Use::UserRef);
82 Use::zap(OldOps, OldOps + OldNumUses,
true);
94 return {MutableARef.begin(), MutableARef.end()};
101 auto *DI =
reinterpret_cast<DescriptorInfo *
>(getIntrusiveOperands()) - 1;
102 assert(DI->SizeInBytes != 0 &&
"Should not have had a descriptor otherwise!");
105 reinterpret_cast<uint8_t *
>(DI) - DI->SizeInBytes, DI->SizeInBytes);
112 void *User::allocateFixedOperandUser(
size_t Size,
unsigned Us,
113 unsigned DescBytes) {
116 static_assert(
sizeof(
DescriptorInfo) %
sizeof(
void *) == 0,
"Required below");
118 unsigned DescBytesToAllocate =
120 assert(DescBytesToAllocate %
sizeof(
void *) == 0 &&
121 "We need this to satisfy alignment constraints for Uses");
123 uint8_t *Storage =
static_cast<uint8_t *
>(
124 ::operator
new(Size +
sizeof(
Use) * Us + DescBytesToAllocate));
125 Use *Start =
reinterpret_cast<Use *
>(Storage + DescBytesToAllocate);
126 Use *End = Start + Us;
127 User *Obj =
reinterpret_cast<User*
>(End);
133 if (DescBytes != 0) {
134 auto *DescInfo =
reinterpret_cast<DescriptorInfo *
>(Storage + DescBytes);
141 void *User::operator
new(
size_t Size,
unsigned Us) {
142 return allocateFixedOperandUser(Size, Us, 0);
145 void *User::operator
new(
size_t Size,
unsigned Us,
unsigned DescBytes) {
146 return allocateFixedOperandUser(Size, Us, DescBytes);
149 void *User::operator
new(
size_t Size) {
151 void *Storage = ::operator
new(Size +
sizeof(
Use *));
152 Use **HungOffOperandList =
static_cast<Use **
>(Storage);
153 User *Obj =
reinterpret_cast<User *
>(HungOffOperandList + 1);
157 *HungOffOperandList =
nullptr;
170 User *Obj =
static_cast<User *
>(Usr);
174 Use **HungOffOperandList =
static_cast<Use **
>(Usr) - 1;
178 ::operator
delete(HungOffOperandList);
184 uint8_t *Storage =
reinterpret_cast<uint8_t *
>(DI) - DI->
SizeInBytes;
185 ::
operator delete(Storage);
190 ::operator
delete(Storage);
This class represents lattice values for constants.
A Use represents the edge between a Value definition and its users.
void growHungoffUses(unsigned N, bool IsPhi=false)
Grow the number of hung off uses.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Value * getOperand(unsigned i) const
void replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
const Use * getOperandList() const
LLVM Basic Block Representation.
PointerIntPair - This class implements a pair of a pointer and small integer.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static Use * initTags(Use *Start, Use *Stop)
Initializes the waymarking tags on an array of Uses.
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
unsigned getNumOperands() const
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
BlockVerifier::State From
void setOperand(unsigned i, Value *Val)
PointerIntPair< User *, 1, unsigned, UserRefPointerTraits > UserRef
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
#define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE
OutputIt copy(R &&Range, OutputIt Out)
static void zap(Use *Start, const Use *Stop, bool del=false)
Destroys Use operands when the number of operands of a User changes.