22 void User::anchor() {}
25 if (From == To)
return;
27 assert((!isa<Constant>(
this) || isa<GlobalValue>(
this)) &&
28 "Cannot call User::replaceUsesOfWith on a constant!");
47 "Alignment is insufficient for 'hung-off-uses' pieces");
50 "Alignment is insufficient for 'hung-off-uses' pieces");
57 Use *Begin =
static_cast<Use*
>(::operator
new(
size));
59 (void)
new(End)
Use::UserRef(const_cast<User*>(
this), 1);
70 assert(NewNumUses > OldNumUses &&
"realloc must grow num uses");
77 std::copy(OldOps, OldOps + OldNumUses, NewOps);
82 reinterpret_cast<char *
>(OldOps + OldNumUses) +
sizeof(
Use::UserRef);
84 reinterpret_cast<char *
>(NewOps + NewNumUses) +
sizeof(
Use::UserRef);
85 std::copy(OldPtr, OldPtr + (OldNumUses *
sizeof(
BasicBlock *)), NewPtr);
87 Use::zap(OldOps, OldOps + OldNumUses,
true);
94 void *User::operator
new(
size_t Size,
unsigned Us) {
95 assert(Us < (1u << NumUserOperandsBits) &&
"Too many operands");
96 void *Storage = ::operator
new(Size +
sizeof(
Use) * Us);
97 Use *Start =
static_cast<Use*
>(Storage);
98 Use *End = Start + Us;
99 User *Obj =
reinterpret_cast<User*
>(End);
106 void *User::operator
new(
size_t Size) {
108 void *Storage = ::operator
new(Size +
sizeof(
Use *));
109 Use **HungOffOperandList =
static_cast<Use **
>(Storage);
110 User *Obj =
reinterpret_cast<User *
>(HungOffOperandList + 1);
113 *HungOffOperandList =
nullptr;
121 void User::operator
delete(
void *Usr) {
124 User *Obj =
static_cast<User *
>(Usr);
126 Use **HungOffOperandList =
static_cast<Use **
>(Usr) - 1;
130 ::operator
delete(HungOffOperandList);
135 ::operator
delete(Storage);
AlignOf - A templated class that contains an enum value representing the alignment of the template ar...
unsigned getNumOperands() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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.
void replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
LLVM Basic Block Representation.
PointerIntPair - This class implements a pair of a pointer and small integer.
static Use * initTags(Use *Start, Use *Stop)
Initializes the waymarking tags on an array of Uses.
Value * getOperand(unsigned i) const
PointerIntPair< User *, 1, unsigned > UserRef
void setOperand(unsigned i, Value *Val)
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.
static void zap(Use *Start, const Use *Stop, bool del=false)
Destroys Use operands when the number of operands of a User changes.