[VPlan] Add printOperands helper to VPUser (NFC).

Factor out the code for printing operands of a VPUser so it can be
re-used when printing other recipes.
This commit is contained in:
Florian Hahn 2020-11-09 12:10:03 +00:00
parent 1e70ec10eb
commit 091c5c9a18
No known key found for this signature in database
GPG Key ID: 61D7554B5CECDC0D
2 changed files with 15 additions and 7 deletions

View File

@ -915,13 +915,7 @@ void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent,
O << "\"WIDEN "
<< Instruction::getOpcodeName(getUnderlyingInstr()->getOpcode()) << " ";
bool First = true;
for (VPValue *Op : operands()) {
if (!First)
O << ", ";
Op->printAsOperand(O, SlotTracker);
First = false;
}
printOperands(O, SlotTracker);
}
void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) {
@ -988,6 +982,16 @@ void VPValue::printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const {
OS << "vp<%" << Tracker.getSlot(this) << ">";
}
void VPUser::printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const {
bool First = true;
for (VPValue *Op : operands()) {
if (!First)
O << ", ";
Op->printAsOperand(O, SlotTracker);
First = false;
}
}
void VPInterleavedAccessInfo::visitRegion(VPRegionBlock *Region,
Old2NewTy &Old2New,
InterleavedAccessInfo &IAI) {

View File

@ -157,6 +157,10 @@ raw_ostream &operator<<(raw_ostream &OS, const VPValue &V);
class VPUser {
SmallVector<VPValue *, 2> Operands;
protected:
/// Print the operands to \p O.
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const;
public:
VPUser() {}
VPUser(ArrayRef<VPValue *> Operands) {