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() : VPValue(VPVSymbolicSC, nullptr) {}
282
283 static bool classof(const VPValue *V) {
284 return V->getVPValueID() == VPVSymbolicSC;
285 }
286
287 /// Returns true if this symbolic value has been materialized.
288 bool isMaterialized() const { return Materialized; }
289
290 /// Mark this symbolic value as materialized.
292 assert(!Materialized && "VPSymbolicValue already materialized");
293 Materialized = true;
294 }
295
296private:
297 /// Track whether this symbolic value has been materialized (replaced).
298 /// After materialization, accessing users should trigger an assertion.
299 bool Materialized = false;
300};
301
302/// A VPValue defined by a recipe that produces one or more values.
303class VPRecipeValue : public VPValue {
304 friend class VPValue;
305 friend class VPDef;
306
307 /// Pointer to the VPRecipeBase that defines this VPValue.
308 VPRecipeBase *Def;
309
310#if !defined(NDEBUG)
311 /// Returns true if this VPRecipeValue is defined by \p D.
312 /// NOTE: Only used by VPDef to assert that VPRecipeValues added/removed from
313 /// /p D are associated with its VPRecipeBase,
314 bool isDefinedBy(const VPDef *D) const;
315#endif
316
317public:
319
321
322 static bool classof(const VPValue *V) {
323 return V->getVPValueID() == VPVRecipeValueSC;
324 }
325};
326
327/// This class augments VPValue with operands which provide the inverse def-use
328/// edges from VPValue's users to their defs.
329class VPUser {
330 /// Grant access to removeOperand for VPPhiAccessors, the only supported user.
331 friend class VPPhiAccessors;
332
334
335 /// Removes the operand at index \p Idx. This also removes the VPUser from the
336 /// use-list of the operand.
337 void removeOperand(unsigned Idx) {
338 getOperand(Idx)->removeUser(*this);
339 Operands.erase(Operands.begin() + Idx);
340 }
341
342protected:
343#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
344 /// Print the operands to \p O.
346#endif
347
349 for (VPValue *Operand : Operands)
350 addOperand(Operand);
351 }
352
353public:
354 VPUser() = delete;
355 VPUser(const VPUser &) = delete;
356 VPUser &operator=(const VPUser &) = delete;
357 virtual ~VPUser() {
358 for (VPValue *Op : operands())
359 Op->removeUser(*this);
360 }
361
362 void addOperand(VPValue *Operand) {
363 Operands.push_back(Operand);
364 Operand->addUser(*this);
365 }
366
367 unsigned getNumOperands() const { return Operands.size(); }
368 inline VPValue *getOperand(unsigned N) const {
369 assert(N < Operands.size() && "Operand index out of bounds");
370 return Operands[N];
371 }
372
373 void setOperand(unsigned I, VPValue *New) {
374 Operands[I]->removeUser(*this);
375 Operands[I] = New;
376 New->addUser(*this);
377 }
378
379 /// Swap operands of the VPUser. It must have exactly 2 operands.
381 assert(Operands.size() == 2 && "must have 2 operands to swap");
382 std::swap(Operands[0], Operands[1]);
383 }
384
385 /// Replaces all uses of \p From in the VPUser with \p To.
386 void replaceUsesOfWith(VPValue *From, VPValue *To);
387
392
393 operand_iterator op_begin() { return Operands.begin(); }
394 const_operand_iterator op_begin() const { return Operands.begin(); }
395 operand_iterator op_end() { return Operands.end(); }
396 const_operand_iterator op_end() const { return Operands.end(); }
401
402 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
403 /// returns if only first (scalar) lane is used, as default.
404 virtual bool usesScalars(const VPValue *Op) const {
406 "Op must be an operand of the recipe");
407 return usesFirstLaneOnly(Op);
408 }
409
410 /// Returns true if the VPUser only uses the first lane of operand \p Op.
411 /// Conservatively returns false.
412 virtual bool usesFirstLaneOnly(const VPValue *Op) const {
414 "Op must be an operand of the recipe");
415 return false;
416 }
417
418 /// Returns true if the VPUser only uses the first part of operand \p Op.
419 /// Conservatively returns false.
420 virtual bool usesFirstPartOnly(const VPValue *Op) const {
422 "Op must be an operand of the recipe");
423 return false;
424 }
425};
426
427/// This class augments a recipe with a set of VPValues defined by the recipe.
428/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
429/// the VPValues it defines and is responsible for deleting its defined values.
430/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
431/// from VPDef before VPValue.
432class VPDef {
433 friend class VPRecipeValue;
434
435 /// The VPValues defined by this VPDef.
436 TinyPtrVector<VPRecipeValue *> DefinedValues;
437
438 /// Add \p V as a defined value by this VPDef.
439 void addDefinedValue(VPRecipeValue *V) {
440 assert(V->isDefinedBy(this) &&
441 "can only add VPValue already linked with this VPDef");
442 DefinedValues.push_back(V);
443 }
444
445 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
446 /// value of this VPDef.
447 void removeDefinedValue(VPRecipeValue *V) {
448 assert(V->isDefinedBy(this) &&
449 "can only remove VPValue linked with this VPDef");
450 assert(is_contained(DefinedValues, V) &&
451 "VPValue to remove must be in DefinedValues");
452 llvm::erase(DefinedValues, V);
453 V->Def = nullptr;
454 }
455
456public:
457 VPDef() {}
458
459 virtual ~VPDef() {
460 for (VPRecipeValue *D : to_vector(DefinedValues)) {
461 assert(D->isDefinedBy(this) &&
462 "all defined VPValues should point to the containing VPDef");
463 assert(D->getNumUsers() == 0 &&
464 "all defined VPValues should have no more users");
465 delete D;
466 }
467 }
468
469 /// Returns the only VPValue defined by the VPDef. Can only be called for
470 /// VPDefs with a single defined value.
472 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
473 assert(DefinedValues[0] && "defined value must be non-null");
474 return DefinedValues[0];
475 }
476 const VPValue *getVPSingleValue() const {
477 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
478 assert(DefinedValues[0] && "defined value must be non-null");
479 return DefinedValues[0];
480 }
481
482 /// Returns the VPValue with index \p I defined by the VPDef.
483 VPValue *getVPValue(unsigned I) {
484 assert(DefinedValues[I] && "defined value must be non-null");
485 return DefinedValues[I];
486 }
487 const VPValue *getVPValue(unsigned I) const {
488 assert(DefinedValues[I] && "defined value must be non-null");
489 return DefinedValues[I];
490 }
491
492 /// Returns an ArrayRef of the values defined by the VPDef.
493 ArrayRef<VPRecipeValue *> definedValues() { return DefinedValues; }
494 /// Returns an ArrayRef of the values defined by the VPDef.
495 ArrayRef<VPRecipeValue *> definedValues() const { return DefinedValues; }
496
497 /// Returns the number of values defined by the VPDef.
498 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
499};
500
503 !cast<VPSymbolicValue>(this)->isMaterialized()) &&
504 "accessing materialized symbolic value");
505}
506
507} // namespace llvm
508
509#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
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
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:432
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition VPlanValue.h:498
virtual ~VPDef()
Definition VPlanValue.h:459
friend class VPRecipeValue
Definition VPlanValue.h:433
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition VPlanValue.h:471
const VPValue * getVPSingleValue() const
Definition VPlanValue.h:476
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
Definition VPlanValue.h:483
ArrayRef< VPRecipeValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:495
ArrayRef< VPRecipeValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition VPlanValue.h:493
const VPValue * getVPValue(unsigned I) const
Definition VPlanValue.h:487
Helper type to provide functions to access incoming values and blocks for phi-like recipes.
Definition VPlan.h:1581
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition VPlan.h:406
A VPValue defined by a recipe that produces one or more values.
Definition VPlanValue.h:303
virtual LLVM_ABI_FOR_TEST ~VPRecipeValue()
Definition VPlan.cpp:149
LLVM_ABI_FOR_TEST VPRecipeValue(VPRecipeBase *Def, Value *UV=nullptr)
Definition VPlan.cpp:143
friend class VPDef
Definition VPlanValue.h:305
friend class VPValue
Definition VPlanValue.h:304
static bool classof(const VPValue *V)
Definition VPlanValue.h:322
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
Definition VPlan.h:4370
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:329
void replaceUsesOfWith(VPValue *From, VPValue *To)
Replaces all uses of From in the VPUser with To.
Definition VPlan.cpp:1532
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition VPlan.cpp:1544
operand_range operands()
Definition VPlanValue.h:397
void setOperand(unsigned I, VPValue *New)
Definition VPlanValue.h:373
VPUser & operator=(const VPUser &)=delete
friend class VPPhiAccessors
Grant access to removeOperand for VPPhiAccessors, the only supported user.
Definition VPlanValue.h:331
unsigned getNumOperands() const
Definition VPlanValue.h:367
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition VPlanValue.h:389
const_operand_iterator op_begin() const
Definition VPlanValue.h:394
operand_iterator op_end()
Definition VPlanValue.h:395
const_operand_range operands() const
Definition VPlanValue.h:398
operand_iterator op_begin()
Definition VPlanValue.h:393
VPValue * getOperand(unsigned N) const
Definition VPlanValue.h:368
VPUser(ArrayRef< VPValue * > Operands)
Definition VPlanValue.h:348
VPUser(const VPUser &)=delete
VPUser()=delete
iterator_range< const_operand_iterator > const_operand_range
Definition VPlanValue.h:391
virtual bool usesFirstPartOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition VPlanValue.h:420
void swapOperands()
Swap operands of the VPUser. It must have exactly 2 operands.
Definition VPlanValue.h:380
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition VPlanValue.h:388
virtual ~VPUser()
Definition VPlanValue.h:357
virtual bool usesFirstLaneOnly(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition VPlanValue.h:412
const_operand_iterator op_end() const
Definition VPlanValue.h:396
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition VPlanValue.h:404
iterator_range< operand_iterator > operand_range
Definition VPlanValue.h:390
void addOperand(VPValue *Operand)
Definition VPlanValue.h:362
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:127
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:501
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:2200
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:1947
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: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:141
void markMaterialized()
Mark this symbolic value as materialized.
Definition VPlanValue.h:291
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:288