Lines Matching defs:VPValue
13 /// VPValue VPUser VPDef
44 class VPValue {
59 // Hold the underlying Value, if any, attached to this VPValue.
62 /// Pointer to the VPDef that defines this VPValue. If it is nullptr, the
63 /// VPValue is not defined by any recipe modeled in VPlan.
66 VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
76 /// Return the underlying Value attached to this VPValue.
79 /// An enumeration for keeping track of the concrete subclass of VPValue that
82 VPValueSC, /// A generic VPValue, like live-in values or defined by a recipe
84 VPVRecipeSC /// A VPValue sub-class that is a VPRecipeBase.
87 /// Create a live-in VPValue.
88 VPValue(Value *UV = nullptr) : VPValue(VPValueSC, UV, nullptr) {}
89 /// Create a VPValue for a \p Def which is a subclass of VPValue.
90 VPValue(VPDef *Def, Value *UV = nullptr) : VPValue(VPVRecipeSC, UV, Def) {}
91 /// Create a VPValue for a \p Def which defines multiple values.
92 VPValue(Value *UV, VPDef *Def) : VPValue(VPValueSC, UV, Def) {}
93 VPValue(const VPValue &) = delete;
94 VPValue &operator=(const VPValue &) = delete;
96 virtual ~VPValue();
116 // The same user can be added multiple times, e.g. because the same VPValue
149 void replaceAllUsesWith(VPValue *New);
151 /// Go through the uses list for this VPValue and make each use point to \p
155 VPValue *New,
158 /// Returns the recipe defining this VPValue or nullptr if it is not defined
163 /// Returns true if this VPValue is defined by a recipe.
166 /// Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
169 /// Returns the underlying IR value, if this VPValue is defined outside the
170 /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
174 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
179 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
183 /// Returns true if the VPValue is defined outside any vector regions, i.e. it
188 // Set \p Val as the underlying Value of this VPValue.
195 typedef DenseMap<Value *, VPValue *> Value2VPValueTy;
196 typedef DenseMap<VPValue *, Value *> VPValue2ValueTy;
198 raw_ostream &operator<<(raw_ostream &OS, const VPValue &V);
200 /// This class augments VPValue with operands which provide the inverse def-use
201 /// edges from VPValue's users to their defs.
211 SmallVector<VPValue *, 2> Operands;
221 VPUser(ArrayRef<VPValue *> Operands, VPUserID ID) : ID(ID) {
222 for (VPValue *Operand : Operands)
226 VPUser(std::initializer_list<VPValue *> Operands, VPUserID ID)
227 : VPUser(ArrayRef<VPValue *>(Operands), ID) {}
231 for (VPValue *Operand : Operands)
240 for (VPValue *Op : operands())
246 void addOperand(VPValue *Operand) {
252 inline VPValue *getOperand(unsigned N) const {
257 void setOperand(unsigned I, VPValue *New) {
263 typedef SmallVectorImpl<VPValue *>::iterator operand_iterator;
264 typedef SmallVectorImpl<VPValue *>::const_iterator const_operand_iterator;
279 virtual bool usesScalars(const VPValue *Op) const {
287 virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
295 virtual bool onlyFirstPartUsed(const VPValue *Op) const {
305 /// Single-value VPDefs that also inherit from VPValue must make sure to inherit
306 /// from VPDef before VPValue.
308 friend class VPValue;
314 TinyPtrVector<VPValue *> DefinedValues;
317 void addDefinedValue(VPValue *V) {
319 "can only add VPValue already linked with this VPDef");
325 void removeDefinedValue(VPValue *V) {
326 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
328 "VPValue to remove must be in DefinedValues");
384 for (VPValue *D : make_early_inc_range(DefinedValues)) {
394 /// Returns the only VPValue defined by the VPDef. Can only be called for
396 VPValue *getVPSingleValue() {
401 const VPValue *getVPSingleValue() const {
407 /// Returns the VPValue with index \p I defined by the VPDef.
408 VPValue *getVPValue(unsigned I) {
412 const VPValue *getVPValue(unsigned I) const {
418 ArrayRef<VPValue *> definedValues() { return DefinedValues; }
420 ArrayRef<VPValue *> definedValues() const { return DefinedValues; }
452 DenseMap<const VPValue *, std::string> VPValue2Name;
456 /// Number to assign to the next VPValue without underlying value.
459 void assignName(const VPValue *V);
472 std::string getOrCreateName(const VPValue *V) const;