llvm.org GIT mirror llvm / 7bee1ce
[CodeGen][NFC] Rename IsVerbose to IsStandalone in Machine*::print Committed r322867 too soon. Differential Revision: https://reviews.llvm.org/D42239 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322868 91177308-0d34-0410-b5e6-96231b3b80d8 Francis Visoiu Mistrih 2 years ago
10 changed file(s) with 26 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
725725 // Debugging methods.
726726 void dump() const;
727727 void print(raw_ostream &OS, const SlotIndexes * = nullptr,
728 bool IsVerbose = true) const;
728 bool IsStandalone = true) const;
729729 void print(raw_ostream &OS, ModuleSlotTracker &MST,
730 const SlotIndexes * = nullptr, bool IsVerbose = true) const;
730 const SlotIndexes * = nullptr, bool IsStandalone = true) const;
731731
732732 // Printing method used by LoopInfo.
733733 void printAsOperand(raw_ostream &OS, bool PrintType = true) const;
12331233
12341234 /// Print this MI to \p OS.
12351235 /// Don't print information that can be inferred from other instructions if
1236 /// \p IsVerbose is false. It is usually true when only a fragment of the
1236 /// \p IsStandalone is false. It is usually true when only a fragment of the
12371237 /// function is printed.
12381238 /// Only print the defs and the opcode if \p SkipOpers is true.
12391239 /// Otherwise, also print operands if \p SkipDebugLoc is true.
12401240 /// Otherwise, also print the debug loc, with a terminating newline.
12411241 /// \p TII is used to print the opcode name. If it's not present, but the
12421242 /// MI is in a function, the opcode will be printed using the function's TII.
1243 void print(raw_ostream &OS, bool IsVerbose = true, bool SkipOpers = false,
1243 void print(raw_ostream &OS, bool IsStandalone = true, bool SkipOpers = false,
12441244 bool SkipDebugLoc = false,
12451245 const TargetInstrInfo *TII = nullptr) const;
1246 void print(raw_ostream &OS, ModuleSlotTracker &MST, bool IsVerbose = true,
1246 void print(raw_ostream &OS, ModuleSlotTracker &MST, bool IsStandalone = true,
12471247 bool SkipOpers = false, bool SkipDebugLoc = false,
12481248 const TargetInstrInfo *TII = nullptr) const;
12491249 void dump() const;
269269 /// \param PrintDef - whether we want to print `def` on an operand which
270270 /// isDef. Sometimes, if the operand is printed before '=', we don't print
271271 /// `def`.
272 /// \param IsVerbose - whether we want a verbose output of the MO. This
272 /// \param IsStandalone - whether we want a verbose output of the MO. This
273273 /// prints extra information that can be easily inferred when printing the
274274 /// whole function, but not when printing only a fragment of it.
275275 /// \param ShouldPrintRegisterTies - whether we want to print register ties.
282282 /// information from it's parent.
283283 /// \param IntrinsicInfo - same as \p TRI.
284284 void print(raw_ostream &os, ModuleSlotTracker &MST, LLT TypeToPrint,
285 bool PrintDef, bool IsVerbose, bool ShouldPrintRegisterTies,
285 bool PrintDef, bool IsStandalone, bool ShouldPrintRegisterTies,
286286 unsigned TiedOperandIdx, const TargetRegisterInfo *TRI,
287287 const TargetIntrinsicInfo *IntrinsicInfo) const;
288288
767767 if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && !Op.isDef())
768768 TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx);
769769 const TargetIntrinsicInfo *TII = MI.getMF()->getTarget().getIntrinsicInfo();
770 Op.print(OS, MST, TypeToPrint, PrintDef, /*IsVerbose=*/false,
770 Op.print(OS, MST, TypeToPrint, PrintDef, /*IsStandalone=*/false,
771771 ShouldPrintRegisterTies, TiedOperandIdx, TRI, TII);
772772 break;
773773 }
259259 }
260260
261261 void MachineBasicBlock::print(raw_ostream &OS, const SlotIndexes *Indexes,
262 bool IsVerbose) const {
262 bool IsStandalone) const {
263263 const MachineFunction *MF = getParent();
264264 if (!MF) {
265265 OS << "Can't print out MachineBasicBlock because parent MachineFunction"
269269 const Function &F = MF->getFunction();
270270 const Module *M = F.getParent();
271271 ModuleSlotTracker MST(M);
272 print(OS, MST, Indexes, IsVerbose);
272 print(OS, MST, Indexes, IsStandalone);
273273 }
274274
275275 void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
276276 const SlotIndexes *Indexes,
277 bool IsVerbose) const {
277 bool IsStandalone) const {
278278 const MachineFunction *MF = getParent();
279279 if (!MF) {
280280 OS << "Can't print out MachineBasicBlock because parent MachineFunction"
330330 OS << '\t';
331331 if (I.isInsideBundle())
332332 OS << " * ";
333 I.print(OS, MST, IsVerbose);
333 I.print(OS, MST, IsStandalone);
334334 }
335335
336336 // Print the successors of this block according to the CFG.
523523 OS << '\n';
524524 // If we print the whole function, don't print any verbose information,
525525 // since that information is already present.
526 BB.print(OS, MST, Indexes, /*IsVerbose=*/false);
526 BB.print(OS, MST, Indexes, /*IsStandalone=*/false);
527527 }
528528
529529 OS << "\n# End machine code for function " << getName() << ".\n\n";
12281228 }
12291229 #endif
12301230
1231 void MachineInstr::print(raw_ostream &OS, bool IsVerbose, bool SkipOpers,
1231 void MachineInstr::print(raw_ostream &OS, bool IsStandalone, bool SkipOpers,
12321232 bool SkipDebugLoc, const TargetInstrInfo *TII) const {
12331233 const Module *M = nullptr;
12341234 const Function *F = nullptr;
12401240 ModuleSlotTracker MST(M);
12411241 if (F)
12421242 MST.incorporateFunction(*F);
1243 print(OS, MST, IsVerbose, SkipOpers, SkipDebugLoc, TII);
1243 print(OS, MST, IsStandalone, SkipOpers, SkipDebugLoc, TII);
12441244 }
12451245
12461246 void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
1247 bool IsVerbose, bool SkipOpers, bool SkipDebugLoc,
1247 bool IsStandalone, bool SkipOpers, bool SkipDebugLoc,
12481248 const TargetInstrInfo *TII) const {
12491249 // We can be a bit tidier if we know the MachineFunction.
12501250 const MachineFunction *MF = nullptr;
12801280
12811281 LLT TypeToPrint = MRI ? getTypeToPrint(StartOp, PrintedTypes, *MRI) : LLT{};
12821282 unsigned TiedOperandIdx = getTiedOperandIdx(StartOp);
1283 MO.print(OS, MST, TypeToPrint, /*PrintDef=*/false, IsVerbose,
1283 MO.print(OS, MST, TypeToPrint, /*PrintDef=*/false, IsStandalone,
12841284 ShouldPrintRegisterTies, TiedOperandIdx, TRI, IntrinsicInfo);
12851285 ++StartOp;
12861286 }
13131313 const unsigned OpIdx = InlineAsm::MIOp_AsmString;
13141314 LLT TypeToPrint = MRI ? getTypeToPrint(OpIdx, PrintedTypes, *MRI) : LLT{};
13151315 unsigned TiedOperandIdx = getTiedOperandIdx(OpIdx);
1316 getOperand(OpIdx).print(OS, MST, TypeToPrint, /*PrintDef=*/true, IsVerbose,
1316 getOperand(OpIdx).print(OS, MST, TypeToPrint, /*PrintDef=*/true, IsStandalone,
13171317 ShouldPrintRegisterTies, TiedOperandIdx, TRI,
13181318 IntrinsicInfo);
13191319
13521352 else {
13531353 LLT TypeToPrint = MRI ? getTypeToPrint(i, PrintedTypes, *MRI) : LLT{};
13541354 unsigned TiedOperandIdx = getTiedOperandIdx(i);
1355 MO.print(OS, MST, TypeToPrint, /*PrintDef=*/true, IsVerbose,
1355 MO.print(OS, MST, TypeToPrint, /*PrintDef=*/true, IsStandalone,
13561356 ShouldPrintRegisterTies, TiedOperandIdx, TRI, IntrinsicInfo);
13571357 }
13581358 } else if (i == AsmDescOp && MO.isImm()) {
14191419 if (MO.isImm() && isOperandSubregIdx(i))
14201420 MachineOperand::printSubRegIdx(OS, MO.getImm(), TRI);
14211421 else
1422 MO.print(OS, MST, TypeToPrint, /*PrintDef=*/true, IsVerbose,
1422 MO.print(OS, MST, TypeToPrint, /*PrintDef=*/true, IsStandalone,
14231423 ShouldPrintRegisterTies, TiedOperandIdx, TRI, IntrinsicInfo);
14241424 }
14251425 }
640640 const TargetIntrinsicInfo *IntrinsicInfo) const {
641641 tryToGetTargetInfo(*this, TRI, IntrinsicInfo);
642642 ModuleSlotTracker DummyMST(nullptr);
643 print(OS, DummyMST, LLT{}, /*PrintDef=*/false, /*IsVerbose=*/true,
643 print(OS, DummyMST, LLT{}, /*PrintDef=*/false, /*IsStandalone=*/true,
644644 /*ShouldPrintRegisterTies=*/true,
645645 /*TiedOperandIdx=*/0, TRI, IntrinsicInfo);
646646 }
647647
648648 void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST,
649 LLT TypeToPrint, bool PrintDef, bool IsVerbose,
649 LLT TypeToPrint, bool PrintDef, bool IsStandalone,
650650 bool ShouldPrintRegisterTies,
651651 unsigned TiedOperandIdx,
652652 const TargetRegisterInfo *TRI,
686686 if (TargetRegisterInfo::isVirtualRegister(Reg)) {
687687 if (const MachineFunction *MF = getMFIfAvailable(*this)) {
688688 const MachineRegisterInfo &MRI = MF->getRegInfo();
689 if (IsVerbose || !PrintDef || MRI.def_empty(Reg)) {
689 if (IsStandalone || !PrintDef || MRI.def_empty(Reg)) {
690690 OS << ':';
691691 OS << printRegClassOrBank(Reg, MRI, TRI);
692692 }
2626 Key = MKey;
2727
2828 raw_string_ostream OS(Val);
29 MI.print(OS, /*IsVerbose=*/true, /*SkipOpers=*/false, /*SkipDebugLoc=*/true);
29 MI.print(OS, /*IsStandalone=*/true, /*SkipOpers=*/false,
30 /*SkipDebugLoc=*/true);
3031 }
3132
3233 Optional
310310 std::string str;
311311 // Print a MachineOperand containing a metadata node.
312312 raw_string_ostream OS(str);
313 MO.print(OS, MST, LLT{}, /*PrintDef=*/false, /*IsVerbose=*/false,
313 MO.print(OS, MST, LLT{}, /*PrintDef=*/false, /*IsStandalone=*/false,
314314 /*ShouldPrintRegisterTies=*/false, 0, /*TRI=*/nullptr,
315315 /*IntrinsicInfo=*/nullptr);
316316 ASSERT_TRUE(OS.str() == "!0");