19 #ifndef LLVM_IR_USER_H 20 #define LLVM_IR_USER_H 36 template <
typename T>
class ArrayRef;
37 template <
typename T>
class MutableArrayRef;
50 allocateFixedOperandUser(
size_t,
unsigned,
unsigned);
57 void *
operator new(
size_t Size);
62 void *
operator new(
size_t Size,
unsigned Us);
72 void *
operator new(
size_t Size,
unsigned Us,
unsigned DescBytes);
81 "Error in initializing hung off uses for User");
101 void operator delete(
void *Usr);
108 User::operator
delete(Usr);
110 #ifndef LLVM_ENABLE_EXCEPTIONS 120 User::operator
delete(Usr);
122 #ifndef LLVM_ENABLE_EXCEPTIONS 128 template <
int Idx,
typename U>
static Use &
OpFrom(
const U *that) {
135 return OpFrom<Idx>(
this);
137 template <
int Idx>
const Use &
Op()
const {
138 return OpFrom<Idx>(
this);
142 const Use *getHungOffOperands()
const {
143 return *(
reinterpret_cast<const Use *
const *
>(
this) - 1);
146 Use *&getHungOffOperands() {
return *(
reinterpret_cast<Use **
>(
this) - 1); }
148 const Use *getIntrusiveOperands()
const {
152 Use *getIntrusiveOperands() {
156 void setOperandList(
Use *NewList) {
158 "Setting operand list only required for hung off uses");
159 getHungOffOperands() = NewList;
164 return HasHungOffUses ? getHungOffOperands() : getIntrusiveOperands();
178 isa<GlobalValue>((
const Value*)
this)) &&
179 "Cannot mutate a constant with setOperand!");
209 assert(NumOps <= 1 &&
"GlobalVariable can only have 0 or 1 operands");
248 std::random_access_iterator_tag, Value *,
249 ptrdiff_t, Value *, Value *> {
268 std::random_access_iterator_tag, const Value *,
269 ptrdiff_t, const Value *, const Value *> {
308 return isa<Instruction>(V) || isa<Constant>(V);
313 static_assert(
alignof(
Use) >=
alignof(
User),
314 "Alignment is insufficient after objects prepended to User");
315 static_assert(
alignof(
Use *) >=
alignof(
User),
316 "Alignment is insufficient after objects prepended to User");
335 #endif // LLVM_IR_USER_H static Use & OpFrom(const U *that)
const_value_op_iterator value_op_begin() const
void dropAllReferences()
Drop all references to operands.
const_op_iterator op_begin() const
This class represents lattice values for constants.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
value_op_iterator value_op_begin()
iterator_range< op_iterator > op_range
Use & getOperandUse(unsigned i)
const Use & getOperandUse(unsigned i) const
value_op_iterator value_op_end()
This defines the Use class.
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.
iterator_range< const_op_iterator > const_op_range
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
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
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.
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
const_op_iterator op_end() const
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
static SimpleType getSimplifiedValue(User::const_op_iterator &Val)
Value * operator->() const
#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.
unsigned getNumOperands() const
BlockVerifier::State From
User(Type *ty, unsigned vty, Use *, unsigned NumOps)
void setOperand(unsigned i, Value *Val)
A range adaptor for a pair of iterators.
Value * operator*() const
const Use * const_op_iterator
iterator_range< value_op_iterator > operand_values()
Compile-time customization of User operands.
iterator_range< const_value_op_iterator > operand_values() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const Value * operator->() const
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.
const_value_op_iterator value_op_end() const
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
const Value * operator*() const
static SimpleType getSimplifiedValue(User::op_iterator &Val)
const_op_range operands() const
value_op_iterator(Use *U=nullptr)