LLVM  15.0.0git
VPlanValue.h
Go to the documentation of this file.
1 //===- VPlanValue.h - Represent Values in Vectorizer Plan -----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file contains the declarations of the entities induced by Vectorization
11 /// Plans, e.g. the instructions the VPlan intends to generate if executed.
12 /// VPlan models the following entities:
13 /// VPValue VPUser VPDef
14 /// | |
15 /// VPInstruction
16 /// These are documented in docs/VectorizationPlan.rst.
17 ///
18 //===----------------------------------------------------------------------===//
19 
20 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
21 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
22 
23 #include "llvm/ADT/DenseMap.h"
24 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/ADT/SmallVector.h"
26 #include "llvm/ADT/TinyPtrVector.h"
28 
29 namespace llvm {
30 
31 // Forward declarations.
32 class raw_ostream;
33 class Value;
34 class VPDef;
35 class VPSlotTracker;
36 class VPUser;
37 class VPRecipeBase;
38 class VPWidenMemoryInstructionRecipe;
39 
40 // This is the base class of the VPlan Def/Use graph, used for modeling the data
41 // flow into, within and out of the VPlan. VPValues can stand for live-ins
42 // coming from the input IR, instructions which VPlan will generate if executed
43 // and live-outs which the VPlan will need to fix accordingly.
44 class VPValue {
45  friend class VPBuilder;
46  friend class VPDef;
47  friend class VPInstruction;
48  friend struct VPlanTransforms;
49  friend class VPBasicBlock;
51  friend class VPSlotTracker;
52  friend class VPRecipeBase;
54 
55  const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
56 
58 
59 protected:
60  // Hold the underlying Value, if any, attached to this VPValue.
62 
63  /// Pointer to the VPDef that defines this VPValue. If it is nullptr, the
64  /// VPValue is not defined by any recipe modeled in VPlan.
66 
67  VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
68 
69  // DESIGN PRINCIPLE: Access to the underlying IR must be strictly limited to
70  // the front-end and back-end of VPlan so that the middle-end is as
71  // independent as possible of the underlying IR. We grant access to the
72  // underlying IR using friendship. In that way, we should be able to use VPlan
73  // for multiple underlying IRs (Polly?) by providing a new VPlan front-end,
74  // back-end and analysis information for the new IR.
75 
76  // Set \p Val as the underlying Value of this VPValue.
78  assert(!UnderlyingVal && "Underlying Value is already set.");
79  UnderlyingVal = Val;
80  }
81 
82 public:
83  /// Return the underlying Value attached to this VPValue.
85  const Value *getUnderlyingValue() const { return UnderlyingVal; }
86 
87  /// An enumeration for keeping track of the concrete subclass of VPValue that
88  /// are actually instantiated. Values of this enumeration are kept in the
89  /// SubclassID field of the VPValue objects. They are used for concrete
90  /// type identification.
91  enum {
102 
103  // Phi-like VPValues. Need to be kept together.
112  };
113 
114  VPValue(Value *UV = nullptr, VPDef *Def = nullptr)
115  : VPValue(VPValueSC, UV, Def) {}
116  VPValue(const VPValue &) = delete;
117  VPValue &operator=(const VPValue &) = delete;
118 
119  virtual ~VPValue();
120 
121  /// \return an ID for the concrete type of this object.
122  /// This is used to implement the classof checks. This should not be used
123  /// for any other purpose, as the values may change as LLVM evolves.
124  unsigned getVPValueID() const { return SubclassID; }
125 
126 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
127  void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
128  void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
129 
130  /// Dump the value to stderr (for debugging).
131  void dump() const;
132 #endif
133 
134  unsigned getNumUsers() const { return Users.size(); }
135  void addUser(VPUser &User) { Users.push_back(&User); }
136 
137  /// Remove a single \p User from the list of users.
139  bool Found = false;
140  // The same user can be added multiple times, e.g. because the same VPValue
141  // is used twice by the same VPUser. Remove a single one.
142  erase_if(Users, [&User, &Found](VPUser *Other) {
143  if (Found)
144  return false;
145  if (Other == &User) {
146  Found = true;
147  return true;
148  }
149  return false;
150  });
151  }
152 
157 
158  user_iterator user_begin() { return Users.begin(); }
159  const_user_iterator user_begin() const { return Users.begin(); }
160  user_iterator user_end() { return Users.end(); }
161  const_user_iterator user_end() const { return Users.end(); }
164  return const_user_range(user_begin(), user_end());
165  }
166 
167  /// Returns true if the value has more than one unique user.
169  if (getNumUsers() == 0)
170  return false;
171 
172  // Check if all users match the first user.
173  auto Current = std::next(user_begin());
174  while (Current != user_end() && *user_begin() == *Current)
175  Current++;
176  return Current != user_end();
177  }
178 
179  void replaceAllUsesWith(VPValue *New);
180 
181  VPDef *getDef() { return Def; }
182  const VPDef *getDef() const { return Def; }
183 
184  /// Returns the underlying IR value, if this VPValue is defined outside the
185  /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
186  /// inside a VPlan.
188  assert(!getDef() &&
189  "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
190  return getUnderlyingValue();
191  }
192  const Value *getLiveInIRValue() const {
193  assert(!getDef() &&
194  "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
195  return getUnderlyingValue();
196  }
197 };
198 
201 
202 raw_ostream &operator<<(raw_ostream &OS, const VPValue &V);
203 
204 /// This class augments VPValue with operands which provide the inverse def-use
205 /// edges from VPValue's users to their defs.
206 class VPUser {
207 public:
208  /// Subclass identifier (for isa/dyn_cast).
209  enum class VPUserID {
210  Recipe,
211  LiveOut,
212  };
213 
214 private:
215  SmallVector<VPValue *, 2> Operands;
216 
217  VPUserID ID;
218 
219 protected:
220 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
221  /// Print the operands to \p O.
223 #endif
224 
226  for (VPValue *Operand : Operands)
227  addOperand(Operand);
228  }
229 
230  VPUser(std::initializer_list<VPValue *> Operands, VPUserID ID)
231  : VPUser(ArrayRef<VPValue *>(Operands), ID) {}
232 
233  template <typename IterT>
235  for (VPValue *Operand : Operands)
236  addOperand(Operand);
237  }
238 
239 public:
240  VPUser() = delete;
241  VPUser(const VPUser &) = delete;
242  VPUser &operator=(const VPUser &) = delete;
243  virtual ~VPUser() {
244  for (VPValue *Op : operands())
245  Op->removeUser(*this);
246  }
247 
248  VPUserID getVPUserID() const { return ID; }
249 
250  void addOperand(VPValue *Operand) {
251  Operands.push_back(Operand);
252  Operand->addUser(*this);
253  }
254 
255  unsigned getNumOperands() const { return Operands.size(); }
256  inline VPValue *getOperand(unsigned N) const {
257  assert(N < Operands.size() && "Operand index out of bounds");
258  return Operands[N];
259  }
260 
261  void setOperand(unsigned I, VPValue *New) {
262  Operands[I]->removeUser(*this);
263  Operands[I] = New;
264  New->addUser(*this);
265  }
266 
268  VPValue *Op = Operands.pop_back_val();
269  Op->removeUser(*this);
270  }
271 
276 
277  operand_iterator op_begin() { return Operands.begin(); }
278  const_operand_iterator op_begin() const { return Operands.begin(); }
279  operand_iterator op_end() { return Operands.end(); }
280  const_operand_iterator op_end() const { return Operands.end(); }
283  return const_operand_range(op_begin(), op_end());
284  }
285 
286  /// Method to support type inquiry through isa, cast, and dyn_cast.
287  static inline bool classof(const VPDef *Recipe);
288 
289  /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
290  /// returns if only first (scalar) lane is used, as default.
291  virtual bool usesScalars(const VPValue *Op) const {
293  "Op must be an operand of the recipe");
294  return onlyFirstLaneUsed(Op);
295  }
296 
297  /// Returns true if the VPUser only uses the first lane of operand \p Op.
298  /// Conservatively returns false.
299  virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
301  "Op must be an operand of the recipe");
302  return false;
303  }
304 };
305 
306 /// This class augments a recipe with a set of VPValues defined by the recipe.
307 /// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
308 /// the VPValues it defines and is responsible for deleting its defined values.
309 /// Single-value VPDefs that also inherit from VPValue must make sure to inherit
310 /// from VPDef before VPValue.
311 class VPDef {
312  friend class VPValue;
313 
314  /// Subclass identifier (for isa/dyn_cast).
315  const unsigned char SubclassID;
316 
317  /// The VPValues defined by this VPDef.
318  TinyPtrVector<VPValue *> DefinedValues;
319 
320  /// Add \p V as a defined value by this VPDef.
321  void addDefinedValue(VPValue *V) {
322  assert(V->getDef() == this &&
323  "can only add VPValue already linked with this VPDef");
324  DefinedValues.push_back(V);
325  }
326 
327  /// Remove \p V from the values defined by this VPDef. \p V must be a defined
328  /// value of this VPDef.
329  void removeDefinedValue(VPValue *V) {
330  assert(V->getDef() == this &&
331  "can only remove VPValue linked with this VPDef");
332  assert(is_contained(DefinedValues, V) &&
333  "VPValue to remove must be in DefinedValues");
334  erase_value(DefinedValues, V);
335  V->Def = nullptr;
336  }
337 
338 public:
339  /// An enumeration for keeping track of the concrete subclass of VPRecipeBase
340  /// that is actually instantiated. Values of this enumeration are kept in the
341  /// SubclassID field of the VPRecipeBase objects. They are used for concrete
342  /// type identification.
343  using VPRecipeTy = enum {
344  VPBranchOnMaskSC,
345  VPExpandSCEVSC,
346  VPInstructionSC,
347  VPInterleaveSC,
348  VPReductionSC,
349  VPReplicateSC,
350  VPScalarIVStepsSC,
351  VPWidenCallSC,
352  VPWidenCanonicalIVSC,
353  VPWidenGEPSC,
354  VPWidenMemoryInstructionSC,
355  VPWidenSC,
356  VPWidenSelectSC,
357 
358  // Phi-like recipes. Need to be kept together.
359  VPBlendSC,
360  VPCanonicalIVPHISC,
361  VPFirstOrderRecurrencePHISC,
362  VPWidenPHISC,
363  VPWidenIntOrFpInductionSC,
364  VPWidenPointerInductionSC,
365  VPPredInstPHISC,
366  VPReductionPHISC,
367  VPFirstPHISC = VPBlendSC,
368  VPLastPHISC = VPReductionPHISC,
369  };
370 
371  VPDef(const unsigned char SC) : SubclassID(SC) {}
372 
373  virtual ~VPDef() {
374  for (VPValue *D : make_early_inc_range(DefinedValues)) {
375  assert(D->Def == this &&
376  "all defined VPValues should point to the containing VPDef");
377  assert(D->getNumUsers() == 0 &&
378  "all defined VPValues should have no more users");
379  D->Def = nullptr;
380  delete D;
381  }
382  }
383 
384  /// Returns the only VPValue defined by the VPDef. Can only be called for
385  /// VPDefs with a single defined value.
387  assert(DefinedValues.size() == 1 && "must have exactly one defined value");
388  assert(DefinedValues[0] && "defined value must be non-null");
389  return DefinedValues[0];
390  }
391  const VPValue *getVPSingleValue() const {
392  assert(DefinedValues.size() == 1 && "must have exactly one defined value");
393  assert(DefinedValues[0] && "defined value must be non-null");
394  return DefinedValues[0];
395  }
396 
397  /// Returns the VPValue with index \p I defined by the VPDef.
398  VPValue *getVPValue(unsigned I) {
399  assert(DefinedValues[I] && "defined value must be non-null");
400  return DefinedValues[I];
401  }
402  const VPValue *getVPValue(unsigned I) const {
403  assert(DefinedValues[I] && "defined value must be non-null");
404  return DefinedValues[I];
405  }
406 
407  /// Returns an ArrayRef of the values defined by the VPDef.
408  ArrayRef<VPValue *> definedValues() { return DefinedValues; }
409  /// Returns an ArrayRef of the values defined by the VPDef.
410  ArrayRef<VPValue *> definedValues() const { return DefinedValues; }
411 
412  /// Returns the number of values defined by the VPDef.
413  unsigned getNumDefinedValues() const { return DefinedValues.size(); }
414 
415  /// \return an ID for the concrete type of this object.
416  /// This is used to implement the classof checks. This should not be used
417  /// for any other purpose, as the values may change as LLVM evolves.
418  unsigned getVPDefID() const { return SubclassID; }
419 
420 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
421  /// Dump the VPDef to stderr (for debugging).
422  void dump() const;
423 
424  /// Each concrete VPDef prints itself.
425  virtual void print(raw_ostream &O, const Twine &Indent,
426  VPSlotTracker &SlotTracker) const = 0;
427 #endif
428 };
429 
430 class VPlan;
431 class VPBasicBlock;
432 
433 /// This class can be used to assign consecutive numbers to all VPValues in a
434 /// VPlan and allows querying the numbering for printing, similar to the
435 /// ModuleSlotTracker for IR values.
438  unsigned NextSlot = 0;
439 
440  void assignSlot(const VPValue *V);
441  void assignSlots(const VPlan &Plan);
442 
443 public:
444  VPSlotTracker(const VPlan *Plan = nullptr) {
445  if (Plan)
446  assignSlots(*Plan);
447  }
448 
449  unsigned getSlot(const VPValue *V) const {
450  auto I = Slots.find(V);
451  if (I == Slots.end())
452  return -1;
453  return I->second;
454  }
455 };
456 
457 } // namespace llvm
458 
459 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
llvm::VPUser::getVPUserID
VPUserID getVPUserID() const
Definition: VPlanValue.h:248
llvm::VPUser::op_end
operand_iterator op_end()
Definition: VPlanValue.h:279
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::VPUser::VPUser
VPUser(iterator_range< IterT > Operands, VPUserID ID)
Definition: VPlanValue.h:234
llvm::VPValue::user_end
const_user_iterator user_end() const
Definition: VPlanValue.h:161
llvm::VPValue::getDef
const VPDef * getDef() const
Definition: VPlanValue.h:182
llvm::VPUser::removeLastOperand
void removeLastOperand()
Definition: VPlanValue.h:267
llvm::VPBasicBlock
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:1938
llvm::VPValue::user_iterator
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition: VPlanValue.h:153
llvm::VPValue::VPVInstructionSC
@ VPVInstructionSC
Definition: VPlanValue.h:93
llvm::VPValue::getLiveInIRValue
Value * getLiveInIRValue()
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
Definition: VPlanValue.h:187
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1185
llvm::VPDef::getVPSingleValue
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition: VPlanValue.h:386
llvm::VPInterleavedAccessInfo
Definition: VPlan.h:2836
llvm::VPDef::print
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
llvm::VPValue::user_range
iterator_range< user_iterator > user_range
Definition: VPlanValue.h:155
llvm::erase_if
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
Definition: STLExtras.h:1807
llvm::VPValue::operator=
VPValue & operator=(const VPValue &)=delete
DenseMap.h
llvm::VPValue::dump
void dump() const
Dump the value to stderr (for debugging).
Definition: VPlan.cpp:96
llvm::VPUser::op_begin
operand_iterator op_begin()
Definition: VPlanValue.h:277
llvm::VPDef::VPDef
VPDef(const unsigned char SC)
Definition: VPlanValue.h:371
llvm::VPDef::getVPSingleValue
const VPValue * getVPSingleValue() const
Definition: VPlanValue.h:391
llvm::VPValue::print
void print(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:89
STLExtras.h
llvm::VPUser::operands
operand_range operands()
Definition: VPlanValue.h:281
llvm::VPUser::VPUserID
VPUserID
Subclass identifier (for isa/dyn_cast).
Definition: VPlanValue.h:209
llvm::VPValue::VPVWidenSC
@ VPVWidenSC
Definition: VPlanValue.h:97
llvm::VPValue::VPValue
VPValue(const unsigned char SC, Value *UV=nullptr, VPDef *Def=nullptr)
Definition: VPlan.cpp:76
llvm::VPUser::const_operand_iterator
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition: VPlanValue.h:273
llvm::VPValue::users
user_range users()
Definition: VPlanValue.h:162
llvm::VPValue::VPVReductionSC
@ VPVReductionSC
Definition: VPlanValue.h:95
llvm::VPDef
This class augments a recipe with a set of VPValues defined by the recipe.
Definition: VPlanValue.h:311
llvm::VPUser::VPUser
VPUser(std::initializer_list< VPValue * > Operands, VPUserID ID)
Definition: VPlanValue.h:230
llvm::VPInstruction
This is a concrete Recipe that models a single VPlan-level instruction.
Definition: VPlan.h:742
llvm::VPUser::op_end
const_operand_iterator op_end() const
Definition: VPlanValue.h:280
llvm::PPCISD::SC
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
Definition: PPCISelLowering.h:418
llvm::VPBuilder
VPlan-based builder utility analogous to IRBuilder.
Definition: LoopVectorizationPlanner.h:44
llvm::User
Definition: User.h:44
llvm::VPValue::addUser
void addUser(VPUser &User)
Definition: VPlanValue.h:135
llvm::VPDef::definedValues
ArrayRef< VPValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:410
llvm::TinyPtrVector::push_back
void push_back(EltTy NewVal)
Definition: TinyPtrVector.h:244
llvm::VPUser::VPUserID::Recipe
@ Recipe
llvm::VPValue::VPVWidenPointerInductionSC
@ VPVWidenPointerInductionSC
Definition: VPlanValue.h:109
llvm::VPValue::replaceAllUsesWith
void replaceAllUsesWith(VPValue *New)
Definition: VPlan.cpp:1711
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::VPValue::VPVFirstOrderRecurrencePHISC
@ VPVFirstOrderRecurrencePHISC
Definition: VPlanValue.h:106
llvm::VPValue::VPVWidenPHISC
@ VPVWidenPHISC
Definition: VPlanValue.h:107
llvm::VPValue
Definition: VPlanValue.h:44
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::VPDef::getNumDefinedValues
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition: VPlanValue.h:413
llvm::VPValue::VPValueSC
@ VPValueSC
Definition: VPlanValue.h:92
llvm::VPValue::getUnderlyingValue
const Value * getUnderlyingValue() const
Definition: VPlanValue.h:85
llvm::VPValue::users
const_user_range users() const
Definition: VPlanValue.h:163
llvm::VPUser::getNumOperands
unsigned getNumOperands() const
Definition: VPlanValue.h:255
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::erase_value
void erase_value(Container &C, ValueType V)
Wrapper function to remove a value from a container:
Definition: STLExtras.h:1815
llvm::VPValue::VPVBlendSC
@ VPVBlendSC
Definition: VPlanValue.h:104
llvm::VPValue::VPVWidenSelectSC
@ VPVWidenSelectSC
Definition: VPlanValue.h:101
llvm::VPValue::getLiveInIRValue
const Value * getLiveInIRValue() const
Definition: VPlanValue.h:192
llvm::VPValue::VPVReductionPHISC
@ VPVReductionPHISC
Definition: VPlanValue.h:111
Operands
mir Rename Register Operands
Definition: MIRNamerPass.cpp:74
llvm::VPUser::setOperand
void setOperand(unsigned I, VPValue *New)
Definition: VPlanValue.h:261
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
llvm::VPValue::Def
VPDef * Def
Pointer to the VPDef that defines this VPValue.
Definition: VPlanValue.h:65
llvm::VPSlotTracker::getSlot
unsigned getSlot(const VPValue *V) const
Definition: VPlanValue.h:449
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::DenseMap< Value *, VPValue * >
llvm::VPValue::getNumUsers
unsigned getNumUsers() const
Definition: VPlanValue.h:134
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::make_early_inc_range
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Definition: STLExtras.h:618
llvm::VPUser::op_begin
const_operand_iterator op_begin() const
Definition: VPlanValue.h:278
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1682
llvm::VPValue::user_end
user_iterator user_end()
Definition: VPlanValue.h:160
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:152
llvm::SmallVectorImpl::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:559
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::VPValue::user_begin
const_user_iterator user_begin() const
Definition: VPlanValue.h:159
iterator_range.h
llvm::Value2VPValueTy
DenseMap< Value *, VPValue * > Value2VPValueTy
Definition: VPlanValue.h:199
llvm::VPUser::printOperands
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition: VPlan.cpp:1742
llvm::VPWidenMemoryInstructionRecipe
A Recipe for widening load/store operations.
Definition: VPlan.h:1663
TinyPtrVector.h
llvm::VPSlotTracker::VPSlotTracker
VPSlotTracker(const VPlan *Plan=nullptr)
Definition: VPlanValue.h:444
llvm::VPValue::VPVWidenCallSC
@ VPVWidenCallSC
Definition: VPlanValue.h:98
llvm::VPValue::user_begin
user_iterator user_begin()
Definition: VPlanValue.h:158
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::TinyPtrVector::size
unsigned size() const
Definition: TinyPtrVector.h:172
llvm::VPUser::~VPUser
virtual ~VPUser()
Definition: VPlanValue.h:243
llvm::VPUser::addOperand
void addOperand(VPValue *Operand)
Definition: VPlanValue.h:250
llvm::VPUser::onlyFirstLaneUsed
virtual bool onlyFirstLaneUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition: VPlanValue.h:299
llvm::VPDef::getVPValue
const VPValue * getVPValue(unsigned I) const
Definition: VPlanValue.h:402
llvm::VPDef::getVPValue
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
Definition: VPlanValue.h:398
llvm::VPValue::setUnderlyingValue
void setUnderlyingValue(Value *Val)
Definition: VPlanValue.h:77
llvm::VPUser::operand_range
iterator_range< operand_iterator > operand_range
Definition: VPlanValue.h:274
llvm::VPUser::operand_iterator
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition: VPlanValue.h:272
llvm::VPUser::classof
static bool classof(const VPDef *Recipe)
Method to support type inquiry through isa, cast, and dyn_cast.
Definition: VPlan.h:724
llvm::VPDef::dump
void dump() const
Dump the VPDef to stderr (for debugging).
Definition: VPlan.cpp:104
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::VPSlotTracker
This class can be used to assign consecutive numbers to all VPValues in a VPlan and allows querying t...
Definition: VPlanValue.h:436
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::end
iterator end()
Definition: DenseMap.h:84
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:345
llvm::VPValue::getDef
VPDef * getDef()
Definition: VPlanValue.h:181
llvm::VPUser::VPUser
VPUser(ArrayRef< VPValue * > Operands, VPUserID ID)
Definition: VPlanValue.h:225
llvm::VPRecipeBase
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition: VPlan.h:630
llvm::VPUser::operator=
VPUser & operator=(const VPUser &)=delete
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::VPValue::UnderlyingVal
Value * UnderlyingVal
Definition: VPlanValue.h:61
llvm::SlotTracker
This class provides computation of slot numbers for LLVM Assembly writing.
Definition: AsmWriter.cpp:656
llvm::VPValue::const_user_range
iterator_range< const_user_iterator > const_user_range
Definition: VPlanValue.h:156
llvm::VPValue2ValueTy
DenseMap< VPValue *, Value * > VPValue2ValueTy
Definition: VPlanValue.h:200
llvm::VPValue::hasMoreThanOneUniqueUser
bool hasMoreThanOneUniqueUser()
Returns true if the value has more than one unique user.
Definition: VPlanValue.h:168
llvm::VPDef::VPRecipeTy
enum { VPBranchOnMaskSC, VPExpandSCEVSC, VPInstructionSC, VPInterleaveSC, VPReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenGEPSC, VPWidenMemoryInstructionSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPCanonicalIVPHISC, VPFirstOrderRecurrencePHISC, VPWidenPHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPPredInstPHISC, VPReductionPHISC, VPFirstPHISC=VPBlendSC, VPLastPHISC=VPReductionPHISC, } VPRecipeTy
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiat...
Definition: VPlanValue.h:369
llvm::VPUser::VPUserID::LiveOut
@ LiveOut
llvm::VPUser
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
Definition: VPlanValue.h:206
llvm::VPlanTransforms
Definition: VPlanTransforms.h:27
SmallVector.h
llvm::VPValue::VPVPredInstPHI
@ VPVPredInstPHI
Definition: VPlanValue.h:110
llvm::SmallVectorImpl::iterator
typename SuperClass::iterator iterator
Definition: SmallVector.h:558
llvm::VPUser::getOperand
VPValue * getOperand(unsigned N) const
Definition: VPlanValue.h:256
N
#define N
Users
iv Induction Variable Users
Definition: IVUsers.cpp:48
llvm::VPUser::VPUser
VPUser()=delete
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::VPValue::VPVReplicateSC
@ VPVReplicateSC
Definition: VPlanValue.h:96
llvm::VPDef::definedValues
ArrayRef< VPValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:408
llvm::VPUser::usesScalars
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition: VPlanValue.h:291
llvm::VPValue::getVPValueID
unsigned getVPValueID() const
Definition: VPlanValue.h:124
llvm::VPValue::VPVWidenIntOrFpInductionSC
@ VPVWidenIntOrFpInductionSC
Definition: VPlanValue.h:108
llvm::VPDef::~VPDef
virtual ~VPDef()
Definition: VPlanValue.h:373
llvm::VPUser::operands
const_operand_range operands() const
Definition: VPlanValue.h:282
llvm::VPValue::removeUser
void removeUser(VPUser &User)
Remove a single User from the list of users.
Definition: VPlanValue.h:138
llvm::VPValue::VPValue
VPValue(Value *UV=nullptr, VPDef *Def=nullptr)
Definition: VPlanValue.h:114
llvm::VPValue::~VPValue
virtual ~VPValue()
Definition: VPlan.cpp:82
llvm::TinyPtrVector
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Definition: TinyPtrVector.h:30
llvm::VPValue::VPVWidenGEPSC
@ VPVWidenGEPSC
Definition: VPlanValue.h:100
llvm::VPValue::VPVCanonicalIVPHISC
@ VPVCanonicalIVPHISC
Definition: VPlanValue.h:105
llvm::VPValue::VPVMemoryInstructionSC
@ VPVMemoryInstructionSC
Definition: VPlanValue.h:94
llvm::VPDef::getVPDefID
unsigned getVPDefID() const
Definition: VPlanValue.h:418
llvm::VPValue::getUnderlyingValue
Value * getUnderlyingValue()
Return the underlying Value attached to this VPValue.
Definition: VPlanValue.h:84
llvm::VPValue::const_user_iterator
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition: VPlanValue.h:154
llvm::VPlan
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:2417
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::VPValue::VPVWidenCanonicalIVSC
@ VPVWidenCanonicalIVSC
Definition: VPlanValue.h:99
llvm::VPValue::printAsOperand
void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:1727
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1236
llvm::VPUser::const_operand_range
iterator_range< const_operand_iterator > const_operand_range
Definition: VPlanValue.h:275