Lines Matching +full:- +full:- +full:user

1 //===-- User.cpp - Implement the User class -------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/IR/User.h"
17 //===----------------------------------------------------------------------===//
18 // User Class
19 //===----------------------------------------------------------------------===//
21 bool User::replaceUsesOfWith(Value *From, Value *To) {
26 "Cannot call User::replaceUsesOfWith on a constant!");
37 if (is_contained(DVI->location_ops(), From)) {
38 DVI->replaceVariableLocationOp(From, To);
46 //===----------------------------------------------------------------------===//
47 // User allocHungoffUses Implementation
48 //===----------------------------------------------------------------------===//
50 void User::allocHungoffUses(unsigned N, bool IsPhi) {
54 "Alignment is insufficient for 'hung-off-uses' pieces");
67 void User::growHungoffUses(unsigned NewNumUses, bool IsPhi) {
93 // This is a private struct used by `User` to track the co-allocated descriptor
99 ArrayRef<const uint8_t> User::getDescriptor() const {
100 auto MutableARef = const_cast<User *>(this)->getDescriptor();
104 MutableArrayRef<uint8_t> User::getDescriptor() {
108 auto *DI = reinterpret_cast<DescriptorInfo *>(getIntrusiveOperands()) - 1;
109 assert(DI->SizeInBytes != 0 && "Should not have had a descriptor otherwise!");
112 reinterpret_cast<uint8_t *>(DI) - DI->SizeInBytes, DI->SizeInBytes);
115 bool User::isDroppable() const {
117 switch (II->getIntrinsicID()) {
129 //===----------------------------------------------------------------------===//
130 // User operator new Implementations
131 //===----------------------------------------------------------------------===//
133 void *User::allocateFixedOperandUser(size_t Size, unsigned Us,
148 User *Obj = reinterpret_cast<User *>(End);
154 DescInfo->SizeInBytes = DescBytes;
160 void *User::operator new(size_t Size, IntrusiveOperandsAllocMarker allocTrait) {
164 void *User::operator new(size_t Size,
170 void *User::operator new(size_t Size, HungOffOperandsAllocMarker) {
174 User *Obj = reinterpret_cast<User *>(HungOffOperandList + 1);
179 //===----------------------------------------------------------------------===//
180 // User operator delete Implementation
181 //===----------------------------------------------------------------------===//
183 // Repress memory sanitization, due to use-after-destroy by operator
185 LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void User::operator delete(void *Usr) {
186 // Hung off uses use a single Use* before the User, while other subclasses
187 // use a Use[] allocated prior to the user.
188 User *Obj = static_cast<User *>(Usr);
189 if (Obj->HasHungOffUses) {
190 assert(!Obj->HasDescriptor && "not supported!");
192 Use **HungOffOperandList = static_cast<Use **>(Usr) - 1;
194 Use::zap(*HungOffOperandList, *HungOffOperandList + Obj->NumUserOperands,
197 } else if (Obj->HasDescriptor) {
198 Use *UseBegin = static_cast<Use *>(Usr) - Obj->NumUserOperands;
199 Use::zap(UseBegin, UseBegin + Obj->NumUserOperands, /* Delete */ false);
201 auto *DI = reinterpret_cast<DescriptorInfo *>(UseBegin) - 1;
202 uint8_t *Storage = reinterpret_cast<uint8_t *>(DI) - DI->SizeInBytes;
205 Use *Storage = static_cast<Use *>(Usr) - Obj->NumUserOperands;
206 Use::zap(Storage, Storage + Obj->NumUserOperands,