LLVM 23.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/STLExtras.h"
27#include "llvm/IR/Constants.h"
30
31namespace llvm {
32
33// Forward declarations.
34class raw_ostream;
35class Type;
36class Value;
37class VPDef;
38struct VPDoubleValueDef;
39class VPSlotTracker;
40class VPUser;
41class VPRecipeBase;
42class VPPhiAccessors;
43
44/// This is the base class of the VPlan Def/Use graph, used for modeling the
45/// data flow into, within and out of the VPlan. VPValues can stand for live-ins
46/// coming from the input IR, symbolic values and values defined by recipes.
47class LLVM_ABI_FOR_TEST VPValue {
48 friend class VPDef;
49 friend struct VPDoubleValueDef;
50 friend class VPlan;
51 friend struct VPIRValue;
52 friend struct VPSymbolicValue;
53 friend class VPRecipeValue;
54
55 const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
56
58
59 /// Hold the underlying Value, if any, attached to this VPValue.
60 Value *UnderlyingVal;
61
62 VPValue(const unsigned char SC, Value *UV = nullptr)
63 : SubclassID(SC), UnderlyingVal(UV) {}
64
65 // DESIGN PRINCIPLE: Access to the underlying IR must be strictly limited to
66 // the front-end and back-end of VPlan so that the middle-end is as
67 // independent as possible of the underlying IR. We grant access to the
68 // underlying IR using friendship. In that way, we should be able to use VPlan
69 // for multiple underlying IRs (Polly?) by providing a new VPlan front-end,
70 // back-end and analysis information for the new IR.
71
72public:
73 /// Return the underlying Value attached to this VPValue.
74 Value *getUnderlyingValue() const { return UnderlyingVal; }
75
76 /// Return the underlying IR value for a VPIRValue.
77 Value *getLiveInIRValue() const;
78
79 /// An enumeration for keeping track of the concrete subclass of VPValue that
80 /// are actually instantiated.
81 enum {
82 VPVIRValueSC, /// A live-in VPValue wrapping an IR Value.
83 VPVSymbolicSC, /// A symbolic live-in VPValue without IR backing.
84 VPVRecipeValueSC, /// A VPValue defined by a recipe.
85 };
86
87 VPValue(const VPValue &) = delete;
88 VPValue &operator=(const VPValue &) = delete;
89
90 virtual ~VPValue() {
91 assert(Users.empty() && "trying to delete a VPValue with remaining users");
92 }
93
94 /// \return an ID for the concrete type of this object.
95 /// This is used to implement the classof checks. This should not be used
96 /// for any other purpose, as the values may change as LLVM evolves.
97 unsigned getVPValueID() const { return SubclassID; }
98
99#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
100 void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
101 void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
102
103 /// Dump the value to stderr (for debugging).
104 void dump() const;
105#endif
106
107 unsigned getNumUsers() const { return Users.size(); }
108 void addUser(VPUser &User) { Users.push_back(&User); }
109
110 /// Remove a single \p User from the list of users.
112 // The same user can be added multiple times, e.g. because the same VPValue
113 // is used twice by the same VPUser. Remove a single one.
114 auto *I = find(Users, &User);
115 if (I != Users.end())
116 Users.erase(I);
117 }
118
123
124 user_iterator user_begin() { return Users.begin(); }
125 const_user_iterator user_begin() const { return Users.begin(); }
126 user_iterator user_end() { return Users.end(); }
127 const_user_iterator user_end() const { return Users.end(); }
131 }
132
133 /// Returns true if the value has more than one unique user.
135 if (getNumUsers() == 0)
136 return false;
137
138 // Check if all users match the first user.
139 auto Current = std::next(user_begin());
140 while (Current != user_end() && *user_begin() == *Current)
141 Current++;
142 return Current != user_end();
143 }
144
145 bool hasOneUse() const { return getNumUsers() == 1; }
146
147 /// Return the single user of this value, or nullptr if there is not exactly
148 /// one user.
149 VPUser *getSingleUser() { return hasOneUse() ? *user_begin() : nullptr; }
150 const VPUser *getSingleUser() const {
151 return hasOneUse() ? *user_begin() : nullptr;
152 }
153
154 void replaceAllUsesWith(VPValue *New);
155
156 /// Go through the uses list for this VPValue and make each use point to \p
157 /// New if the callback ShouldReplace returns true for the given use specified
158 /// by a pair of (VPUser, the use index).
159 void replaceUsesWithIf(
160 VPValue *New,
161 llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
162
163 /// Returns the recipe defining this VPValue or nullptr if it is not defined
164 /// by a recipe, i.e. is a live-in.
165 VPRecipeBase *getDefiningRecipe();
166 const VPRecipeBase *getDefiningRecipe() const;
167
168 /// Returns true if this VPValue is defined by a recipe.
169 bool hasDefiningRecipe() const { return getDefiningRecipe(); }
170
171 /// Returns true if the VPValue is defined outside any loop.
172 bool isDefinedOutsideLoopRegions() const;
173
174 // Set \p Val as the underlying Value of this VPValue.
176 assert(!UnderlyingVal && "Underlying Value is already set.");
177 UnderlyingVal = Val;
178 }
179};
180
181LLVM_ABI_FOR_TEST raw_ostream &operator<<(raw_ostream &OS,
182 const VPRecipeBase &R);
183
184/// A VPValue representing a live-in from the input IR or a constant. It wraps
185/// an underlying IR Value.
186struct VPIRValue : public VPValue {
187 VPIRValue(Value *UV) : VPValue(VPVIRValueSC, UV) {
188 assert(UV && "VPIRValue requires an underlying IR value");
189 }
190
191 /// Returns the underlying IR value.
192 Value *getValue() const { return getUnderlyingValue(); }
193
194 /// Returns the type of the underlying IR value.
195 Type *getType() const;
196
197 static bool classof(const VPValue *V) {
198 return V->getVPValueID() == VPVIRValueSC;
199 }
200};
201
202/// An overlay on VPIRValue for VPValues that wrap a ConstantInt. Provides
203/// convenient accessors for the underlying constant.
204struct VPConstantInt : public VPIRValue {
206
207 static bool classof(const VPValue *V) {
208 return isa<VPIRValue>(V) && isa<ConstantInt>(V->getUnderlyingValue());
209 }
210
211 bool isOne() const { return getAPInt().isOne(); }
212
213 bool isZero() const { return getAPInt().isZero(); }
214
215 const APInt &getAPInt() const {
216 return cast<ConstantInt>(getValue())->getValue();
217 }
218
219 unsigned getBitWidth() const { return getAPInt().getBitWidth(); }
220
222};
223
224/// A symbolic live-in VPValue, used for values like vector trip count, VF, and
225/// VFxUF.
226struct VPSymbolicValue : public VPValue {
227 VPSymbolicValue() : VPValue(VPVSymbolicSC, nullptr) {}
228
229 static bool classof(const VPValue *V) {
230 return V->getVPValueID() == VPVSymbolicSC;
231 }
232};
233
234/// A VPValue defined by a recipe that produces one or more values.
235class VPRecipeValue : public VPValue {
236 friend class VPValue;
237 friend class VPDef;
238 /// Pointer to the VPDef that defines this VPValue.
239 VPDef *Def;
240
241public:
242 LLVM_ABI_FOR_TEST VPRecipeValue(VPDef *Def, Value *UV = nullptr);
243
245
246 static bool classof(const VPValue *V) {
247 return V->getVPValueID() == VPVRecipeValueSC;
248 }
249};
250
251/// This class augments VPValue with operands which provide the inverse def-use
252/// edges from VPValue's users to their defs.
253class VPUser {
254 /// Grant access to removeOperand for VPPhiAccessors, the only supported user.
255 friend class VPPhiAccessors;
256
258
259 /// Removes the operand at index \p Idx. This also removes the VPUser from the
260 /// use-list of the operand.
261 void removeOperand(unsigned Idx) {
262 getOperand(Idx)->removeUser(*this);
263 Operands.erase(Operands.begin() + Idx);
264 }
265
266protected:
267#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
268 /// Print the operands to \p O.
270#endif
271
273 for (VPValue *Operand : Operands)
274 addOperand(Operand);
275 }
276
277public:
278 VPUser() = delete;
279 VPUser(const VPUser &) = delete;
280 VPUser &operator=(const VPUser &) = delete;
281 virtual ~VPUser() {
282 for (VPValue *Op : operands())
283 Op->removeUser(*this);
284 }
285
286 void addOperand(VPValue *Operand) {
287 Operands.push_back(Operand);
288 Operand->addUser(*this);
289 }
290
291 unsigned getNumOperands() const { return Operands.size(); }
292 inline VPValue *getOperand(unsigned N) const {
293 assert(N < Operands.size() && "Operand index out of bounds");
294 return Operands[N];
295 }
296
297 void setOperand(unsigned I, VPValue *New) {
298 Operands[I]->removeUser(*this);
299 Operands[I] = New;
300 New->addUser(*this);
301 }
302
303 /// Swap operands of the VPUser. It must have exactly 2 operands.
305 assert(Operands.size() == 2 && "must have 2 operands to swap");
306 std::swap(Operands[0], Operands[1]);
307 }
308
309 /// Replaces all uses of \p From in the VPUser with \p To.
310 void replaceUsesOfWith(VPValue *From, VPValue *To);
311
316
317 operand_iterator op_begin() { return Operands.begin(); }
318 const_operand_iterator op_begin() const { return Operands.begin(); }
319 operand_iterator op_end() { return Operands.end(); }
320 const_operand_iterator op_end() const { return Operands.end(); }
325
326 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
327 /// returns if only first (scalar) lane is used, as default.
328 virtual bool usesScalars(const VPValue *Op) const {
330 "Op must be an operand of the recipe");
331 return usesFirstLaneOnly(Op);
332 }
333
334 /// Returns true if the VPUser only uses the first lane of operand \p Op.
335 /// Conservatively returns false.
336 virtual bool usesFirstLaneOnly(const VPValue *Op) const {
338 "Op must be an operand of the recipe");
339 return false;
340 }
341
342 /// Returns true if the VPUser only uses the first part of operand \p Op.
343 /// Conservatively returns false.
344 virtual bool usesFirstPartOnly(const VPValue *Op) const {
346 "Op must be an operand of the recipe");
347 return false;
348 }
349};
350
351/// This class augments a recipe with a set of VPValues defined by the recipe.
352/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
353/// the VPValues it defines and is responsible for deleting its defined values.
354/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
355/// from VPDef before VPValue.
356class VPDef {
357 friend class VPValue;
358 friend class VPRecipeValue;
359
360 /// Subclass identifier (for isa/dyn_cast).
361 const unsigned char SubclassID;
362
363 /// The VPValues defined by this VPDef.
364 TinyPtrVector<VPRecipeValue *> DefinedValues;
365
366 /// Add \p V as a defined value by this VPDef.
367 void addDefinedValue(VPRecipeValue *V) {
368 assert(V->Def == this &&
369 "can only add VPValue already linked with this VPDef");
370 DefinedValues.push_back(V);
371 }
372
373 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
374 /// value of this VPDef.
375 void removeDefinedValue(VPRecipeValue *V) {
376 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
377 assert(is_contained(DefinedValues, V) &&
378 "VPValue to remove must be in DefinedValues");
379 llvm::erase(DefinedValues, V);
380 V->Def = nullptr;
381 }
382
383public:
384 /// An enumeration for keeping track of the concrete subclass of VPRecipeBase
385 /// that is actually instantiated. Values of this enumeration are kept in the
386 /// SubclassID field of the VPRecipeBase objects. They are used for concrete
387 /// type identification.
388 using VPRecipeTy = enum {
389 VPBranchOnMaskSC,
390 VPDerivedIVSC,
391 VPExpandSCEVSC,
392 VPExpressionSC,
393 VPIRInstructionSC,
394 VPInstructionSC,
395 VPInterleaveEVLSC,
396 VPInterleaveSC,
397 VPReductionEVLSC,
398 VPReductionSC,
399 VPReplicateSC,
400 VPScalarIVStepsSC,
401 VPVectorPointerSC,
402 VPVectorEndPointerSC,
403 VPWidenCallSC,
404 VPWidenCanonicalIVSC,
405 VPWidenCastSC,
406 VPWidenGEPSC,
407 VPWidenIntrinsicSC,
408 VPWidenLoadEVLSC,
409 VPWidenLoadSC,
410 VPWidenStoreEVLSC,
411 VPWidenStoreSC,
412 VPWidenSC,
413 VPBlendSC,
414 VPHistogramSC,
415 // START: Phi-like recipes. Need to be kept together.
416 VPWidenPHISC,
417 VPPredInstPHISC,
418 // START: SubclassID for recipes that inherit VPHeaderPHIRecipe.
419 // VPHeaderPHIRecipe need to be kept together.
420 VPCanonicalIVPHISC,
421 VPActiveLaneMaskPHISC,
422 VPEVLBasedIVPHISC,
423 VPFirstOrderRecurrencePHISC,
424 VPWidenIntOrFpInductionSC,
425 VPWidenPointerInductionSC,
426 VPReductionPHISC,
427 // END: SubclassID for recipes that inherit VPHeaderPHIRecipe
428 // END: Phi-like recipes
429 VPFirstPHISC = VPWidenPHISC,
430 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
431 VPLastHeaderPHISC = VPReductionPHISC,
432 VPLastPHISC = VPReductionPHISC,
433 };
434
435 VPDef(const unsigned char SC) : SubclassID(SC) {}
436
437 virtual ~VPDef() {
438 for (VPRecipeValue *D : to_vector(DefinedValues)) {
439 assert(D->Def == this &&
440 "all defined VPValues should point to the containing VPDef");
441 assert(D->getNumUsers() == 0 &&
442 "all defined VPValues should have no more users");
443 delete D;
444 }
445 }
446
447 /// Returns the only VPValue defined by the VPDef. Can only be called for
448 /// VPDefs with a single defined value.
450 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
451 assert(DefinedValues[0] && "defined value must be non-null");
452 return DefinedValues[0];
453 }
454 const VPValue *getVPSingleValue() const {
455 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
456 assert(DefinedValues[0] && "defined value must be non-null");
457 return DefinedValues[0];
458 }
459
460 /// Returns the VPValue with index \p I defined by the VPDef.
461 VPValue *getVPValue(unsigned I) {
462 assert(DefinedValues[I] && "defined value must be non-null");
463 return DefinedValues[I];
464 }
465 const VPValue *getVPValue(unsigned I) const {
466 assert(DefinedValues[I] && "defined value must be non-null");
467 return DefinedValues[I];
468 }
469
470 /// Returns an ArrayRef of the values defined by the VPDef.
471 ArrayRef<VPRecipeValue *> definedValues() { return DefinedValues; }
472 /// Returns an ArrayRef of the values defined by the VPDef.
473 ArrayRef<VPRecipeValue *> definedValues() const { return DefinedValues; }
474
475 /// Returns the number of values defined by the VPDef.
476 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
477
478 /// \return an ID for the concrete type of this object.
479 /// This is used to implement the classof checks. This should not be used
480 /// for any other purpose, as the values may change as LLVM evolves.
481 unsigned getVPDefID() const { return SubclassID; }
482
483#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
484 /// Dump the VPDef to stderr (for debugging).
485 LLVM_ABI_FOR_TEST void dump() const;
486
487 /// Each concrete VPDef prints itself.
488 virtual void print(raw_ostream &O, const Twine &Indent,
489 VPSlotTracker &SlotTracker) const = 0;
490#endif
491};
492
493} // namespace llvm
494
495#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static void replaceAllUsesWith(Value *Old, Value *New, SmallPtrSet< BasicBlock *, 32 > &FreshBBs, bool IsHuge)
Replace all old uses with new ones, and push the updated BBs into FreshBBs.
#define LLVM_ABI_FOR_TEST
Definition Compiler.h:218
This file contains the declarations for the subclasses of Constant, which represent the different fla...
#define I(x, y, z)
Definition MD5.cpp:57
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
static const BasicSubtargetSubTypeKV * find(StringRef S, ArrayRef< BasicSubtargetSubTypeKV > A)
Find KV in array using binary search.
Class for arbitrary precision integers.
Definition APInt.h:78
uint64_t getZExtValue() const
Get zero extended value.
Definition APInt.h:1549
bool isZero() const
Determine if this value is zero, i.e. all bits are clear.
Definition APInt.h:381
unsigned getBitWidth() const
Return the number of bits in the APInt.
Definition APInt.h:1497
bool isOne() const
Determine if this is a value of 1.
Definition APInt.h:390
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This is the shared class of boolean and integer constants.
Definition Constants.h:87
This class provides computation of slot numbers for LLVM Assembly writing.
typename SuperClass::const_iterator const_iterator
typename SuperClass::iterator iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
This class augments a recipe with a set of VPValues defined by the recipe.
Definition VPlanValue.h:356
LLVM_ABI_FOR_TEST void dump() const
Dump the VPDef to stderr (for debugging).
Definition VPlan.cpp:110
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition VPlanValue.h:476
virtual ~VPDef()
Definition VPlanValue.h:437
friend class VPRecipeValue
Definition VPlanValue.h:358
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition VPlanValue.h:449
const VPValue * getVPSingleValue() const
Definition VPlanValue.h:454
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPExpressionSC, VPIRInstructionSC, VPInstructionSC, VPInterleaveEVLSC, VPInterleaveSC, VPReductionEVLSC, VPReductionSC, VPReplicateSC, VPScalarIVStepsSC, VPVectorPointerSC, VPVectorEndPointerSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenIntrinsicSC, VPWidenLoadEVLSC, VPWidenLoadSC, VPWidenStoreEVLSC, VPWidenStoreSC, VPWidenSC, VPBlendSC, VPHistogramSC, VPWidenPHISC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPEVLBasedIVPHISC, VPFirstOrderRecurrencePHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPReductionPHISC, VPFirstPHISC=VPWidenPHISC, VPFirstHeaderPHISC=VPCanonicalIVPHISC, VPLastHeaderPHISC=VPReductionPHISC, VPLastPHISC=VPReductionPHISC, } VPRecipeTy
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiat...
Definition VPlanValue.h:388
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
Definition VPlanValue.h:461
ArrayRef< VPRecipeValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:473
ArrayRef< VPRecipeValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:471
friend class VPValue
Definition VPlanValue.h:357
unsigned getVPDefID() const
Definition VPlanValue.h:481
VPDef(const unsigned char SC)
Definition VPlanValue.h:435
const VPValue * getVPValue(unsigned I) const
Definition VPlanValue.h:465
Helper type to provide functions to access incoming values and blocks for phi-like recipes.
Definition VPlan.h:1385
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition VPlan.h:387
A VPValue defined by a recipe that produces one or more values.
Definition VPlanValue.h:235
virtual LLVM_ABI_FOR_TEST ~VPRecipeValue()
Definition VPlan.cpp:145
friend class VPDef
Definition VPlanValue.h:237
LLVM_ABI_FOR_TEST VPRecipeValue(VPDef *Def, Value *UV=nullptr)
Definition VPlan.cpp:139
friend class VPValue
Definition VPlanValue.h:236
static bool classof(const VPValue *V)
Definition VPlanValue.h:246
This class can be used to assign names to VPValues.
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
Definition VPlanValue.h:253
void replaceUsesOfWith(VPValue *From, VPValue *To)
Replaces all uses of From in the VPUser with To.
Definition VPlan.cpp:1416
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition VPlan.cpp:1428
operand_range operands()
Definition VPlanValue.h:321
void setOperand(unsigned I, VPValue *New)
Definition VPlanValue.h:297
VPUser & operator=(const VPUser &)=delete
friend class VPPhiAccessors
Grant access to removeOperand for VPPhiAccessors, the only supported user.
Definition VPlanValue.h:255
unsigned getNumOperands() const
Definition VPlanValue.h:291
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition VPlanValue.h:313
const_operand_iterator op_begin() const
Definition VPlanValue.h:318
operand_iterator op_end()
Definition VPlanValue.h:319
const_operand_range operands() const
Definition VPlanValue.h:322
operand_iterator op_begin()
Definition VPlanValue.h:317
VPValue * getOperand(unsigned N) const
Definition VPlanValue.h:292
VPUser(ArrayRef< VPValue * > Operands)
Definition VPlanValue.h:272
VPUser(const VPUser &)=delete
VPUser()=delete
iterator_range< const_operand_iterator > const_operand_range
Definition VPlanValue.h:315
virtual bool usesFirstPartOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition VPlanValue.h:344
void swapOperands()
Swap operands of the VPUser. It must have exactly 2 operands.
Definition VPlanValue.h:304
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition VPlanValue.h:312
virtual ~VPUser()
Definition VPlanValue.h:281
virtual bool usesFirstLaneOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition VPlanValue.h:336
const_operand_iterator op_end() const
Definition VPlanValue.h:320
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition VPlanValue.h:328
iterator_range< operand_iterator > operand_range
Definition VPlanValue.h:314
void addOperand(VPValue *Operand)
Definition VPlanValue.h:286
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
Definition VPlanValue.h:47
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
Definition VPlanValue.h:169
virtual ~VPValue()
Definition VPlanValue.h:90
unsigned getVPValueID() const
Definition VPlanValue.h:97
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Definition VPlan.cpp:119
void removeUser(VPUser &User)
Remove a single User from the list of users.
Definition VPlanValue.h:111
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition VPlanValue.h:120
friend class VPRecipeValue
Definition VPlanValue.h:53
const_user_iterator user_begin() const
Definition VPlanValue.h:125
friend struct VPIRValue
Definition VPlanValue.h:51
void addUser(VPUser &User)
Definition VPlanValue.h:108
bool hasMoreThanOneUniqueUser() const
Returns true if the value has more than one unique user.
Definition VPlanValue.h:134
friend class VPDef
Definition VPlanValue.h:48
Value * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
Definition VPlanValue.h:74
const_user_range users() const
Definition VPlanValue.h:129
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
@ VPVSymbolicSC
A live-in VPValue wrapping an IR Value.
Definition VPlanValue.h:83
@ VPVRecipeValueSC
A symbolic live-in VPValue without IR backing.
Definition VPlanValue.h:84
bool hasOneUse() const
Definition VPlanValue.h:145
const VPUser * getSingleUser() const
Definition VPlanValue.h:150
void setUnderlyingValue(Value *Val)
Definition VPlanValue.h:175
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition VPlanValue.h:119
iterator_range< user_iterator > user_range
Definition VPlanValue.h:121
const_user_iterator user_end() const
Definition VPlanValue.h:127
VPUser * getSingleUser()
Return the single user of this value, or nullptr if there is not exactly one user.
Definition VPlanValue.h:149
user_iterator user_begin()
Definition VPlanValue.h:124
unsigned getNumUsers() const
Definition VPlanValue.h:107
friend struct VPSymbolicValue
Definition VPlanValue.h:52
user_iterator user_end()
Definition VPlanValue.h:126
friend struct VPDoubleValueDef
Definition VPlanValue.h:49
user_range users()
Definition VPlanValue.h:128
iterator_range< const_user_iterator > const_user_range
Definition VPlanValue.h:122
friend class VPlan
Definition VPlanValue.h:50
LLVM Value Representation.
Definition Value.h:75
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
Definition STLExtras.h:2190
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition STLExtras.h:1945
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:872
#define N
VPConstantInt(ConstantInt *CI)
Definition VPlanValue.h:205
static bool classof(const VPValue *V)
Definition VPlanValue.h:207
bool isZero() const
Definition VPlanValue.h:213
const APInt & getAPInt() const
Definition VPlanValue.h:215
uint64_t getZExtValue() const
Definition VPlanValue.h:221
unsigned getBitWidth() const
Definition VPlanValue.h:219
bool isOne() const
Definition VPlanValue.h:211
VPIRValue(Value *UV)
Definition VPlanValue.h:187
Value * getValue() const
Returns the underlying IR value.
Definition VPlanValue.h:192
static bool classof(const VPValue *V)
Definition VPlanValue.h:197
Type * getType() const
Returns the type of the underlying IR value.
Definition VPlan.cpp:137
static bool classof(const VPValue *V)
Definition VPlanValue.h:229