Lines Matching defs:VPValue
13 /// VPValue VPUser VPDef
46 class VPValue {
64 // Hold the underlying Value, if any, attached to this VPValue.
67 /// Pointer to the VPDef that defines this VPValue. If it is nullptr, the
68 /// VPValue is not defined by any recipe modeled in VPlan.
71 VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
73 /// Create a live-in VPValue.
74 VPValue(Value *UV = nullptr) : VPValue(VPValueSC, UV, nullptr) {}
75 /// Create a VPValue for a \p Def which is a subclass of VPValue.
76 VPValue(VPDef *Def, Value *UV = nullptr) : VPValue(VPVRecipeSC, UV, Def) {}
77 /// Create a VPValue for a \p Def which defines multiple values.
78 VPValue(Value *UV, VPDef *Def) : VPValue(VPValueSC, UV, Def) {}
88 /// Return the underlying Value attached to this VPValue.
91 /// An enumeration for keeping track of the concrete subclass of VPValue that
94 VPValueSC, /// A generic VPValue, like live-in values or defined by a recipe
96 VPVRecipeSC /// A VPValue sub-class that is a VPRecipeBase.
99 VPValue(const VPValue &) = delete;
100 VPValue &operator=(const VPValue &) = delete;
102 virtual ~VPValue();
122 // The same user can be added multiple times, e.g. because the same VPValue
155 void replaceAllUsesWith(VPValue *New);
157 /// Go through the uses list for this VPValue and make each use point to \p
161 VPValue *New,
164 /// Returns the recipe defining this VPValue or nullptr if it is not defined
169 /// Returns true if this VPValue is defined by a recipe.
172 /// Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
175 /// Returns the underlying IR value, if this VPValue is defined outside the
176 /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
180 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
185 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
189 /// Returns true if the VPValue is defined outside any loop region.
192 // Set \p Val as the underlying Value of this VPValue.
199 typedef DenseMap<Value *, VPValue *> Value2VPValueTy;
200 typedef DenseMap<VPValue *, Value *> VPValue2ValueTy;
202 raw_ostream &operator<<(raw_ostream &OS, const VPValue &V);
204 /// This class augments VPValue with operands which provide the inverse def-use
205 /// edges from VPValue's users to their defs.
207 SmallVector<VPValue *, 2> Operands;
215 VPUser(ArrayRef<VPValue *> Operands) {
216 for (VPValue *Operand : Operands)
220 VPUser(std::initializer_list<VPValue *> Operands)
221 : VPUser(ArrayRef<VPValue *>(Operands)) {}
224 for (VPValue *Operand : Operands)
233 for (VPValue *Op : operands())
237 void addOperand(VPValue *Operand) {
243 inline VPValue *getOperand(unsigned N) const {
248 void setOperand(unsigned I, VPValue *New) {
254 typedef SmallVectorImpl<VPValue *>::iterator operand_iterator;
255 typedef SmallVectorImpl<VPValue *>::const_iterator const_operand_iterator;
270 virtual bool usesScalars(const VPValue *Op) const {
278 virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
286 virtual bool onlyFirstPartUsed(const VPValue *Op) const {
296 /// Single-value VPDefs that also inherit from VPValue must make sure to inherit
297 /// from VPDef before VPValue.
299 friend class VPValue;
305 TinyPtrVector<VPValue *> DefinedValues;
308 void addDefinedValue(VPValue *V) {
310 "can only add VPValue already linked with this VPDef");
316 void removeDefinedValue(VPValue *V) {
317 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
319 "VPValue to remove must be in DefinedValues");
382 for (VPValue *D : make_early_inc_range(DefinedValues)) {
392 /// Returns the only VPValue defined by the VPDef. Can only be called for
394 VPValue *getVPSingleValue() {
399 const VPValue *getVPSingleValue() const {
405 /// Returns the VPValue with index \p I defined by the VPDef.
406 VPValue *getVPValue(unsigned I) {
410 const VPValue *getVPValue(unsigned I) const {
416 ArrayRef<VPValue *> definedValues() { return DefinedValues; }
418 ArrayRef<VPValue *> definedValues() const { return DefinedValues; }
450 DenseMap<const VPValue *, std::string> VPValue2Name;
454 /// Number to assign to the next VPValue without underlying value.
457 void assignName(const VPValue *V);
470 std::string getOrCreateName(const VPValue *V) const;