Go to the documentation of this file.
18 #ifndef LLVM_IR_USER_H
19 #define LLVM_IR_USER_H
35 template <
typename T>
class ArrayRef;
36 template <
typename T>
class MutableArrayRef;
49 allocateFixedOperandUser(
size_t,
unsigned,
unsigned);
56 void *
operator new(
size_t Size);
61 void *
operator new(
size_t Size,
unsigned Us);
71 void *
operator new(
size_t Size,
unsigned Us,
unsigned DescBytes);
80 "Error in initializing hung off uses for User");
100 void operator delete(
void *Usr);
102 void operator delete(
void *Usr, unsigned) {
107 User::operator
delete(Usr);
109 #ifndef LLVM_ENABLE_EXCEPTIONS
114 void operator delete(
void *Usr, unsigned, unsigned) {
119 User::operator
delete(Usr);
121 #ifndef LLVM_ENABLE_EXCEPTIONS
134 return OpFrom<Idx>(
this);
136 template <
int Idx>
const Use &
Op()
const {
137 return OpFrom<Idx>(
this);
141 const Use *getHungOffOperands()
const {
142 return *(
reinterpret_cast<const Use *
const *
>(
this) - 1);
145 Use *&getHungOffOperands() {
return *(
reinterpret_cast<Use **
>(
this) - 1); }
147 const Use *getIntrusiveOperands()
const {
151 Use *getIntrusiveOperands() {
155 void setOperandList(Use *NewList) {
157 "Setting operand list only required for hung off uses");
158 getHungOffOperands() = NewList;
163 return HasHungOffUses ? getHungOffOperands() : getIntrusiveOperands();
177 isa<GlobalValue>((
const Value*)
this)) &&
178 "Cannot mutate a constant with setOperand!");
208 assert(NumOps <= 1 &&
"GlobalVariable can only have 0 or 1 operands");
252 std::random_access_iterator_tag, Value *,
253 ptrdiff_t, Value *, Value *> {
272 std::random_access_iterator_tag, const Value *,
273 ptrdiff_t, const Value *, const Value *> {
312 return isa<Instruction>(V) || isa<Constant>(V);
317 static_assert(
alignof(Use) >=
alignof(User),
318 "Alignment is insufficient after objects prepended to User");
319 static_assert(
alignof(Use *) >=
alignof(User),
320 "Alignment is insufficient after objects prepended to User");
339 #endif // LLVM_IR_USER_H
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
const_op_range operands() const
void dropAllReferences()
Drop all references to operands.
Use & getOperandUse(unsigned i)
static SimpleType getSimplifiedValue(User::op_iterator &Val)
The instances of the Type class are immutable: once they are created, they are never changed.
value_op_iterator value_op_begin()
CRTP base class for adapting an iterator to a different type.
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
iterator_range< op_iterator > op_range
void growHungoffUses(unsigned N, bool IsPhi=false)
Grow the number of hung off uses.
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
const Use & getOperandUse(unsigned i) const
Iterator for directly iterating over the operand Values.
Compile-time customization of User operands.
const_op_iterator op_begin() const
static SimpleType getSimplifiedValue(User::const_op_iterator &Val)
Value * operator*() const
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
Reference model for inliner Oz decision policy Note that
iterator_range< const_value_op_iterator > operand_values() const
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(const Use *U=nullptr)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
value_op_iterator(Use *U=nullptr)
bool isDroppable() const
A droppable user is a user for which uses can be dropped without affecting correctness and should be ...
const Value * operator*() const
void setOperand(unsigned i, Value *Val)
const Value * operator->() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
User(Type *ty, unsigned vty, Use *, unsigned NumOps)
const Use * getOperandList() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
value_op_iterator value_op_end()
const_op_iterator op_end() const
iterator_range< value_op_iterator > operand_values()
iterator_range< const_op_iterator > const_op_range
unsigned getNumOperands() const
A range adaptor for a pair of iterators.
BlockVerifier::State From
Value * getOperand(unsigned i) const
HungoffOperandTraits - determine the allocation regime of the Use array when it is not a prefix to th...
const_value_op_iterator value_op_begin() const
Value * operator->() const
LLVM Value Representation.
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
static bool classof(const Value *V)
static Use & OpFrom(const U *that)
A Use represents the edge between a Value definition and its users.
const_value_op_iterator value_op_end() const