LLVM 22.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"
28
29namespace llvm {
30
31// Forward declarations.
32class raw_ostream;
33class Type;
34class Value;
35class VPDef;
36struct VPDoubleValueDef;
37class VPSlotTracker;
38class VPUser;
39class VPRecipeBase;
40class VPPhiAccessors;
41
42/// This is the base class of the VPlan Def/Use graph, used for modeling the
43/// data flow into, within and out of the VPlan. VPValues can stand for live-ins
44/// coming from the input IR, symbolic values and values defined by recipes.
45class LLVM_ABI_FOR_TEST VPValue {
46 friend class VPDef;
47 friend struct VPDoubleValueDef;
48 friend class VPlan;
49 friend struct VPIRValue;
50 friend struct VPSymbolicValue;
51 friend class VPRecipeValue;
52
53 const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
54
56
57 /// Hold the underlying Value, if any, attached to this VPValue.
58 Value *UnderlyingVal;
59
60 VPValue(const unsigned char SC, Value *UV = nullptr)
61 : SubclassID(SC), UnderlyingVal(UV) {}
62
63 // DESIGN PRINCIPLE: Access to the underlying IR must be strictly limited to
64 // the front-end and back-end of VPlan so that the middle-end is as
65 // independent as possible of the underlying IR. We grant access to the
66 // underlying IR using friendship. In that way, we should be able to use VPlan
67 // for multiple underlying IRs (Polly?) by providing a new VPlan front-end,
68 // back-end and analysis information for the new IR.
69
70public:
71 /// Return the underlying Value attached to this VPValue.
72 Value *getUnderlyingValue() const { return UnderlyingVal; }
73
74 /// Return the underlying IR value for a VPIRValue.
75 Value *getLiveInIRValue() const;
76
77 /// An enumeration for keeping track of the concrete subclass of VPValue that
78 /// are actually instantiated.
79 enum {
80 VPVIRValueSC, /// A live-in VPValue wrapping an IR Value.
81 VPVSymbolicSC, /// A symbolic live-in VPValue without IR backing.
82 VPVRecipeValueSC, /// A VPValue defined by a recipe.
83 };
84
85 VPValue(const VPValue &) = delete;
86 VPValue &operator=(const VPValue &) = delete;
87
88 virtual ~VPValue() {
89 assert(Users.empty() && "trying to delete a VPValue with remaining users");
90 }
91
92 /// \return an ID for the concrete type of this object.
93 /// This is used to implement the classof checks. This should not be used
94 /// for any other purpose, as the values may change as LLVM evolves.
95 unsigned getVPValueID() const { return SubclassID; }
96
97#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
98 void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
99 void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
100
101 /// Dump the value to stderr (for debugging).
102 void dump() const;
103#endif
104
105 unsigned getNumUsers() const { return Users.size(); }
106 void addUser(VPUser &User) { Users.push_back(&User); }
107
108 /// Remove a single \p User from the list of users.
110 // The same user can be added multiple times, e.g. because the same VPValue
111 // is used twice by the same VPUser. Remove a single one.
112 auto *I = find(Users, &User);
113 if (I != Users.end())
114 Users.erase(I);
115 }
116
121
122 user_iterator user_begin() { return Users.begin(); }
123 const_user_iterator user_begin() const { return Users.begin(); }
124 user_iterator user_end() { return Users.end(); }
125 const_user_iterator user_end() const { return Users.end(); }
129 }
130
131 /// Returns true if the value has more than one unique user.
133 if (getNumUsers() == 0)
134 return false;
135
136 // Check if all users match the first user.
137 auto Current = std::next(user_begin());
138 while (Current != user_end() && *user_begin() == *Current)
139 Current++;
140 return Current != user_end();
141 }
142
143 bool hasOneUse() const { return getNumUsers() == 1; }
144
145 /// Return the single user of this value, or nullptr if there is not exactly
146 /// one user.
147 VPUser *getSingleUser() { return hasOneUse() ? *user_begin() : nullptr; }
148 const VPUser *getSingleUser() const {
149 return hasOneUse() ? *user_begin() : nullptr;
150 }
151
152 void replaceAllUsesWith(VPValue *New);
153
154 /// Go through the uses list for this VPValue and make each use point to \p
155 /// New if the callback ShouldReplace returns true for the given use specified
156 /// by a pair of (VPUser, the use index).
157 void replaceUsesWithIf(
158 VPValue *New,
159 llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
160
161 /// Returns the recipe defining this VPValue or nullptr if it is not defined
162 /// by a recipe, i.e. is a live-in.
163 VPRecipeBase *getDefiningRecipe();
164 const VPRecipeBase *getDefiningRecipe() const;
165
166 /// Returns true if this VPValue is defined by a recipe.
167 bool hasDefiningRecipe() const { return getDefiningRecipe(); }
168
169 /// Returns true if the VPValue is defined outside any loop.
170 bool isDefinedOutsideLoopRegions() const;
171
172 // Set \p Val as the underlying Value of this VPValue.
174 assert(!UnderlyingVal && "Underlying Value is already set.");
175 UnderlyingVal = Val;
176 }
177};
178
179LLVM_ABI_FOR_TEST raw_ostream &operator<<(raw_ostream &OS,
180 const VPRecipeBase &R);
181
182/// A VPValue representing a live-in from the input IR or a constant. It wraps
183/// an underlying IR Value.
184struct VPIRValue : public VPValue {
185 VPIRValue(Value *UV) : VPValue(VPVIRValueSC, UV) {
186 assert(UV && "VPIRValue requires an underlying IR value");
187 }
188
189 /// Returns the underlying IR value.
190 Value *getValue() const { return getUnderlyingValue(); }
191
192 /// Returns the type of the underlying IR value.
193 Type *getType() const;
194
195 static bool classof(const VPValue *V) {
196 return V->getVPValueID() == VPVIRValueSC;
197 }
198};
199
200/// A symbolic live-in VPValue, used for values like vector trip count, VF, and
201/// VFxUF.
202struct VPSymbolicValue : public VPValue {
203 VPSymbolicValue() : VPValue(VPVSymbolicSC, nullptr) {}
204
205 static bool classof(const VPValue *V) {
206 return V->getVPValueID() == VPVSymbolicSC;
207 }
208};
209
210/// A VPValue defined by a recipe that produces one or more values.
211class VPRecipeValue : public VPValue {
212 friend class VPValue;
213 friend class VPDef;
214 /// Pointer to the VPDef that defines this VPValue.
215 VPDef *Def;
216
217public:
218 VPRecipeValue(VPDef *Def, Value *UV = nullptr);
219
220 virtual ~VPRecipeValue();
221
222 static bool classof(const VPValue *V) {
223 return V->getVPValueID() == VPVRecipeValueSC;
224 }
225};
226
227/// This class augments VPValue with operands which provide the inverse def-use
228/// edges from VPValue's users to their defs.
229class VPUser {
230 /// Grant access to removeOperand for VPPhiAccessors, the only supported user.
231 friend class VPPhiAccessors;
232
234
235 /// Removes the operand at index \p Idx. This also removes the VPUser from the
236 /// use-list of the operand.
237 void removeOperand(unsigned Idx) {
238 getOperand(Idx)->removeUser(*this);
239 Operands.erase(Operands.begin() + Idx);
240 }
241
242protected:
243#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
244 /// Print the operands to \p O.
246#endif
247
249 for (VPValue *Operand : Operands)
250 addOperand(Operand);
251 }
252
253public:
254 VPUser() = delete;
255 VPUser(const VPUser &) = delete;
256 VPUser &operator=(const VPUser &) = delete;
257 virtual ~VPUser() {
258 for (VPValue *Op : operands())
259 Op->removeUser(*this);
260 }
261
262 void addOperand(VPValue *Operand) {
263 Operands.push_back(Operand);
264 Operand->addUser(*this);
265 }
266
267 unsigned getNumOperands() const { return Operands.size(); }
268 inline VPValue *getOperand(unsigned N) const {
269 assert(N < Operands.size() && "Operand index out of bounds");
270 return Operands[N];
271 }
272
273 void setOperand(unsigned I, VPValue *New) {
274 Operands[I]->removeUser(*this);
275 Operands[I] = New;
276 New->addUser(*this);
277 }
278
279 /// Swap operands of the VPUser. It must have exactly 2 operands.
281 assert(Operands.size() == 2 && "must have 2 operands to swap");
282 std::swap(Operands[0], Operands[1]);
283 }
284
285 /// Replaces all uses of \p From in the VPUser with \p To.
286 void replaceUsesOfWith(VPValue *From, VPValue *To);
287
292
293 operand_iterator op_begin() { return Operands.begin(); }
294 const_operand_iterator op_begin() const { return Operands.begin(); }
295 operand_iterator op_end() { return Operands.end(); }
296 const_operand_iterator op_end() const { return Operands.end(); }
301
302 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
303 /// returns if only first (scalar) lane is used, as default.
304 virtual bool usesScalars(const VPValue *Op) const {
306 "Op must be an operand of the recipe");
307 return usesFirstLaneOnly(Op);
308 }
309
310 /// Returns true if the VPUser only uses the first lane of operand \p Op.
311 /// Conservatively returns false.
312 virtual bool usesFirstLaneOnly(const VPValue *Op) const {
314 "Op must be an operand of the recipe");
315 return false;
316 }
317
318 /// Returns true if the VPUser only uses the first part of operand \p Op.
319 /// Conservatively returns false.
320 virtual bool usesFirstPartOnly(const VPValue *Op) const {
322 "Op must be an operand of the recipe");
323 return false;
324 }
325};
326
327/// This class augments a recipe with a set of VPValues defined by the recipe.
328/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
329/// the VPValues it defines and is responsible for deleting its defined values.
330/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
331/// from VPDef before VPValue.
332class VPDef {
333 friend class VPValue;
334 friend class VPRecipeValue;
335
336 /// Subclass identifier (for isa/dyn_cast).
337 const unsigned char SubclassID;
338
339 /// The VPValues defined by this VPDef.
340 TinyPtrVector<VPRecipeValue *> DefinedValues;
341
342 /// Add \p V as a defined value by this VPDef.
343 void addDefinedValue(VPRecipeValue *V) {
344 assert(V->Def == this &&
345 "can only add VPValue already linked with this VPDef");
346 DefinedValues.push_back(V);
347 }
348
349 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
350 /// value of this VPDef.
351 void removeDefinedValue(VPRecipeValue *V) {
352 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
353 assert(is_contained(DefinedValues, V) &&
354 "VPValue to remove must be in DefinedValues");
355 llvm::erase(DefinedValues, V);
356 V->Def = nullptr;
357 }
358
359public:
360 /// An enumeration for keeping track of the concrete subclass of VPRecipeBase
361 /// that is actually instantiated. Values of this enumeration are kept in the
362 /// SubclassID field of the VPRecipeBase objects. They are used for concrete
363 /// type identification.
364 using VPRecipeTy = enum {
365 VPBranchOnMaskSC,
366 VPDerivedIVSC,
367 VPExpandSCEVSC,
368 VPExpressionSC,
369 VPIRInstructionSC,
370 VPInstructionSC,
371 VPInterleaveEVLSC,
372 VPInterleaveSC,
373 VPReductionEVLSC,
374 VPReductionSC,
375 VPReplicateSC,
376 VPScalarIVStepsSC,
377 VPVectorPointerSC,
378 VPVectorEndPointerSC,
379 VPWidenCallSC,
380 VPWidenCanonicalIVSC,
381 VPWidenCastSC,
382 VPWidenGEPSC,
383 VPWidenIntrinsicSC,
384 VPWidenLoadEVLSC,
385 VPWidenLoadSC,
386 VPWidenStoreEVLSC,
387 VPWidenStoreSC,
388 VPWidenSC,
389 VPWidenSelectSC,
390 VPBlendSC,
391 VPHistogramSC,
392 // START: Phi-like recipes. Need to be kept together.
393 VPWidenPHISC,
394 VPPredInstPHISC,
395 // START: SubclassID for recipes that inherit VPHeaderPHIRecipe.
396 // VPHeaderPHIRecipe need to be kept together.
397 VPCanonicalIVPHISC,
398 VPActiveLaneMaskPHISC,
399 VPEVLBasedIVPHISC,
400 VPFirstOrderRecurrencePHISC,
401 VPWidenIntOrFpInductionSC,
402 VPWidenPointerInductionSC,
403 VPReductionPHISC,
404 // END: SubclassID for recipes that inherit VPHeaderPHIRecipe
405 // END: Phi-like recipes
406 VPFirstPHISC = VPWidenPHISC,
407 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
408 VPLastHeaderPHISC = VPReductionPHISC,
409 VPLastPHISC = VPReductionPHISC,
410 };
411
412 VPDef(const unsigned char SC) : SubclassID(SC) {}
413
414 virtual ~VPDef() {
415 for (VPRecipeValue *D : to_vector(DefinedValues)) {
416 assert(D->Def == this &&
417 "all defined VPValues should point to the containing VPDef");
418 assert(D->getNumUsers() == 0 &&
419 "all defined VPValues should have no more users");
420 delete D;
421 }
422 }
423
424 /// Returns the only VPValue defined by the VPDef. Can only be called for
425 /// VPDefs with a single defined value.
427 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
428 assert(DefinedValues[0] && "defined value must be non-null");
429 return DefinedValues[0];
430 }
431 const VPValue *getVPSingleValue() const {
432 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
433 assert(DefinedValues[0] && "defined value must be non-null");
434 return DefinedValues[0];
435 }
436
437 /// Returns the VPValue with index \p I defined by the VPDef.
438 VPValue *getVPValue(unsigned I) {
439 assert(DefinedValues[I] && "defined value must be non-null");
440 return DefinedValues[I];
441 }
442 const VPValue *getVPValue(unsigned I) const {
443 assert(DefinedValues[I] && "defined value must be non-null");
444 return DefinedValues[I];
445 }
446
447 /// Returns an ArrayRef of the values defined by the VPDef.
448 ArrayRef<VPRecipeValue *> definedValues() { return DefinedValues; }
449 /// Returns an ArrayRef of the values defined by the VPDef.
450 ArrayRef<VPRecipeValue *> definedValues() const { return DefinedValues; }
451
452 /// Returns the number of values defined by the VPDef.
453 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
454
455 /// \return an ID for the concrete type of this object.
456 /// This is used to implement the classof checks. This should not be used
457 /// for any other purpose, as the values may change as LLVM evolves.
458 unsigned getVPDefID() const { return SubclassID; }
459
460#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
461 /// Dump the VPDef to stderr (for debugging).
462 LLVM_ABI_FOR_TEST void dump() const;
463
464 /// Each concrete VPDef prints itself.
465 virtual void print(raw_ostream &O, const Twine &Indent,
466 VPSlotTracker &SlotTracker) const = 0;
467#endif
468};
469
470} // namespace llvm
471
472#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
#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.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
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:332
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:453
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, VPWidenSelectSC, 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:364
virtual ~VPDef()
Definition VPlanValue.h:414
friend class VPRecipeValue
Definition VPlanValue.h:334
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition VPlanValue.h:426
const VPValue * getVPSingleValue() const
Definition VPlanValue.h:431
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
Definition VPlanValue.h:438
ArrayRef< VPRecipeValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:450
ArrayRef< VPRecipeValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:448
friend class VPValue
Definition VPlanValue.h:333
unsigned getVPDefID() const
Definition VPlanValue.h:458
VPDef(const unsigned char SC)
Definition VPlanValue.h:412
const VPValue * getVPValue(unsigned I) const
Definition VPlanValue.h:442
Helper type to provide functions to access incoming values and blocks for phi-like recipes.
Definition VPlan.h:1330
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:211
virtual ~VPRecipeValue()
Definition VPlan.cpp:145
friend class VPDef
Definition VPlanValue.h:213
VPRecipeValue(VPDef *Def, Value *UV=nullptr)
Definition VPlan.cpp:139
friend class VPValue
Definition VPlanValue.h:212
static bool classof(const VPValue *V)
Definition VPlanValue.h:222
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:229
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:297
void setOperand(unsigned I, VPValue *New)
Definition VPlanValue.h:273
VPUser & operator=(const VPUser &)=delete
friend class VPPhiAccessors
Grant access to removeOperand for VPPhiAccessors, the only supported user.
Definition VPlanValue.h:231
unsigned getNumOperands() const
Definition VPlanValue.h:267
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition VPlanValue.h:289
const_operand_iterator op_begin() const
Definition VPlanValue.h:294
operand_iterator op_end()
Definition VPlanValue.h:295
const_operand_range operands() const
Definition VPlanValue.h:298
operand_iterator op_begin()
Definition VPlanValue.h:293
VPValue * getOperand(unsigned N) const
Definition VPlanValue.h:268
VPUser(ArrayRef< VPValue * > Operands)
Definition VPlanValue.h:248
VPUser(const VPUser &)=delete
VPUser()=delete
iterator_range< const_operand_iterator > const_operand_range
Definition VPlanValue.h:291
virtual bool usesFirstPartOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition VPlanValue.h:320
void swapOperands()
Swap operands of the VPUser. It must have exactly 2 operands.
Definition VPlanValue.h:280
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition VPlanValue.h:288
virtual ~VPUser()
Definition VPlanValue.h:257
virtual bool usesFirstLaneOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition VPlanValue.h:312
const_operand_iterator op_end() const
Definition VPlanValue.h:296
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition VPlanValue.h:304
iterator_range< operand_iterator > operand_range
Definition VPlanValue.h:290
void addOperand(VPValue *Operand)
Definition VPlanValue.h:262
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
Definition VPlanValue.h:45
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
Definition VPlanValue.h:167
virtual ~VPValue()
Definition VPlanValue.h:88
unsigned getVPValueID() const
Definition VPlanValue.h:95
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:109
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition VPlanValue.h:118
friend class VPRecipeValue
Definition VPlanValue.h:51
const_user_iterator user_begin() const
Definition VPlanValue.h:123
friend struct VPIRValue
Definition VPlanValue.h:49
void addUser(VPUser &User)
Definition VPlanValue.h:106
bool hasMoreThanOneUniqueUser() const
Returns true if the value has more than one unique user.
Definition VPlanValue.h:132
friend class VPDef
Definition VPlanValue.h:46
Value * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
Definition VPlanValue.h:72
const_user_range users() const
Definition VPlanValue.h:127
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
@ VPVSymbolicSC
A live-in VPValue wrapping an IR Value.
Definition VPlanValue.h:81
@ VPVRecipeValueSC
A symbolic live-in VPValue without IR backing.
Definition VPlanValue.h:82
bool hasOneUse() const
Definition VPlanValue.h:143
const VPUser * getSingleUser() const
Definition VPlanValue.h:148
void setUnderlyingValue(Value *Val)
Definition VPlanValue.h:173
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition VPlanValue.h:117
iterator_range< user_iterator > user_range
Definition VPlanValue.h:119
const_user_iterator user_end() const
Definition VPlanValue.h:125
VPUser * getSingleUser()
Return the single user of this value, or nullptr if there is not exactly one user.
Definition VPlanValue.h:147
user_iterator user_begin()
Definition VPlanValue.h:122
unsigned getNumUsers() const
Definition VPlanValue.h:105
friend struct VPSymbolicValue
Definition VPlanValue.h:50
user_iterator user_end()
Definition VPlanValue.h:124
friend struct VPDoubleValueDef
Definition VPlanValue.h:47
user_range users()
Definition VPlanValue.h:126
iterator_range< const_user_iterator > const_user_range
Definition VPlanValue.h:120
friend class VPlan
Definition VPlanValue.h:48
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:2176
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...
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
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
VPIRValue(Value *UV)
Definition VPlanValue.h:185
Value * getValue() const
Returns the underlying IR value.
Definition VPlanValue.h:190
static bool classof(const VPValue *V)
Definition VPlanValue.h:195
Type * getType() const
Returns the type of the underlying IR value.
Definition VPlan.cpp:137
static bool classof(const VPValue *V)
Definition VPlanValue.h:205