summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/StackMapPrinter.h
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-01-10 00:14:19 +0000
committerSam Clegg <sbc@chromium.org>2018-01-10 00:14:19 +0000
commit88e9a15b802e141232e962836828470b4ae402d6 (patch)
tree791bb5968d6bf122f4030eef08b6dca845548c71 /llvm/tools/llvm-readobj/StackMapPrinter.h
parent9510447a6669718794f82bfa785d9b62bb6bd5ca (diff)
downloadbcm5719-llvm-88e9a15b802e141232e962836828470b4ae402d6.tar.gz
bcm5719-llvm-88e9a15b802e141232e962836828470b4ae402d6.zip
[llvm-readobj] Consistent use of ScopedPrinter
There were a few places where outs() was being used directly rather than the ScopedPrinter object. Differential Revision: https://reviews.llvm.org/D41370 llvm-svn: 322141
Diffstat (limited to 'llvm/tools/llvm-readobj/StackMapPrinter.h')
-rw-r--r--llvm/tools/llvm-readobj/StackMapPrinter.h49
1 files changed, 25 insertions, 24 deletions
diff --git a/llvm/tools/llvm-readobj/StackMapPrinter.h b/llvm/tools/llvm-readobj/StackMapPrinter.h
index f4ed68e92d7..77a054b178a 100644
--- a/llvm/tools/llvm-readobj/StackMapPrinter.h
+++ b/llvm/tools/llvm-readobj/StackMapPrinter.h
@@ -11,69 +11,70 @@
#define LLVM_TOOLS_LLVM_READOBJ_STACKMAPPRINTER_H
#include "llvm/Object/StackMapParser.h"
+#include "llvm/Support/ScopedPrinter.h"
namespace llvm {
// Pretty print a stackmap to the given ostream.
-template <typename OStreamT, typename StackMapParserT>
-void prettyPrintStackMap(OStreamT &OS, const StackMapParserT &SMP) {
+template <typename StackMapParserT>
+void prettyPrintStackMap(ScopedPrinter &W, const StackMapParserT &SMP) {
- OS << "LLVM StackMap Version: " << SMP.getVersion()
- << "\nNum Functions: " << SMP.getNumFunctions();
+ W.printNumber("LLVM StackMap Version", SMP.getVersion());
+ W.printNumber("Num Functions", SMP.getNumFunctions());
// Functions:
for (const auto &F : SMP.functions())
- OS << "\n Function address: " << F.getFunctionAddress()
+ W.startLine() << " Function address: " << F.getFunctionAddress()
<< ", stack size: " << F.getStackSize()
- << ", callsite record count: " << F.getRecordCount();
+ << ", callsite record count: " << F.getRecordCount() << "\n";
// Constants:
- OS << "\nNum Constants: " << SMP.getNumConstants();
+ W.printNumber("Num Constants", SMP.getNumConstants());
unsigned ConstantIndex = 0;
for (const auto &C : SMP.constants())
- OS << "\n #" << ++ConstantIndex << ": " << C.getValue();
+ W.startLine() << " #" << ++ConstantIndex << ": " << C.getValue() << "\n";
// Records:
- OS << "\nNum Records: " << SMP.getNumRecords();
+ W.printNumber("Num Records", SMP.getNumRecords());
for (const auto &R : SMP.records()) {
- OS << "\n Record ID: " << R.getID()
- << ", instruction offset: " << R.getInstructionOffset()
- << "\n " << R.getNumLocations() << " locations:";
+ W.startLine() << " Record ID: " << R.getID()
+ << ", instruction offset: " << R.getInstructionOffset()
+ << "\n";
+ W.startLine() << " " << R.getNumLocations() << " locations:\n";
unsigned LocationIndex = 0;
for (const auto &Loc : R.locations()) {
- OS << "\n #" << ++LocationIndex << ": ";
+ raw_ostream &OS = W.startLine();
+ OS << " #" << ++LocationIndex << ": ";
switch (Loc.getKind()) {
case StackMapParserT::LocationKind::Register:
- OS << "Register R#" << Loc.getDwarfRegNum();
+ OS << "Register R#" << Loc.getDwarfRegNum() << "\n";
break;
case StackMapParserT::LocationKind::Direct:
- OS << "Direct R#" << Loc.getDwarfRegNum() << " + "
- << Loc.getOffset();
+ OS << "Direct R#" << Loc.getDwarfRegNum() << " + " << Loc.getOffset()
+ << "\n";
break;
case StackMapParserT::LocationKind::Indirect:
- OS << "Indirect [R#" << Loc.getDwarfRegNum() << " + "
- << Loc.getOffset() << "]";
+ OS << "Indirect [R#" << Loc.getDwarfRegNum() << " + " << Loc.getOffset()
+ << "]\n";
break;
case StackMapParserT::LocationKind::Constant:
- OS << "Constant " << Loc.getSmallConstant();
+ OS << "Constant " << Loc.getSmallConstant() << "\n";
break;
case StackMapParserT::LocationKind::ConstantIndex:
OS << "ConstantIndex #" << Loc.getConstantIndex() << " ("
- << SMP.getConstant(Loc.getConstantIndex()).getValue() << ")";
+ << SMP.getConstant(Loc.getConstantIndex()).getValue() << ")\n";
break;
}
}
- OS << "\n " << R.getNumLiveOuts() << " live-outs: [ ";
+ raw_ostream &OS = W.startLine();
+ OS << " " << R.getNumLiveOuts() << " live-outs: [ ";
for (const auto &LO : R.liveouts())
OS << "R#" << LO.getDwarfRegNum() << " ("
<< LO.getSizeInBytes() << "-bytes) ";
OS << "]\n";
}
-
- OS << "\n";
-
}
}
OpenPOWER on IntegriCloud