Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Vectorize/VPlan.h
Show First 20 Lines • Show All 1,011 Lines • ▼ Show 20 Lines | public: | ||||
/// Print the recipe. | /// Print the recipe. | ||||
void print(raw_ostream &O, const Twine &Indent, | void print(raw_ostream &O, const Twine &Indent, | ||||
VPSlotTracker &SlotTracker) const override; | VPSlotTracker &SlotTracker) const override; | ||||
}; | }; | ||||
/// VPInterleaveRecipe is a recipe for transforming an interleave group of load | /// VPInterleaveRecipe is a recipe for transforming an interleave group of load | ||||
/// or stores into one wide load/store and shuffles. | /// or stores into one wide load/store and shuffles. | ||||
class VPInterleaveRecipe : public VPRecipeBase, public VPUser { | class VPInterleaveRecipe : public VPRecipeBase, public VPValue, public VPUser { | ||||
const InterleaveGroup<Instruction> *IG; | const InterleaveGroup<Instruction> *IG; | ||||
public: | public: | ||||
SmallVector<VPValue *, 4> Defs; | |||||
VPInterleaveRecipe(const InterleaveGroup<Instruction> *IG, VPValue *Addr, | VPInterleaveRecipe(const InterleaveGroup<Instruction> *IG, VPValue *Addr, | ||||
VPValue *Mask) | VPValue *Mask) | ||||
: VPRecipeBase(VPInterleaveSC), VPUser({Addr}), IG(IG) { | : VPRecipeBase(VPRecipeBase::VPInterleaveSC), | ||||
VPValue(VPValue::VPVInterleaveSC), VPUser({Addr}), IG(IG) { | |||||
dmgreen: -> VPRecipeBase::VPInterleaveSC | |||||
if (Mask) | if (Mask) | ||||
addOperand(Mask); | addOperand(Mask); | ||||
for (unsigned i = 0; i < IG->getNumMembers(); i++) | |||||
Defs.push_back(new VPValue(this)); | |||||
Not Done ReplyInline ActionsDoes anything delete these Defs? dmgreen: Does anything delete these Defs? | |||||
They should be freed in the destructor. Done now. fhahn: They should be freed in the destructor. Done now. | |||||
} | |||||
~VPInterleaveRecipe() override { | |||||
for (auto *Def : Defs) | |||||
delete Def; | |||||
} | } | ||||
~VPInterleaveRecipe() override = default; | |||||
/// Method to support type inquiry through isa, cast, and dyn_cast. | /// Method to support type inquiry through isa, cast, and dyn_cast. | ||||
static inline bool classof(const VPRecipeBase *V) { | static inline bool classof(const VPRecipeBase *V) { | ||||
return V->getVPRecipeID() == VPRecipeBase::VPInterleaveSC; | return V->getVPRecipeID() == VPRecipeBase::VPInterleaveSC; | ||||
} | } | ||||
static inline bool classof(const VPValue *V) { | |||||
return V->getVPValueID() == VPValue::VPVInterleaveSC; | |||||
} | |||||
/// Return the address accessed by this recipe. | /// Return the address accessed by this recipe. | ||||
VPValue *getAddr() const { | VPValue *getAddr() const { | ||||
return getOperand(0); // Address is the 1st, mandatory operand. | return getOperand(0); // Address is the 1st, mandatory operand. | ||||
} | } | ||||
/// Return the mask used by this recipe. Note that a full mask is represented | /// Return the mask used by this recipe. Note that a full mask is represented | ||||
/// by a nullptr. | /// by a nullptr. | ||||
VPValue *getMask() const { | VPValue *getMask() const { | ||||
// Mask is optional and therefore the last, currently 2nd operand. | // Mask is optional and therefore the last, currently 2nd operand. | ||||
return getNumOperands() == 2 ? getOperand(1) : nullptr; | return getNumOperands() == 2 ? getOperand(1) : nullptr; | ||||
} | } | ||||
/// Generate the wide load or store, and shuffles. | /// Generate the wide load or store, and shuffles. | ||||
void execute(VPTransformState &State) override; | void execute(VPTransformState &State) override; | ||||
/// Print the recipe. | /// Print the recipe. | ||||
void print(raw_ostream &O, const Twine &Indent, | void print(raw_ostream &O, const Twine &Indent, | ||||
VPSlotTracker &SlotTracker) const override; | VPSlotTracker &SlotTracker) const override; | ||||
const InterleaveGroup<Instruction> *getInterleaveGroup() { return IG; } | const InterleaveGroup<Instruction> *getInterleaveGroup() { return IG; } | ||||
VPValue *getResult(unsigned Idx) { return Defs[Idx]; } | |||||
ArrayRef<VPValue *> getDefs() { return Defs; } | |||||
}; | }; | ||||
/// A recipe to represent inloop reduction operations, performing a reduction on | /// A recipe to represent inloop reduction operations, performing a reduction on | ||||
Not Done ReplyInline ActionsThis looks left over from something. dmgreen: This looks left over from something. | |||||
Indeed, that should be gone now, thanks! fhahn: Indeed, that should be gone now, thanks! | |||||
/// a vector operand into a scalar value, and adding the result to a chain. | /// a vector operand into a scalar value, and adding the result to a chain. | ||||
class VPReductionRecipe : public VPRecipeBase { | class VPReductionRecipe : public VPRecipeBase { | ||||
/// The recurrence decriptor for the reduction in question. | /// The recurrence decriptor for the reduction in question. | ||||
RecurrenceDescriptor *RdxDesc; | RecurrenceDescriptor *RdxDesc; | ||||
/// The original instruction being converted to a reduction. | /// The original instruction being converted to a reduction. | ||||
Instruction *I; | Instruction *I; | ||||
/// The VPValue of the vector value to be reduced. | /// The VPValue of the vector value to be reduced. | ||||
VPValue *VecOp; | VPValue *VecOp; | ||||
▲ Show 20 Lines • Show All 1,000 Lines • Show Last 20 Lines |
-> VPRecipeBase::VPInterleaveSC