[PATCH] D126232: [BOLT][NFC] Customize endline character for printInstruction(s)
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 13:23:13 PDT 2022
Amir created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir published this revision for review.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
This would be used in `BF::dumpGraph` to dump left-justified text.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126232
Files:
bolt/include/bolt/Core/BinaryContext.h
bolt/lib/Core/BinaryContext.cpp
Index: bolt/lib/Core/BinaryContext.cpp
===================================================================
--- bolt/lib/Core/BinaryContext.cpp
+++ bolt/lib/Core/BinaryContext.cpp
@@ -1643,9 +1643,10 @@
uint64_t Offset,
const BinaryFunction *Function,
bool PrintMCInst, bool PrintMemData,
- bool PrintRelocations) const {
+ bool PrintRelocations,
+ StringRef Endl) const {
if (MIB->isEHLabel(Instruction)) {
- OS << " EH_LABEL: " << *MIB->getTargetSymbol(Instruction) << '\n';
+ OS << " EH_LABEL: " << *MIB->getTargetSymbol(Instruction) << Endl;
return;
}
OS << format(" %08" PRIx64 ": ", Offset);
@@ -1654,7 +1655,7 @@
OS << "\t!CFI\t$" << Offset << "\t; ";
if (Function)
printCFI(OS, *Function->getCFIFor(Instruction));
- OS << "\n";
+ OS << Endl;
return;
}
InstPrinter->printInst(&Instruction, 0, "", *STI, OS);
@@ -1718,11 +1719,11 @@
Function->printRelocations(OS, Offset, Size);
}
- OS << "\n";
+ OS << Endl;
if (PrintMCInst) {
Instruction.dump_pretty(OS, InstPrinter.get());
- OS << "\n";
+ OS << Endl;
}
}
Index: bolt/include/bolt/Core/BinaryContext.h
===================================================================
--- bolt/include/bolt/Core/BinaryContext.h
+++ bolt/include/bolt/Core/BinaryContext.h
@@ -1187,7 +1187,8 @@
uint64_t Offset = 0,
const BinaryFunction *Function = nullptr,
bool PrintMCInst = false, bool PrintMemData = false,
- bool PrintRelocations = false) const;
+ bool PrintRelocations = false,
+ StringRef Endl = "\n") const;
/// Print a range of instructions.
template <typename Itr>
@@ -1195,10 +1196,11 @@
printInstructions(raw_ostream &OS, Itr Begin, Itr End, uint64_t Offset = 0,
const BinaryFunction *Function = nullptr,
bool PrintMCInst = false, bool PrintMemData = false,
- bool PrintRelocations = false) const {
+ bool PrintRelocations = false,
+ StringRef Endl = "\n") const {
while (Begin != End) {
printInstruction(OS, *Begin, Offset, Function, PrintMCInst, PrintMemData,
- PrintRelocations);
+ PrintRelocations, Endl);
Offset += computeCodeSize(Begin, Begin + 1);
++Begin;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126232.431447.patch
Type: text/x-patch
Size: 2662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220523/816855ac/attachment.bin>
More information about the llvm-commits
mailing list