LLVM 19.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"
28
29namespace llvm {
30
31// Forward declarations.
32class raw_ostream;
33class Value;
34class VPDef;
35class VPSlotTracker;
36class VPUser;
37class VPRecipeBase;
38class 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.
44class 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
59protected:
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
76public:
77 /// Return the underlying Value attached to this VPValue.
79 const Value *getUnderlyingValue() const { return UnderlyingVal; }
80
81 /// An enumeration for keeping track of the concrete subclass of VPValue that
82 /// are actually instantiated.
83 enum {
84 VPValueSC, /// A generic VPValue, like live-in values or defined by a recipe
85 /// that defines multiple values.
86 VPVRecipeSC /// A VPValue sub-class that is a VPRecipeBase.
87 };
88
89 /// Create a live-in VPValue.
90 VPValue(Value *UV = nullptr) : VPValue(VPValueSC, UV, nullptr) {}
91 /// Create a VPValue for a \p Def which is a subclass of VPValue.
92 VPValue(VPDef *Def, Value *UV = nullptr) : VPValue(VPVRecipeSC, UV, Def) {}
93 /// Create a VPValue for a \p Def which defines multiple values.
95 VPValue(const VPValue &) = delete;
96 VPValue &operator=(const VPValue &) = delete;
97
98 virtual ~VPValue();
99
100 /// \return an ID for the concrete type of this object.
101 /// This is used to implement the classof checks. This should not be used
102 /// for any other purpose, as the values may change as LLVM evolves.
103 unsigned getVPValueID() const { return SubclassID; }
104
105#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
106 void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
107 void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
108
109 /// Dump the value to stderr (for debugging).
110 void dump() const;
111#endif
112
113 unsigned getNumUsers() const { return Users.size(); }
114 void addUser(VPUser &User) { Users.push_back(&User); }
115
116 /// Remove a single \p User from the list of users.
118 // The same user can be added multiple times, e.g. because the same VPValue
119 // is used twice by the same VPUser. Remove a single one.
120 auto *I = find(Users, &User);
121 if (I != Users.end())
122 Users.erase(I);
123 }
124
129
130 user_iterator user_begin() { return Users.begin(); }
131 const_user_iterator user_begin() const { return Users.begin(); }
132 user_iterator user_end() { return Users.end(); }
133 const_user_iterator user_end() const { return Users.end(); }
137 }
138
139 /// Returns true if the value has more than one unique user.
141 if (getNumUsers() == 0)
142 return false;
143
144 // Check if all users match the first user.
145 auto Current = std::next(user_begin());
146 while (Current != user_end() && *user_begin() == *Current)
147 Current++;
148 return Current != user_end();
149 }
150
151 void replaceAllUsesWith(VPValue *New);
152
153 /// Go through the uses list for this VPValue and make each use point to \p
154 /// New if the callback ShouldReplace returns true for the given use specified
155 /// by a pair of (VPUser, the use index).
157 VPValue *New,
158 llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
159
160 /// Returns the recipe defining this VPValue or nullptr if it is not defined
161 /// by a recipe, i.e. is a live-in.
163 const VPRecipeBase *getDefiningRecipe() const;
164
165 /// Returns true if this VPValue is defined by a recipe.
166 bool hasDefiningRecipe() const { return getDefiningRecipe(); }
167
168 /// Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
169 bool isLiveIn() const { return !hasDefiningRecipe(); }
170
171 /// Returns the underlying IR value, if this VPValue is defined outside the
172 /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
173 /// inside a VPlan.
175 assert(isLiveIn() &&
176 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
177 return getUnderlyingValue();
178 }
179 const Value *getLiveInIRValue() const {
180 assert(isLiveIn() &&
181 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
182 return getUnderlyingValue();
183 }
184
185 /// Returns true if the VPValue is defined outside any vector regions, i.e. it
186 /// is a live-in value.
187 /// TODO: Also handle recipes defined in pre-header blocks.
189
190 // Set \p Val as the underlying Value of this VPValue.
192 assert(!UnderlyingVal && "Underlying Value is already set.");
193 UnderlyingVal = Val;
194 }
195};
196
199
201
202/// This class augments VPValue with operands which provide the inverse def-use
203/// edges from VPValue's users to their defs.
204class VPUser {
205public:
206 /// Subclass identifier (for isa/dyn_cast).
207 enum class VPUserID {
208 Recipe,
209 LiveOut,
210 };
211
212private:
214
215 VPUserID ID;
216
217protected:
218#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
219 /// Print the operands to \p O.
221#endif
222
224 for (VPValue *Operand : Operands)
225 addOperand(Operand);
226 }
227
228 VPUser(std::initializer_list<VPValue *> Operands, VPUserID ID)
230
231 template <typename IterT>
233 for (VPValue *Operand : Operands)
234 addOperand(Operand);
235 }
236
237public:
238 VPUser() = delete;
239 VPUser(const VPUser &) = delete;
240 VPUser &operator=(const VPUser &) = delete;
241 virtual ~VPUser() {
242 for (VPValue *Op : operands())
243 Op->removeUser(*this);
244 }
245
246 VPUserID getVPUserID() const { return ID; }
247
248 void addOperand(VPValue *Operand) {
249 Operands.push_back(Operand);
250 Operand->addUser(*this);
251 }
252
253 unsigned getNumOperands() const { return Operands.size(); }
254 inline VPValue *getOperand(unsigned N) const {
255 assert(N < Operands.size() && "Operand index out of bounds");
256 return Operands[N];
257 }
258
259 void setOperand(unsigned I, VPValue *New) {
260 Operands[I]->removeUser(*this);
261 Operands[I] = New;
262 New->addUser(*this);
263 }
264
266 VPValue *Op = Operands.pop_back_val();
267 Op->removeUser(*this);
268 }
269
274
275 operand_iterator op_begin() { return Operands.begin(); }
276 const_operand_iterator op_begin() const { return Operands.begin(); }
277 operand_iterator op_end() { return Operands.end(); }
278 const_operand_iterator op_end() const { return Operands.end(); }
282 }
283
284 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
285 /// returns if only first (scalar) lane is used, as default.
286 virtual bool usesScalars(const VPValue *Op) const {
288 "Op must be an operand of the recipe");
289 return onlyFirstLaneUsed(Op);
290 }
291
292 /// Returns true if the VPUser only uses the first lane of operand \p Op.
293 /// Conservatively returns false.
294 virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
296 "Op must be an operand of the recipe");
297 return false;
298 }
299
300 /// Returns true if the VPUser only uses the first part of operand \p Op.
301 /// Conservatively returns false.
302 virtual bool onlyFirstPartUsed(const VPValue *Op) const {
304 "Op must be an operand of the recipe");
305 return false;
306 }
307};
308
309/// This class augments a recipe with a set of VPValues defined by the recipe.
310/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
311/// the VPValues it defines and is responsible for deleting its defined values.
312/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
313/// from VPDef before VPValue.
314class VPDef {
315 friend class VPValue;
316
317 /// Subclass identifier (for isa/dyn_cast).
318 const unsigned char SubclassID;
319
320 /// The VPValues defined by this VPDef.
321 TinyPtrVector<VPValue *> DefinedValues;
322
323 /// Add \p V as a defined value by this VPDef.
324 void addDefinedValue(VPValue *V) {
325 assert(V->Def == this &&
326 "can only add VPValue already linked with this VPDef");
327 DefinedValues.push_back(V);
328 }
329
330 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
331 /// value of this VPDef.
332 void removeDefinedValue(VPValue *V) {
333 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
334 assert(is_contained(DefinedValues, V) &&
335 "VPValue to remove must be in DefinedValues");
336 llvm::erase(DefinedValues, V);
337 V->Def = nullptr;
338 }
339
340public:
341 /// An enumeration for keeping track of the concrete subclass of VPRecipeBase
342 /// that is actually instantiated. Values of this enumeration are kept in the
343 /// SubclassID field of the VPRecipeBase objects. They are used for concrete
344 /// type identification.
345 using VPRecipeTy = enum {
346 VPBranchOnMaskSC,
347 VPDerivedIVSC,
348 VPExpandSCEVSC,
349 VPInstructionSC,
350 VPInterleaveSC,
351 VPReductionSC,
352 VPReplicateSC,
353 VPScalarCastSC,
354 VPScalarIVStepsSC,
355 VPVectorPointerSC,
356 VPWidenCallSC,
357 VPWidenCanonicalIVSC,
358 VPWidenCastSC,
359 VPWidenGEPSC,
360 VPWidenMemoryInstructionSC,
361 VPWidenSC,
362 VPWidenSelectSC,
363 // START: Phi-like recipes. Need to be kept together.
364 VPBlendSC,
365 VPWidenPHISC,
366 VPPredInstPHISC,
367 // START: SubclassID for recipes that inherit VPHeaderPHIRecipe.
368 // VPHeaderPHIRecipe need to be kept together.
369 VPCanonicalIVPHISC,
370 VPActiveLaneMaskPHISC,
371 VPFirstOrderRecurrencePHISC,
372 VPWidenIntOrFpInductionSC,
373 VPWidenPointerInductionSC,
374 VPReductionPHISC,
375 // END: SubclassID for recipes that inherit VPHeaderPHIRecipe
376 // END: Phi-like recipes
377 VPFirstPHISC = VPBlendSC,
378 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
379 VPLastHeaderPHISC = VPReductionPHISC,
380 VPLastPHISC = VPReductionPHISC,
381 };
382
383 VPDef(const unsigned char SC) : SubclassID(SC) {}
384
385 virtual ~VPDef() {
386 for (VPValue *D : make_early_inc_range(DefinedValues)) {
387 assert(D->Def == this &&
388 "all defined VPValues should point to the containing VPDef");
389 assert(D->getNumUsers() == 0 &&
390 "all defined VPValues should have no more users");
391 D->Def = nullptr;
392 delete D;
393 }
394 }
395
396 /// Returns the only VPValue defined by the VPDef. Can only be called for
397 /// VPDefs with a single defined value.
399 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
400 assert(DefinedValues[0] && "defined value must be non-null");
401 return DefinedValues[0];
402 }
403 const VPValue *getVPSingleValue() const {
404 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
405 assert(DefinedValues[0] && "defined value must be non-null");
406 return DefinedValues[0];
407 }
408
409 /// Returns the VPValue with index \p I defined by the VPDef.
410 VPValue *getVPValue(unsigned I) {
411 assert(DefinedValues[I] && "defined value must be non-null");
412 return DefinedValues[I];
413 }
414 const VPValue *getVPValue(unsigned I) const {
415 assert(DefinedValues[I] && "defined value must be non-null");
416 return DefinedValues[I];
417 }
418
419 /// Returns an ArrayRef of the values defined by the VPDef.
420 ArrayRef<VPValue *> definedValues() { return DefinedValues; }
421 /// Returns an ArrayRef of the values defined by the VPDef.
422 ArrayRef<VPValue *> definedValues() const { return DefinedValues; }
423
424 /// Returns the number of values defined by the VPDef.
425 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
426
427 /// \return an ID for the concrete type of this object.
428 /// This is used to implement the classof checks. This should not be used
429 /// for any other purpose, as the values may change as LLVM evolves.
430 unsigned getVPDefID() const { return SubclassID; }
431
432#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
433 /// Dump the VPDef to stderr (for debugging).
434 void dump() const;
435
436 /// Each concrete VPDef prints itself.
437 virtual void print(raw_ostream &O, const Twine &Indent,
438 VPSlotTracker &SlotTracker) const = 0;
439#endif
440};
441
442class VPlan;
443class VPBasicBlock;
444
445/// This class can be used to assign consecutive numbers to all VPValues in a
446/// VPlan and allows querying the numbering for printing, similar to the
447/// ModuleSlotTracker for IR values.
450 unsigned NextSlot = 0;
451
452 void assignSlot(const VPValue *V);
453 void assignSlots(const VPlan &Plan);
454 void assignSlots(const VPBasicBlock *VPBB);
455
456public:
457 VPSlotTracker(const VPlan *Plan = nullptr) {
458 if (Plan)
459 assignSlots(*Plan);
460 }
461
462 unsigned getSlot(const VPValue *V) const {
463 auto I = Slots.find(V);
464 if (I == Slots.end())
465 return -1;
466 return I->second;
467 }
468};
469
470} // namespace llvm
471
472#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
iv Induction Variable Users
Definition: IVUsers.cpp:48
#define I(x, y, z)
Definition: MD5.cpp:58
mir Rename Register Operands
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains some templates that are useful if you are working with the STL at all.
raw_pwrite_stream & OS
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This class represents an Operation in the Expression.
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:155
iterator end()
Definition: DenseMap.h:84
This class provides computation of slot numbers for LLVM Assembly writing.
Definition: AsmWriter.cpp:690
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:591
typename SuperClass::iterator iterator
Definition: SmallVector.h:590
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Definition: TinyPtrVector.h:29
void push_back(EltTy NewVal)
unsigned size() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:2594
VPlan-based builder utility analogous to IRBuilder.
This class augments a recipe with a set of VPValues defined by the recipe.
Definition: VPlanValue.h:314
void dump() const
Dump the VPDef to stderr (for debugging).
Definition: VPlan.cpp:109
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition: VPlanValue.h:425
virtual ~VPDef()
Definition: VPlanValue.h:385
ArrayRef< VPValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:420
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition: VPlanValue.h:398
const VPValue * getVPSingleValue() const
Definition: VPlanValue.h:403
ArrayRef< VPValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:422
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPInstructionSC, VPInterleaveSC, VPReductionSC, VPReplicateSC, VPScalarCastSC, VPScalarIVStepsSC, VPVectorPointerSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenMemoryInstructionSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPWidenPHISC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPFirstOrderRecurrencePHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPReductionPHISC, VPFirstPHISC=VPBlendSC, 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:381
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:410
unsigned getVPDefID() const
Definition: VPlanValue.h:430
VPDef(const unsigned char SC)
Definition: VPlanValue.h:383
const VPValue * getVPValue(unsigned I) const
Definition: VPlanValue.h:414
This is a concrete Recipe that models a single VPlan-level instruction.
Definition: VPlan.h:1139
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition: VPlan.h:713
This class can be used to assign consecutive numbers to all VPValues in a VPlan and allows querying t...
Definition: VPlanValue.h:448
unsigned getSlot(const VPValue *V) const
Definition: VPlanValue.h:462
VPSlotTracker(const VPlan *Plan=nullptr)
Definition: VPlanValue.h:457
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
Definition: VPlanValue.h:204
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition: VPlan.cpp:1327
void removeLastOperand()
Definition: VPlanValue.h:265
operand_range operands()
Definition: VPlanValue.h:279
void setOperand(unsigned I, VPValue *New)
Definition: VPlanValue.h:259
VPUser & operator=(const VPUser &)=delete
unsigned getNumOperands() const
Definition: VPlanValue.h:253
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition: VPlanValue.h:271
VPUser(ArrayRef< VPValue * > Operands, VPUserID ID)
Definition: VPlanValue.h:223
const_operand_iterator op_begin() const
Definition: VPlanValue.h:276
operand_iterator op_end()
Definition: VPlanValue.h:277
const_operand_range operands() const
Definition: VPlanValue.h:280
operand_iterator op_begin()
Definition: VPlanValue.h:275
VPValue * getOperand(unsigned N) const
Definition: VPlanValue.h:254
VPUser(const VPUser &)=delete
VPUser()=delete
virtual bool onlyFirstLaneUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition: VPlanValue.h:294
VPUserID
Subclass identifier (for isa/dyn_cast).
Definition: VPlanValue.h:207
iterator_range< const_operand_iterator > const_operand_range
Definition: VPlanValue.h:273
VPUser(iterator_range< IterT > Operands, VPUserID ID)
Definition: VPlanValue.h:232
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition: VPlanValue.h:270
virtual ~VPUser()
Definition: VPlanValue.h:241
virtual bool onlyFirstPartUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition: VPlanValue.h:302
const_operand_iterator op_end() const
Definition: VPlanValue.h:278
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition: VPlanValue.h:286
iterator_range< operand_iterator > operand_range
Definition: VPlanValue.h:272
void addOperand(VPValue *Operand)
Definition: VPlanValue.h:248
VPUser(std::initializer_list< VPValue * > Operands, VPUserID ID)
Definition: VPlanValue.h:228
VPUserID getVPUserID() const
Definition: VPlanValue.h:246
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
Definition: VPlanValue.h:166
VPValue(Value *UV=nullptr)
Create a live-in VPValue.
Definition: VPlanValue.h:90
Value * getUnderlyingValue()
Return the underlying Value attached to this VPValue.
Definition: VPlanValue.h:78
bool hasMoreThanOneUniqueUser()
Returns true if the value has more than one unique user.
Definition: VPlanValue.h:140
unsigned getVPValueID() const
Definition: VPlanValue.h:103
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Definition: VPlan.cpp:118
void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:1312
void removeUser(VPUser &User)
Remove a single User from the list of users.
Definition: VPlanValue.h:117
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition: VPlanValue.h:126
const_user_iterator user_begin() const
Definition: VPlanValue.h:131
const Value * getLiveInIRValue() const
Definition: VPlanValue.h:179
void addUser(VPUser &User)
Definition: VPlanValue.h:114
Value * UnderlyingVal
Definition: VPlanValue.h:61
VPValue(Value *UV, VPDef *Def)
Create a VPValue for a Def which defines multiple values.
Definition: VPlanValue.h:94
const_user_range users() const
Definition: VPlanValue.h:135
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
@ VPVRecipeSC
A generic VPValue, like live-in values or defined by a recipe that defines multiple values.
Definition: VPlanValue.h:86
void dump() const
Dump the value to stderr (for debugging).
Definition: VPlan.cpp:101
void setUnderlyingValue(Value *Val)
Definition: VPlanValue.h:191
virtual ~VPValue()
Definition: VPlan.cpp:87
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition: VPlanValue.h:125
iterator_range< user_iterator > user_range
Definition: VPlanValue.h:127
const_user_iterator user_end() const
Definition: VPlanValue.h:133
void print(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:94
void replaceAllUsesWith(VPValue *New)
Definition: VPlan.cpp:1280
VPValue(VPDef *Def, Value *UV=nullptr)
Create a VPValue for a Def which is a subclass of VPValue.
Definition: VPlanValue.h:92
user_iterator user_begin()
Definition: VPlanValue.h:130
unsigned getNumUsers() const
Definition: VPlanValue.h:113
Value * getLiveInIRValue()
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
Definition: VPlanValue.h:174
const Value * getUnderlyingValue() const
Definition: VPlanValue.h:79
user_iterator user_end()
Definition: VPlanValue.h:132
bool isLiveIn() const
Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
Definition: VPlanValue.h:169
void replaceUsesWithIf(VPValue *New, llvm::function_ref< bool(VPUser &U, unsigned Idx)> ShouldReplace)
Go through the uses list for this VPValue and make each use point to New if the callback ShouldReplac...
Definition: VPlan.cpp:1284
user_range users()
Definition: VPlanValue.h:134
VPDef * Def
Pointer to the VPDef that defines this VPValue.
Definition: VPlanValue.h:65
iterator_range< const_user_iterator > const_user_range
Definition: VPlanValue.h:128
bool isDefinedOutsideVectorRegions() const
Returns true if the VPValue is defined outside any vector regions, i.e.
Definition: VPlanValue.h:188
A Recipe for widening load/store operations.
Definition: VPlan.h:2230
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:2828
LLVM Value Representation.
Definition: Value.h:74
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:52
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: AddressRanges.h:18
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1751
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:665
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
Definition: STLExtras.h:2068
DenseMap< VPValue *, Value * > VPValue2ValueTy
Definition: VPlanValue.h:198
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1888
DenseMap< Value *, VPValue * > Value2VPValueTy
Definition: VPlanValue.h:197
#define N