22 if (From == To)
return;
24 assert((!isa<Constant>(
this) || isa<GlobalValue>(
this)) &&
25 "Cannot call User::replaceUsesOfWith on a constant!");
44 "Alignment is insufficient for 'hung-off-uses' pieces");
46 "Alignment is insufficient for 'hung-off-uses' pieces");
53 Use *Begin =
static_cast<Use*
>(::operator
new(
size));
55 (void)
new(End)
Use::UserRef(const_cast<User*>(
this), 1);
66 assert(NewNumUses > OldNumUses &&
"realloc must grow num uses");
73 std::copy(OldOps, OldOps + OldNumUses, NewOps);
78 reinterpret_cast<char *
>(OldOps + OldNumUses) +
sizeof(
Use::UserRef);
80 reinterpret_cast<char *
>(NewOps + NewNumUses) +
sizeof(
Use::UserRef);
83 Use::zap(OldOps, OldOps + OldNumUses,
true);
95 return {MutableARef.begin(), MutableARef.end()};
102 auto *DI =
reinterpret_cast<DescriptorInfo *
>(getIntrusiveOperands()) - 1;
103 assert(DI->SizeInBytes != 0 &&
"Should not have had a descriptor otherwise!");
106 reinterpret_cast<uint8_t *
>(DI) - DI->SizeInBytes, DI->SizeInBytes);
113 void *User::allocateFixedOperandUser(
size_t Size,
unsigned Us,
114 unsigned DescBytes) {
117 static_assert(
sizeof(
DescriptorInfo) %
sizeof(
void *) == 0,
"Required below");
119 unsigned DescBytesToAllocate =
121 assert(DescBytesToAllocate %
sizeof(
void *) == 0 &&
122 "We need this to satisfy alignment constraints for Uses");
124 uint8_t *Storage =
static_cast<uint8_t *
>(
125 ::operator
new(Size +
sizeof(
Use) * Us + DescBytesToAllocate));
126 Use *Start =
reinterpret_cast<Use *
>(Storage + DescBytesToAllocate);
127 Use *End = Start + Us;
128 User *Obj =
reinterpret_cast<User*
>(End);
134 if (DescBytes != 0) {
135 auto *DescInfo =
reinterpret_cast<DescriptorInfo *
>(Storage + DescBytes);
142 void *User::operator
new(
size_t Size,
unsigned Us) {
143 return allocateFixedOperandUser(Size, Us, 0);
146 void *User::operator
new(
size_t Size,
unsigned Us,
unsigned DescBytes) {
147 return allocateFixedOperandUser(Size, Us, DescBytes);
150 void *User::operator
new(
size_t Size) {
152 void *Storage = ::operator
new(Size +
sizeof(
Use *));
153 Use **HungOffOperandList =
static_cast<Use **
>(Storage);
154 User *Obj =
reinterpret_cast<User *
>(HungOffOperandList + 1);
158 *HungOffOperandList =
nullptr;
166 void User::operator
delete(
void *Usr) {
169 User *Obj =
static_cast<User *
>(Usr);
173 Use **HungOffOperandList =
static_cast<Use **
>(Usr) - 1;
177 ::operator
delete(HungOffOperandList);
183 uint8_t *Storage =
reinterpret_cast<uint8_t *
>(DI) - DI->
SizeInBytes;
184 ::
operator delete(Storage);
189 ::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.
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.