19 #ifndef LLVM_IR_USER_H
20 #define LLVM_IR_USER_H
36 template <
typename T>
class ArrayRef;
37 template <
typename T>
class MutableArrayRef;
49 virtual void anchor();
52 allocateFixedOperandUser(
size_t,
unsigned,
unsigned);
59 void *
operator new(
size_t Size);
64 void *
operator new(
size_t Size,
unsigned Us);
74 void *
operator new(
size_t Size,
unsigned Us,
unsigned DescBytes);
83 "Error in initializing hung off uses for User");
98 ~User()
override =
default;
101 void operator delete(
void *Usr);
112 template <
int Idx,
typename U>
static Use &
OpFrom(
const U *that) {
118 return OpFrom<Idx>(
this);
120 template <
int Idx>
const Use &
Op()
const {
121 return OpFrom<Idx>(
this);
125 Use *&getHungOffOperands() {
return *(
reinterpret_cast<Use **
>(
this) - 1); }
127 Use *getIntrusiveOperands() {
131 void setOperandList(Use *NewList) {
133 "Setting operand list only required for hung off uses");
134 getHungOffOperands() = NewList;
139 return HasHungOffUses ? getHungOffOperands() : getIntrusiveOperands();
153 isa<GlobalValue>((
const Value*)
this)) &&
154 "Cannot mutate a constant with setOperand!");
184 assert(NumOps <= 1 &&
"GlobalVariable can only have 0 or 1 operands");
223 std::random_access_iterator_tag, Value *,
224 ptrdiff_t, Value *, Value *> {
243 std::random_access_iterator_tag, const Value *,
244 ptrdiff_t, const Value *, const Value *> {
282 return isa<Instruction>(V) || isa<Constant>(V);
286 static_assert(
alignof(Use) >=
alignof(User),
287 "Alignment is insufficient after objects prepended to User");
288 static_assert(
alignof(Use *) >=
alignof(User),
289 "Alignment is insufficient after objects prepended to User");
306 #endif // LLVM_IR_USER_H
static Use & OpFrom(const U *that)
const Use & getOperandUse(unsigned i) const
const_value_op_iterator value_op_end() const
const Value * operator->() const
void dropAllReferences()
Drop all references to operands.
unsigned getNumOperands() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
value_op_iterator value_op_begin()
Use & getOperandUse(unsigned i)
const_value_op_iterator value_op_begin() const
value_op_iterator value_op_end()
iterator_range< op_iterator > op_range
This defines the Use class.
const_op_range operands() const
const Use * getOperandList() const
const Value * operator*() const
static bool classof(const Value *V)
const_value_op_iterator(const Use *U=nullptr)
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.
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
const_op_iterator op_end() const
iterator_range< const_value_op_iterator > operand_values() const
const_op_iterator op_begin() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
Value * operator->() const
The instances of the Type class are immutable: once they are created, they are never changed...
CRTP base class for adapting an iterator to a different type.
Value * getOperand(unsigned i) const
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
static SimpleType getSimplifiedValue(User::const_op_iterator &Val)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Iterator for directly iterating over the operand Values.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
User(Type *ty, unsigned vty, Use *, unsigned NumOps)
void setOperand(unsigned i, Value *Val)
A range adaptor for a pair of iterators.
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
iterator_range< const_op_iterator > const_op_range
iterator_range< value_op_iterator > operand_values()
Compile-time customization of User operands.
Value * operator*() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
HungoffOperandTraits - determine the allocation regime of the Use array when it is not a prefix to th...
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
static SimpleType getSimplifiedValue(User::op_iterator &Val)
value_op_iterator(Use *U=nullptr)
const Use * const_op_iterator