Expand Up
@@ -573,16 +573,6 @@ class VPBlockBase {
// / Delete all blocks reachable from a given VPBlockBase, inclusive.
static void deleteCFG (VPBlockBase *Entry);
void printAsOperand (raw_ostream &OS, bool PrintType) const {
OS << getName ();
}
void print (raw_ostream &OS) const {
// TODO: Only printing VPBB name for now since we only have dot printing
// support for VPInstructions/Recipes.
printAsOperand (OS, false );
}
// / Return true if it is legal to hoist instructions into this block.
bool isLegalToHoistInto () {
// There are currently no constraints that prevent an instruction to be
Expand All
@@ -593,6 +583,30 @@ class VPBlockBase {
// / Replace all operands of VPUsers in the block with \p NewValue and also
// / replaces all uses of VPValues defined in the block with NewValue.
virtual void dropAllReferences (VPValue *NewValue) = 0;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void printAsOperand (raw_ostream &OS, bool PrintType) const {
OS << getName ();
}
// / Print plain-text dump of this VPBlockBase to \p O, prefixing all lines
// / with \p Indent. \p SlotTracker is used to print unnamed VPValue's using
// / consequtive numbers.
// /
// / Note that the numbering is applied to the whole VPlan, so printing
// / individual blocks is consistent with the whole VPlan printing.
virtual void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const = 0;
// / Print plain-text dump of this VPlan to \p O.
void print (raw_ostream &O) const {
VPSlotTracker SlotTracker (getPlan ());
print (O, " " , SlotTracker);
}
// / Dump this VPBlockBase to dbgs().
LLVM_DUMP_METHOD void dump () const { print (dbgs ()); }
#endif
};
// / VPRecipeBase is a base class modeling a sequence of one or more output IR
Expand Down
Expand Up
@@ -748,12 +762,14 @@ class VPInstruction : public VPRecipeBase, public VPValue {
// / provided.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the VPInstruction to \p O.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
// / Print the VPInstruction to dbgs() (for debugging).
void dump () const ;
LLVM_DUMP_METHOD void dump () const ;
#endif
// / Return true if this instruction may modify memory.
bool mayWriteToMemory () const {
Expand Down
Expand Up
@@ -807,9 +823,11 @@ class VPWidenRecipe : public VPRecipeBase, public VPValue {
// / Produce widened copies of all Ingredients.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / A recipe for widening Call instructions.
Expand All
@@ -831,9 +849,11 @@ class VPWidenCallRecipe : public VPRecipeBase, public VPValue {
// / Produce a widened version of the call instruction.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / A recipe for widening select instructions.
Expand All
@@ -860,9 +880,11 @@ class VPWidenSelectRecipe : public VPRecipeBase, public VPValue {
// / Produce a widened version of the select instruction.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / A recipe for handling GEP instructions.
Expand Down
Expand Up
@@ -898,9 +920,11 @@ class VPWidenGEPRecipe : public VPRecipeBase, public VPValue {
// / Generate the gep nodes.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / A recipe for handling phi nodes of integer and floating-point inductions,
Expand Down
Expand Up
@@ -931,9 +955,11 @@ class VPWidenIntOrFpInductionRecipe : public VPRecipeBase {
// / needed by their users.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
// / Returns the start value of the induction.
VPValue *getStartValue () { return getOperand (0 ); }
Expand Down
Expand Up
@@ -993,9 +1019,11 @@ class VPWidenPHIRecipe : public VPRecipeBase, public VPValue {
// / Generate the phi/select nodes.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
// / Returns the start value of the phi, if it is a reduction.
VPValue *getStartValue () {
Expand Down
Expand Up
@@ -1051,9 +1079,11 @@ class VPBlendRecipe : public VPRecipeBase, public VPValue {
// / Generate the phi/select nodes.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / VPInterleaveRecipe is a recipe for transforming an interleave group of load
Expand Down
Expand Up
@@ -1114,9 +1144,11 @@ class VPInterleaveRecipe : public VPRecipeBase {
// / Generate the wide load or store, and shuffles.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
const InterleaveGroup<Instruction> *getInterleaveGroup () { return IG; }
};
Expand Down
Expand Up
@@ -1154,9 +1186,11 @@ class VPReductionRecipe : public VPRecipeBase, public VPValue {
// / Generate the reduction in the loop
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
// / The VPValue of the scalar Chain being accumulated.
VPValue *getChainOp () const { return getOperand (0 ); }
Expand Down
Expand Up
@@ -1214,9 +1248,11 @@ class VPReplicateRecipe : public VPRecipeBase, public VPValue {
void setAlsoPack (bool Pack) { AlsoPack = Pack; }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
bool isUniform () const { return IsUniform; }
Expand All
@@ -1243,16 +1279,17 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
// / conditional branch.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override {
O << " + \n " << Indent << " \ " BRANCH-ON-MASK " ;
O << Indent << " BRANCH-ON-MASK " ;
if (VPValue *Mask = getMask ())
Mask->printAsOperand (O, SlotTracker);
else
O << " All-One" ;
O << " \\ l\" " ;
}
#endif
// / Return the mask used by this recipe. Note that a full mask is represented
// / by a nullptr.
Expand Down
Expand Up
@@ -1285,9 +1322,11 @@ class VPPredInstPHIRecipe : public VPRecipeBase, public VPValue {
// / Generates phi nodes for live-outs as needed to retain SSA form.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / A Recipe for widening load/store operations.
Expand Down
Expand Up
@@ -1352,9 +1391,11 @@ class VPWidenMemoryInstructionRecipe : public VPRecipeBase {
// / Generate the wide load/store.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / A Recipe for widening the canonical induction variable of the vector loop.
Expand All
@@ -1376,9 +1417,11 @@ class VPWidenCanonicalIVRecipe : public VPRecipeBase {
// / step = <VF*UF, VF*UF, ..., VF*UF>.
void execute (VPTransformState &State) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print the recipe.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
#endif
};
// / VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
Expand Down
Expand Up
@@ -1463,6 +1506,17 @@ class VPBasicBlock : public VPBlockBase {
void dropAllReferences (VPValue *NewValue) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print this VPBsicBlock to \p O, prefixing all lines with \p Indent. \p
// / SlotTracker is used to print unnamed VPValue's using consequtive numbers.
// /
// / Note that the numbering is applied to the whole VPlan, so printing
// / individual blocks is consistent with the whole VPlan printing.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
using VPBlockBase::print; // Get the print(raw_stream &O) version.
#endif
private:
// / Create an IR BasicBlock to hold the output instructions generated by this
// / VPBasicBlock, and return it. Update the CFGState accordingly.
Expand Down
Expand Up
@@ -1554,6 +1608,18 @@ class VPRegionBlock : public VPBlockBase {
void execute (struct VPTransformState *State) override ;
void dropAllReferences (VPValue *NewValue) override ;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print this VPRegionBlock to \p O (recursively), prefixing all lines with
// / \p Indent. \p SlotTracker is used to print unnamed VPValue's using
// / consequtive numbers.
// /
// / Note that the numbering is applied to the whole VPlan, so printing
// / individual regions is consistent with the whole VPlan printing.
void print (raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override ;
using VPBlockBase::print; // Get the print(raw_stream &O) version.
#endif
};
// ===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -1806,8 +1872,16 @@ class VPlan {
VPLoopInfo &getVPLoopInfo () { return VPLInfo; }
const VPLoopInfo &getVPLoopInfo () const { return VPLInfo; }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print this VPlan to \p O.
void print (raw_ostream &O) const ;
// / Print this VPlan in DOT format to \p O.
void printDOT (raw_ostream &O) const ;
// / Dump the plan to stderr (for debugging).
void dump () const ;
LLVM_DUMP_METHOD void dump () const ;
#endif
// / Returns a range mapping the values the range \p Operands to their
// / corresponding VPValues.
Expand All
@@ -1827,14 +1901,10 @@ class VPlan {
BasicBlock *LoopExitBB);
};
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / VPlanPrinter prints a given VPlan to a given output stream. The printing is
// / indented and follows the dot format.
class VPlanPrinter {
friend inline raw_ostream &operator <<(raw_ostream &OS, const VPlan &Plan);
friend inline raw_ostream &operator <<(raw_ostream &OS,
const struct VPlanIngredient &I);
private:
raw_ostream &OS;
const VPlan &Plan;
unsigned Depth = 0 ;
Expand All
@@ -1845,9 +1915,6 @@ class VPlanPrinter {
VPSlotTracker SlotTracker;
VPlanPrinter (raw_ostream &O, const VPlan &P)
: OS(O), Plan(P), SlotTracker(&P) {}
// / Handle indentation.
void bumpIndent (int b) { Indent = std::string ((Depth += b) * TabWidth, ' ' ); }
Expand Down
Expand Up
@@ -1877,27 +1944,31 @@ class VPlanPrinter {
void drawEdge (const VPBlockBase *From, const VPBlockBase *To, bool Hidden,
const Twine &Label);
void dump ();
public:
VPlanPrinter (raw_ostream &O, const VPlan &P)
: OS(O), Plan(P), SlotTracker(&P) {}
static void printAsIngredient (raw_ostream &O, const Value *V );
LLVM_DUMP_METHOD void dump ( );
};
struct VPlanIngredient {
const Value *V;
VPlanIngredient (const Value *V) : V(V) {}
void print (raw_ostream &O) const ;
};
inline raw_ostream &operator <<(raw_ostream &OS, const VPlanIngredient &I) {
VPlanPrinter::printAsIngredient (OS, I. V );
I. print (OS );
return OS;
}
inline raw_ostream &operator <<(raw_ostream &OS, const VPlan &Plan) {
VPlanPrinter Printer (OS, Plan);
Printer.dump ();
Plan.print (OS);
return OS;
}
#endif
// ===----------------------------------------------------------------------===//
// VPlan Utilities
Expand Down
Expand Up
@@ -2113,8 +2184,10 @@ class VPlanSlp {
SmallPtrSetImpl<VPValue *> &Candidates,
VPInterleavedAccessInfo &IAI);
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// / Print bundle \p Values to dbgs().
void dumpBundle (ArrayRef<VPValue *> Values);
#endif
public:
VPlanSlp (VPInterleavedAccessInfo &IAI, VPBasicBlock &BB) : IAI(IAI), BB(BB) {}
Expand Down