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"
28#include "llvm/IR/DebugLoc.h"
31
32namespace llvm {
33
34// Forward declarations.
35class raw_ostream;
36class Type;
37class Value;
38class VPDef;
39class VPSlotTracker;
40class VPUser;
41class VPRecipeBase;
42class VPPhiAccessors;
43class VPRegionValue;
44class VPRegionBlock;
45
46/// This is the base class of the VPlan Def/Use graph, used for modeling the
47/// data flow into, within and out of the VPlan. VPValues can stand for live-ins
48/// coming from the input IR, symbolic values and values defined by recipes.
49class LLVM_ABI_FOR_TEST VPValue {
50 friend struct VPIRValue;
51 friend struct VPSymbolicValue;
52 friend class VPRecipeValue;
53 friend class VPRegionValue;
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 VPRegionValueSC, /// A VPValue sub-class that is defined by a region, like
86 /// the canonical IV of a loop region.
87 };
88
89 VPValue(const VPValue &) = delete;
90 VPValue &operator=(const VPValue &) = delete;
91
92 virtual ~VPValue() {
93 assert(Users.empty() && "trying to delete a VPValue with remaining users");
94 }
95
96 /// \return an ID for the concrete type of this object.
97 /// This is used to implement the classof checks. This should not be used
98 /// for any other purpose, as the values may change as LLVM evolves.
99 unsigned getVPValueID() const { return SubclassID; }
100
101#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
102 void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
103 void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
104
105 /// Dump the value to stderr (for debugging).
106 void dump() const;
107#endif
108
109 /// Assert that this VPValue has not been materialized, if it is a
110 /// VPSymbolicValue.
111 void assertNotMaterialized() const;
112
113 unsigned getNumUsers() const {
114 if (Users.empty())
115 return 0;
117 return Users.size();
118 }
121 Users.push_back(&User);
122 }
123
124 /// Remove a single \p User from the list of users.
127 // The same user can be added multiple times, e.g. because the same VPValue
128 // is used twice by the same VPUser. Remove a single one.
129 auto *I = find(Users, &User);
130 if (I != Users.end())
131 Users.erase(I);
132 }
133
138
141 return Users.begin();
142 }
145 return Users.begin();
146 }
149 return Users.end();
150 }
153 return Users.end();
154 }
158 }
159
160 /// Returns true if the value has more than one unique user.
162 if (getNumUsers() == 0)
163 return false;
164
165 // Check if all users match the first user.
166 auto Current = std::next(user_begin());
167 while (Current != user_end() && *user_begin() == *Current)
168 Current++;
169 return Current != user_end();
170 }
171
172 bool hasOneUse() const { return getNumUsers() == 1; }
173
174 /// Return the single user of this value, or nullptr if there is not exactly
175 /// one user.
176 VPUser *getSingleUser() { return hasOneUse() ? *user_begin() : nullptr; }
177 const VPUser *getSingleUser() const {
178 return hasOneUse() ? *user_begin() : nullptr;
179 }
180
181 void replaceAllUsesWith(VPValue *New);
182
183 /// Go through the uses list for this VPValue and make each use point to \p
184 /// New if the callback ShouldReplace returns true for the given use specified
185 /// by a pair of (VPUser, the use index).
186 void replaceUsesWithIf(
187 VPValue *New,
188 llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
189
190 /// Returns the recipe defining this VPValue or nullptr if it is not defined
191 /// by a recipe, i.e. is a live-in.
192 VPRecipeBase *getDefiningRecipe();
193 const VPRecipeBase *getDefiningRecipe() const;
194
195 /// Returns true if this VPValue is defined by a recipe.
196 bool hasDefiningRecipe() const { return getDefiningRecipe(); }
197
198 /// Returns true if the VPValue is defined outside any loop.
199 bool isDefinedOutsideLoopRegions() const;
200
201 // Set \p Val as the underlying Value of this VPValue.
203 assert(!UnderlyingVal && "Underlying Value is already set.");
204 UnderlyingVal = Val;
205 }
206};
207
208/// VPValues defined by a VPRegionBlock, like the canonical IV.
209class VPRegionValue : public VPValue {
210 VPRegionBlock *DefiningRegion;
211 Type *Ty;
212 DebugLoc DL;
213
214public:
216 : VPValue(VPValue::VPRegionValueSC), DefiningRegion(Region), Ty(Ty),
217 DL(DL) {}
218
219 ~VPRegionValue() override = default;
220
221 /// Returns the region that defines this value.
222 VPRegionBlock *getDefiningRegion() const { return DefiningRegion; }
223
224 /// Returns the type of the VPRegionValue.
225 Type *getType() const { return Ty; }
226
227 /// Returns the debug location of the VPRegionValue.
228 DebugLoc getDebugLoc() const { return DL; }
229
230 static inline bool classof(const VPValue *V) {
231 return V->getVPValueID() == VPValue::VPRegionValueSC;
232 }
233};
234
235LLVM_ABI_FOR_TEST raw_ostream &operator<<(raw_ostream &OS,
236 const VPRecipeBase &R);
237
238/// A VPValue representing a live-in from the input IR or a constant. It wraps
239/// an underlying IR Value.
240struct VPIRValue : public VPValue {
241 VPIRValue(Value *UV) : VPValue(VPVIRValueSC, UV) {
242 assert(UV && "VPIRValue requires an underlying IR value");
243 }
244
245 /// Returns the underlying IR value.
246 Value *getValue() const { return getUnderlyingValue(); }
247
248 /// Returns the type of the underlying IR value.
249 Type *getType() const;
250
251 static bool classof(const VPValue *V) {
252 return V->getVPValueID() == VPVIRValueSC;
253 }
254};
255
256/// An overlay on VPIRValue for VPValues that wrap a ConstantInt. Provides
257/// convenient accessors for the underlying constant.
258struct VPConstantInt : public VPIRValue {
260
261 static bool classof(const VPValue *V) {
262 return isa<VPIRValue>(V) && isa<ConstantInt>(V->getUnderlyingValue());
263 }
264
265 bool isOne() const { return getAPInt().isOne(); }
266
267 bool isZero() const { return getAPInt().isZero(); }
268
269 const APInt &getAPInt() const {
270 return cast<ConstantInt>(getValue())->getValue();
271 }
272
273 unsigned getBitWidth() const { return getAPInt().getBitWidth(); }
274
276};
277
278/// A symbolic live-in VPValue, used for values like vector trip count, VF, and
279/// VFxUF.
280struct VPSymbolicValue : public VPValue {
281 VPSymbolicValue(Type *Ty) : VPValue(VPVSymbolicSC, nullptr), Ty(Ty) {}
282
283 static bool classof(const VPValue *V) {
284 return V->getVPValueID() == VPVSymbolicSC;
285 }
286
287 /// Returns the scalar type of this symbolic value.
288 Type *getType() const { return Ty; }
289
290 /// Returns true if this symbolic value has been materialized.
291 bool isMaterialized() const { return Materialized; }
292
293 /// Mark this symbolic value as materialized.
295 assert(!Materialized && "VPSymbolicValue already materialized");
296 Materialized = true;
297 }
298
299private:
300 /// The scalar type of this symbolic value.
301 Type *Ty;
302
303 /// Track whether this symbolic value has been materialized (replaced).
304 /// After materialization, accessing users should trigger an assertion.
305 bool Materialized = false;
306};
307
308/// A VPValue defined by a recipe that produces one or more values.
309class VPRecipeValue : public VPValue {
310 friend class VPValue;
311 friend class VPDef;
312
313 /// Pointer to the VPRecipeBase that defines this VPValue.
314 VPRecipeBase *Def;
315
316#if !defined(NDEBUG)
317 /// Returns true if this VPRecipeValue is defined by \p D.
318 /// NOTE: Only used by VPDef to assert that VPRecipeValues added/removed from
319 /// /p D are associated with its VPRecipeBase,
320 bool isDefinedBy(const VPDef *D) const;
321#endif
322
323public:
325
327
328 static bool classof(const VPValue *V) {
329 return V->getVPValueID() == VPVRecipeValueSC;
330 }
331};
332
333/// This class augments VPValue with operands which provide the inverse def-use
334/// edges from VPValue's users to their defs.
335class VPUser {
336 /// Grant access to removeOperand for VPPhiAccessors, the only supported user.
337 friend class VPPhiAccessors;
338
340
341 /// Removes the operand at index \p Idx. This also removes the VPUser from the
342 /// use-list of the operand.
343 void removeOperand(unsigned Idx) {
344 getOperand(Idx)->removeUser(*this);
345 Operands.erase(Operands.begin() + Idx);
346 }
347
348protected:
349#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
350 /// Print the operands to \p O.
352#endif
353
355 for (VPValue *Operand : Operands)
356 addOperand(Operand);
357 }
358
359public:
360 VPUser() = delete;
361 VPUser(const VPUser &) = delete;
362 VPUser &operator=(const VPUser &) = delete;
363 virtual ~VPUser() {
364 for (VPValue *Op : operands())
365 Op->removeUser(*this);
366 }
367
368 void addOperand(VPValue *Operand) {
369 Operands.push_back(Operand);
370 Operand->addUser(*this);
371 }
372
373 unsigned getNumOperands() const { return Operands.size(); }
374 inline VPValue *getOperand(unsigned N) const {
375 assert(N < Operands.size() && "Operand index out of bounds");
376 return Operands[N];
377 }
378
379 void setOperand(unsigned I, VPValue *New) {
380 Operands[I]->removeUser(*this);
381 Operands[I] = New;
382 New->addUser(*this);
383 }
384
385 /// Swap operands of the VPUser. It must have exactly 2 operands.
387 assert(Operands.size() == 2 && "must have 2 operands to swap");
388 std::swap(Operands[0], Operands[1]);
389 }
390
391 /// Replaces all uses of \p From in the VPUser with \p To.
392 void replaceUsesOfWith(VPValue *From, VPValue *To);
393
398
399 operand_iterator op_begin() { return Operands.begin(); }
400 const_operand_iterator op_begin() const { return Operands.begin(); }
401 operand_iterator op_end() { return Operands.end(); }
402 const_operand_iterator op_end() const { return Operands.end(); }
407
408 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
409 /// returns if only first (scalar) lane is used, as default.
410 virtual bool usesScalars(const VPValue *Op) const {
412 "Op must be an operand of the recipe");
413 return usesFirstLaneOnly(Op);
414 }
415
416 /// Returns true if the VPUser only uses the first lane of operand \p Op.
417 /// Conservatively returns false.
418 virtual bool usesFirstLaneOnly(const VPValue *Op) const {
420 "Op must be an operand of the recipe");
421 return false;
422 }
423
424 /// Returns true if the VPUser only uses the first part of operand \p Op.
425 /// Conservatively returns false.
426 virtual bool usesFirstPartOnly(const VPValue *Op) const {
428 "Op must be an operand of the recipe");
429 return false;
430 }
431};
432
433/// This class augments a recipe with a set of VPValues defined by the recipe.
434/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
435/// the VPValues it defines and is responsible for deleting its defined values.
436/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
437/// from VPDef before VPValue.
438class VPDef {
439 friend class VPRecipeValue;
440
441 /// The VPValues defined by this VPDef.
442 TinyPtrVector<VPRecipeValue *> DefinedValues;
443
444 /// Add \p V as a defined value by this VPDef.
445 void addDefinedValue(VPRecipeValue *V) {
446 assert(V->isDefinedBy(this) &&
447 "can only add VPValue already linked with this VPDef");
448 DefinedValues.push_back(V);
449 }
450
451 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
452 /// value of this VPDef.
453 void removeDefinedValue(VPRecipeValue *V) {
454 assert(V->isDefinedBy(this) &&
455 "can only remove VPValue linked with this VPDef");
456 assert(is_contained(DefinedValues, V) &&
457 "VPValue to remove must be in DefinedValues");
458 llvm::erase(DefinedValues, V);
459 V->Def = nullptr;
460 }
461
462public:
463 VPDef() {}
464
465 virtual ~VPDef() {
466 for (VPRecipeValue *D : to_vector(DefinedValues)) {
467 assert(D->isDefinedBy(this) &&
468 "all defined VPValues should point to the containing VPDef");
469 assert(D->getNumUsers() == 0 &&
470 "all defined VPValues should have no more users");
471 delete D;
472 }
473 }
474
475 /// Returns the only VPValue defined by the VPDef. Can only be called for
476 /// VPDefs with a single defined value.
478 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
479 assert(DefinedValues[0] && "defined value must be non-null");
480 return DefinedValues[0];
481 }
482 const VPValue *getVPSingleValue() const {
483 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
484 assert(DefinedValues[0] && "defined value must be non-null");
485 return DefinedValues[0];
486 }
487
488 /// Returns the VPValue with index \p I defined by the VPDef.
489 VPValue *getVPValue(unsigned I) {
490 assert(DefinedValues[I] && "defined value must be non-null");
491 return DefinedValues[I];
492 }
493 const VPValue *getVPValue(unsigned I) const {
494 assert(DefinedValues[I] && "defined value must be non-null");
495 return DefinedValues[I];
496 }
497
498 /// Returns an ArrayRef of the values defined by the VPDef.
499 ArrayRef<VPRecipeValue *> definedValues() { return DefinedValues; }
500 /// Returns an ArrayRef of the values defined by the VPDef.
501 ArrayRef<VPRecipeValue *> definedValues() const { return DefinedValues; }
502
503 /// Returns the number of values defined by the VPDef.
504 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
505};
506
509 !cast<VPSymbolicValue>(this)->isMaterialized()) &&
510 "accessing materialized symbolic value");
511}
512
513} // namespace llvm
514
515#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:1563
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:1511
bool isOne() const
Determine if this is a value of 1.
Definition APInt.h:390
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
A debug info location.
Definition DebugLoc.h:123
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...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
This class augments a recipe with a set of VPValues defined by the recipe.
Definition VPlanValue.h:438
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition VPlanValue.h:504
virtual ~VPDef()
Definition VPlanValue.h:465
friend class VPRecipeValue
Definition VPlanValue.h:439
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition VPlanValue.h:477
const VPValue * getVPSingleValue() const
Definition VPlanValue.h:482
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
Definition VPlanValue.h:489
ArrayRef< VPRecipeValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:501
ArrayRef< VPRecipeValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:499
const VPValue * getVPValue(unsigned I) const
Definition VPlanValue.h:493
Helper type to provide functions to access incoming values and blocks for phi-like recipes.
Definition VPlan.h:1574
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition VPlan.h:401
A VPValue defined by a recipe that produces one or more values.
Definition VPlanValue.h:309
virtual LLVM_ABI_FOR_TEST ~VPRecipeValue()
Definition VPlan.cpp:150
LLVM_ABI_FOR_TEST VPRecipeValue(VPRecipeBase *Def, Value *UV=nullptr)
Definition VPlan.cpp:144
friend class VPDef
Definition VPlanValue.h:311
friend class VPValue
Definition VPlanValue.h:310
static bool classof(const VPValue *V)
Definition VPlanValue.h:328
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
Definition VPlan.h:4358
VPValues defined by a VPRegionBlock, like the canonical IV.
Definition VPlanValue.h:209
Type * getType() const
Returns the type of the VPRegionValue.
Definition VPlanValue.h:225
static bool classof(const VPValue *V)
Definition VPlanValue.h:230
~VPRegionValue() override=default
VPRegionValue(Type *Ty, DebugLoc DL, VPRegionBlock *Region)
Definition VPlanValue.h:215
DebugLoc getDebugLoc() const
Returns the debug location of the VPRegionValue.
Definition VPlanValue.h:228
VPRegionBlock * getDefiningRegion() const
Returns the region that defines this value.
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:335
void replaceUsesOfWith(VPValue *From, VPValue *To)
Replaces all uses of From in the VPUser with To.
Definition VPlan.cpp:1512
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition VPlan.cpp:1524
operand_range operands()
Definition VPlanValue.h:403
void setOperand(unsigned I, VPValue *New)
Definition VPlanValue.h:379
VPUser & operator=(const VPUser &)=delete
friend class VPPhiAccessors
Grant access to removeOperand for VPPhiAccessors, the only supported user.
Definition VPlanValue.h:337
unsigned getNumOperands() const
Definition VPlanValue.h:373
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition VPlanValue.h:395
const_operand_iterator op_begin() const
Definition VPlanValue.h:400
operand_iterator op_end()
Definition VPlanValue.h:401
const_operand_range operands() const
Definition VPlanValue.h:404
operand_iterator op_begin()
Definition VPlanValue.h:399
VPValue * getOperand(unsigned N) const
Definition VPlanValue.h:374
VPUser(ArrayRef< VPValue * > Operands)
Definition VPlanValue.h:354
VPUser(const VPUser &)=delete
VPUser()=delete
iterator_range< const_operand_iterator > const_operand_range
Definition VPlanValue.h:397
virtual bool usesFirstPartOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition VPlanValue.h:426
void swapOperands()
Swap operands of the VPUser. It must have exactly 2 operands.
Definition VPlanValue.h:386
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition VPlanValue.h:394
virtual ~VPUser()
Definition VPlanValue.h:363
virtual bool usesFirstLaneOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition VPlanValue.h:418
const_operand_iterator op_end() const
Definition VPlanValue.h:402
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition VPlanValue.h:410
iterator_range< operand_iterator > operand_range
Definition VPlanValue.h:396
void addOperand(VPValue *Operand)
Definition VPlanValue.h:368
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
Definition VPlanValue.h:49
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
Definition VPlanValue.h:196
virtual ~VPValue()
Definition VPlanValue.h:92
unsigned getVPValueID() const
Definition VPlanValue.h:99
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Definition VPlan.cpp:128
void removeUser(VPUser &User)
Remove a single User from the list of users.
Definition VPlanValue.h:125
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition VPlanValue.h:135
friend class VPRecipeValue
Definition VPlanValue.h:52
const_user_iterator user_begin() const
Definition VPlanValue.h:143
void assertNotMaterialized() const
Assert that this VPValue has not been materialized, if it is a VPSymbolicValue.
Definition VPlanValue.h:507
friend struct VPIRValue
Definition VPlanValue.h:50
void addUser(VPUser &User)
Definition VPlanValue.h:119
bool hasMoreThanOneUniqueUser() const
Returns true if the value has more than one unique user.
Definition VPlanValue.h:161
Value * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
Definition VPlanValue.h:74
const_user_range users() const
Definition VPlanValue.h:156
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
@ VPVSymbolicSC
A live-in VPValue wrapping an IR Value.
Definition VPlanValue.h:83
@ VPRegionValueSC
A VPValue defined by a recipe.
Definition VPlanValue.h:85
@ VPVRecipeValueSC
A symbolic live-in VPValue without IR backing.
Definition VPlanValue.h:84
bool hasOneUse() const
Definition VPlanValue.h:172
const VPUser * getSingleUser() const
Definition VPlanValue.h:177
void setUnderlyingValue(Value *Val)
Definition VPlanValue.h:202
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition VPlanValue.h:134
iterator_range< user_iterator > user_range
Definition VPlanValue.h:136
const_user_iterator user_end() const
Definition VPlanValue.h:151
VPUser * getSingleUser()
Return the single user of this value, or nullptr if there is not exactly one user.
Definition VPlanValue.h:176
user_iterator user_begin()
Definition VPlanValue.h:139
unsigned getNumUsers() const
Definition VPlanValue.h:113
friend struct VPSymbolicValue
Definition VPlanValue.h:51
friend class VPRegionValue
Definition VPlanValue.h:53
user_iterator user_end()
Definition VPlanValue.h:147
user_range users()
Definition VPlanValue.h:155
iterator_range< const_user_iterator > const_user_range
Definition VPlanValue.h:137
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.
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:2199
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:1946
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:876
#define N
VPConstantInt(ConstantInt *CI)
Definition VPlanValue.h:259
static bool classof(const VPValue *V)
Definition VPlanValue.h:261
bool isZero() const
Definition VPlanValue.h:267
const APInt & getAPInt() const
Definition VPlanValue.h:269
uint64_t getZExtValue() const
Definition VPlanValue.h:275
unsigned getBitWidth() const
Definition VPlanValue.h:273
bool isOne() const
Definition VPlanValue.h:265
VPIRValue(Value *UV)
Definition VPlanValue.h:241
Value * getValue() const
Returns the underlying IR value.
Definition VPlanValue.h:246
static bool classof(const VPValue *V)
Definition VPlanValue.h:251
Type * getType() const
Returns the type of the underlying IR value.
Definition VPlan.cpp:142
VPSymbolicValue(Type *Ty)
Definition VPlanValue.h:281
void markMaterialized()
Mark this symbolic value as materialized.
Definition VPlanValue.h:294
Type * getType() const
Returns the scalar type of this symbolic value.
Definition VPlanValue.h:288
static bool classof(const VPValue *V)
Definition VPlanValue.h:283
bool isMaterialized() const
Returns true if this symbolic value has been materialized.
Definition VPlanValue.h:291