[StackMaps] Add location size to llvm-readobj -stackmap output
The size field of a location can be different for each entry, so it is useful to have this displayed in the output of llvm-readobj -stackmap. Below is an example of how the output would look:
Record ID: 2882400000, instruction offset: 16
3 locations:
#1: Constant 1, size: 8
#2: Constant 2, size: 8
#3: Constant 3, size: 8
0 live-outs: [ ]
Patch By: jacob.hughes@kcl.ac.uk (with heavy modification by me)
Differential Revision: https://reviews.llvm.org/D59169
llvm-svn: 358324
diff --git a/llvm/tools/llvm-readobj/StackMapPrinter.h b/llvm/tools/llvm-readobj/StackMapPrinter.h
index c40e65a..ef75756 100644
--- a/llvm/tools/llvm-readobj/StackMapPrinter.h
+++ b/llvm/tools/llvm-readobj/StackMapPrinter.h
@@ -47,24 +47,24 @@
OS << " #" << ++LocationIndex << ": ";
switch (Loc.getKind()) {
case StackMapParserT::LocationKind::Register:
- OS << "Register R#" << Loc.getDwarfRegNum() << "\n";
+ OS << "Register R#" << Loc.getDwarfRegNum();
break;
case StackMapParserT::LocationKind::Direct:
- OS << "Direct R#" << Loc.getDwarfRegNum() << " + " << Loc.getOffset()
- << "\n";
+ OS << "Direct R#" << Loc.getDwarfRegNum() << " + " << Loc.getOffset();
break;
case StackMapParserT::LocationKind::Indirect:
OS << "Indirect [R#" << Loc.getDwarfRegNum() << " + " << Loc.getOffset()
- << "]\n";
+ << "]";
break;
case StackMapParserT::LocationKind::Constant:
- OS << "Constant " << Loc.getSmallConstant() << "\n";
+ OS << "Constant " << Loc.getSmallConstant();
break;
case StackMapParserT::LocationKind::ConstantIndex:
OS << "ConstantIndex #" << Loc.getConstantIndex() << " ("
- << SMP.getConstant(Loc.getConstantIndex()).getValue() << ")\n";
+ << SMP.getConstant(Loc.getConstantIndex()).getValue() << ")";
break;
}
+ OS << ", size: " << Loc.getSizeInBytes() << "\n";
}
raw_ostream &OS = W.startLine();