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;
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
This is an optimization pass for GlobalISel generic memory operations.
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
we should consider alternate ways to model stack dependencies Lots of things could be done in WebAssemblyTargetTransformInfo cpp there are numerous optimization related hooks that can be overridden in WebAssemblyTargetLowering Instead of the OptimizeReturned which should consider preserving the returned attribute through to MachineInstrs and extending the MemIntrinsicResults pass to do this optimization on calls too That would also let the WebAssemblyPeephole pass clean up dead defs for such as it does for stores Consider implementing and or getMachineCombinerPatterns Find a clean way to fix the problem which leads to the Shrink Wrapping pass being run after the WebAssembly PEI pass When setting multiple variables to the same we currently get code like const It could be done with a smaller encoding like local tee $pop5 local $pop6 WebAssembly registers are implicitly initialized to zero Explicit zeroing is therefore often redundant and could be optimized away Small indices may use smaller encodings than large indices WebAssemblyRegColoring and or WebAssemblyRegRenumbering should sort registers according to their usage frequency to maximize the usage of smaller encodings Many cases of irreducible control flow could be transformed more optimally than via the transform in WebAssemblyFixIrreducibleControlFlow cpp It may also be worthwhile to do transforms before register particularly when duplicating to allow register coloring to be aware of the duplication WebAssemblyRegStackify could use AliasAnalysis to reorder loads and stores more aggressively WebAssemblyRegStackify is currently a greedy algorithm This means that
void growHungoffUses(unsigned N, bool IsPhi=false)
Grow the number of hung off uses.
class LLVM_NODISCARD MutableArrayRef
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
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...
ArrayRef< const uint8_t > getDescriptor() const
Returns the descriptor co-allocated with this User instance.
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())
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.
bool replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
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