1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[NFCI][VPlan] Modify Recipes' print methods to honor Indent parameter

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D97787
This commit is contained in:
Andrei Elovikov 2021-03-02 15:08:19 -08:00
parent c7e22fdcf5
commit 15c77322ba
2 changed files with 17 additions and 15 deletions

View File

@ -9017,7 +9017,7 @@ void LoopVectorizationPlanner::adjustRecipesForInLoopReductions(
void VPInterleaveRecipe::print(raw_ostream &O, const Twine &Indent, void VPInterleaveRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "\"INTERLEAVE-GROUP with factor " << IG->getFactor() << " at "; O << Indent << "\"INTERLEAVE-GROUP with factor " << IG->getFactor() << " at ";
IG->getInsertPos()->printAsOperand(O, false); IG->getInsertPos()->printAsOperand(O, false);
O << ", "; O << ", ";
getAddr()->printAsOperand(O, SlotTracker); getAddr()->printAsOperand(O, SlotTracker);

View File

@ -546,7 +546,7 @@ void VPInstruction::dump() const {
void VPInstruction::print(raw_ostream &O, const Twine &Indent, void VPInstruction::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "EMIT "; O << Indent << "EMIT ";
if (hasResult()) { if (hasResult()) {
printAsOperand(O, SlotTracker); printAsOperand(O, SlotTracker);
@ -808,7 +808,9 @@ void VPlanPrinter::dumpBasicBlock(const VPBasicBlock *BasicBlock) {
for (const VPRecipeBase &Recipe : *BasicBlock) { for (const VPRecipeBase &Recipe : *BasicBlock) {
OS << " +\n" << Indent << "\""; OS << " +\n" << Indent << "\"";
Recipe.print(OS, Indent, SlotTracker); // Don't indent inside the recipe printer as we printed it before the
// opening quote already.
Recipe.print(OS, "", SlotTracker);
OS << "\\l\""; OS << "\\l\"";
} }
@ -869,7 +871,7 @@ void VPlanPrinter::printAsIngredient(raw_ostream &O, const Value *V) {
void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN-CALL "; O << Indent << "WIDEN-CALL ";
auto *CI = cast<CallInst>(getUnderlyingInstr()); auto *CI = cast<CallInst>(getUnderlyingInstr());
if (CI->getType()->isVoidTy()) if (CI->getType()->isVoidTy())
@ -886,7 +888,7 @@ void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN-SELECT "; O << Indent << "WIDEN-SELECT ";
printAsOperand(O, SlotTracker); printAsOperand(O, SlotTracker);
O << " = select "; O << " = select ";
getOperand(0)->printAsOperand(O, SlotTracker); getOperand(0)->printAsOperand(O, SlotTracker);
@ -899,7 +901,7 @@ void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN "; O << Indent << "WIDEN ";
printAsOperand(O, SlotTracker); printAsOperand(O, SlotTracker);
O << " = " << getUnderlyingInstr()->getOpcodeName() << " "; O << " = " << getUnderlyingInstr()->getOpcodeName() << " ";
printOperands(O, SlotTracker); printOperands(O, SlotTracker);
@ -907,7 +909,7 @@ void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN-INDUCTION"; O << Indent << "WIDEN-INDUCTION";
if (getTruncInst()) { if (getTruncInst()) {
O << "\\l\""; O << "\\l\"";
O << " +\n" << Indent << "\" " << VPlanIngredient(IV) << "\\l\""; O << " +\n" << Indent << "\" " << VPlanIngredient(IV) << "\\l\"";
@ -919,7 +921,7 @@ void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN-GEP "; O << Indent << "WIDEN-GEP ";
O << (IsPtrLoopInvariant ? "Inv" : "Var"); O << (IsPtrLoopInvariant ? "Inv" : "Var");
size_t IndicesNumber = IsIndexLoopInvariant.size(); size_t IndicesNumber = IsIndexLoopInvariant.size();
for (size_t I = 0; I < IndicesNumber; ++I) for (size_t I = 0; I < IndicesNumber; ++I)
@ -933,12 +935,12 @@ void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenPHIRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenPHIRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN-PHI " << VPlanIngredient(getUnderlyingValue()); O << Indent << "WIDEN-PHI " << VPlanIngredient(getUnderlyingValue());
} }
void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent, void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "BLEND "; O << Indent << "BLEND ";
Phi->printAsOperand(O, false); Phi->printAsOperand(O, false);
O << " ="; O << " =";
if (getNumIncomingValues() == 1) { if (getNumIncomingValues() == 1) {
@ -958,7 +960,7 @@ void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent,
void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent, void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "REDUCE "; O << Indent << "REDUCE ";
printAsOperand(O, SlotTracker); printAsOperand(O, SlotTracker);
O << " = "; O << " = ";
getChainOp()->printAsOperand(O, SlotTracker); getChainOp()->printAsOperand(O, SlotTracker);
@ -974,7 +976,7 @@ void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent,
void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent, void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << (IsUniform ? "CLONE " : "REPLICATE "); O << Indent << (IsUniform ? "CLONE " : "REPLICATE ");
if (!getUnderlyingInstr()->getType()->isVoidTy()) { if (!getUnderlyingInstr()->getType()->isVoidTy()) {
printAsOperand(O, SlotTracker); printAsOperand(O, SlotTracker);
@ -989,7 +991,7 @@ void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent, void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "PHI-PREDICATED-INSTRUCTION "; O << Indent << "PHI-PREDICATED-INSTRUCTION ";
printAsOperand(O, SlotTracker); printAsOperand(O, SlotTracker);
O << " = "; O << " = ";
printOperands(O, SlotTracker); printOperands(O, SlotTracker);
@ -997,7 +999,7 @@ void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "WIDEN "; O << Indent << "WIDEN ";
if (!isStore()) { if (!isStore()) {
getVPValue()->printAsOperand(O, SlotTracker); getVPValue()->printAsOperand(O, SlotTracker);
@ -1035,7 +1037,7 @@ void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) {
void VPWidenCanonicalIVRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenCanonicalIVRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << "EMIT "; O << Indent << "EMIT ";
getVPValue()->printAsOperand(O, SlotTracker); getVPValue()->printAsOperand(O, SlotTracker);
O << " = WIDEN-CANONICAL-INDUCTION"; O << " = WIDEN-CANONICAL-INDUCTION";
} }