forked from OSchip/llvm-project
[BOLT][NFC] Customize endline character for printInstruction(s)
This would be used in `BF::dumpGraph` to dump left-justified text. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D126232
This commit is contained in:
parent
5d8247d4c7
commit
69f87b6c29
|
@ -1187,7 +1187,8 @@ public:
|
||||||
uint64_t Offset = 0,
|
uint64_t Offset = 0,
|
||||||
const BinaryFunction *Function = nullptr,
|
const BinaryFunction *Function = nullptr,
|
||||||
bool PrintMCInst = false, bool PrintMemData = false,
|
bool PrintMCInst = false, bool PrintMemData = false,
|
||||||
bool PrintRelocations = false) const;
|
bool PrintRelocations = false,
|
||||||
|
StringRef Endl = "\n") const;
|
||||||
|
|
||||||
/// Print a range of instructions.
|
/// Print a range of instructions.
|
||||||
template <typename Itr>
|
template <typename Itr>
|
||||||
|
@ -1195,10 +1196,11 @@ public:
|
||||||
printInstructions(raw_ostream &OS, Itr Begin, Itr End, uint64_t Offset = 0,
|
printInstructions(raw_ostream &OS, Itr Begin, Itr End, uint64_t Offset = 0,
|
||||||
const BinaryFunction *Function = nullptr,
|
const BinaryFunction *Function = nullptr,
|
||||||
bool PrintMCInst = false, bool PrintMemData = false,
|
bool PrintMCInst = false, bool PrintMemData = false,
|
||||||
bool PrintRelocations = false) const {
|
bool PrintRelocations = false,
|
||||||
|
StringRef Endl = "\n") const {
|
||||||
while (Begin != End) {
|
while (Begin != End) {
|
||||||
printInstruction(OS, *Begin, Offset, Function, PrintMCInst, PrintMemData,
|
printInstruction(OS, *Begin, Offset, Function, PrintMCInst, PrintMemData,
|
||||||
PrintRelocations);
|
PrintRelocations, Endl);
|
||||||
Offset += computeCodeSize(Begin, Begin + 1);
|
Offset += computeCodeSize(Begin, Begin + 1);
|
||||||
++Begin;
|
++Begin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1643,9 +1643,10 @@ void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
|
||||||
uint64_t Offset,
|
uint64_t Offset,
|
||||||
const BinaryFunction *Function,
|
const BinaryFunction *Function,
|
||||||
bool PrintMCInst, bool PrintMemData,
|
bool PrintMCInst, bool PrintMemData,
|
||||||
bool PrintRelocations) const {
|
bool PrintRelocations,
|
||||||
|
StringRef Endl) const {
|
||||||
if (MIB->isEHLabel(Instruction)) {
|
if (MIB->isEHLabel(Instruction)) {
|
||||||
OS << " EH_LABEL: " << *MIB->getTargetSymbol(Instruction) << '\n';
|
OS << " EH_LABEL: " << *MIB->getTargetSymbol(Instruction) << Endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OS << format(" %08" PRIx64 ": ", Offset);
|
OS << format(" %08" PRIx64 ": ", Offset);
|
||||||
|
@ -1654,7 +1655,7 @@ void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
|
||||||
OS << "\t!CFI\t$" << Offset << "\t; ";
|
OS << "\t!CFI\t$" << Offset << "\t; ";
|
||||||
if (Function)
|
if (Function)
|
||||||
printCFI(OS, *Function->getCFIFor(Instruction));
|
printCFI(OS, *Function->getCFIFor(Instruction));
|
||||||
OS << "\n";
|
OS << Endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InstPrinter->printInst(&Instruction, 0, "", *STI, OS);
|
InstPrinter->printInst(&Instruction, 0, "", *STI, OS);
|
||||||
|
@ -1718,11 +1719,11 @@ void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
|
||||||
Function->printRelocations(OS, Offset, Size);
|
Function->printRelocations(OS, Offset, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << "\n";
|
OS << Endl;
|
||||||
|
|
||||||
if (PrintMCInst) {
|
if (PrintMCInst) {
|
||||||
Instruction.dump_pretty(OS, InstPrinter.get());
|
Instruction.dump_pretty(OS, InstPrinter.get());
|
||||||
OS << "\n";
|
OS << Endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue