[PATCH] D107536: [BitcodeAnalyzer] allow a motivated user to dump BLOCKINFO
William Woodruff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 4 22:23:00 PDT 2021
woodruffw updated this revision to Diff 364348.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107536/new/
https://reviews.llvm.org/D107536
Files:
llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
===================================================================
--- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -47,6 +47,10 @@
static cl::opt<bool> Dump("dump", cl::desc("Dump low level bitcode trace"),
cl::cat(BCAnalyzerCategory));
+static cl::opt<bool> DumpBlockinfo("dump-blockinfo",
+ cl::desc("Include BLOCKINFO details in low"
+ " level dump"));
+
//===----------------------------------------------------------------------===//
// Bitcode specific analysis.
//===----------------------------------------------------------------------===//
@@ -114,6 +118,7 @@
O.Histogram = !NoHistogram;
O.Symbolic = !NonSymbolic;
O.ShowBinaryBlobs = ShowBinaryBlobs;
+ O.DumpBlockinfo = DumpBlockinfo;
ExitOnErr(BA.analyze(
Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(None),
Index: llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -744,8 +744,8 @@
// BLOCKINFO is a special part of the stream.
bool DumpRecords = O.hasValue();
if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
- if (O)
- O->OS << Indent << "<BLOCKINFO_BLOCK/>\n";
+ if (O && !O->DumpBlockinfo)
+ O->OS << Indent << "<BLOCKINFO_BLOCK \n";
Expected<Optional<BitstreamBlockInfo>> MaybeNewBlockInfo =
Stream.ReadBlockInfoBlock(/*ReadBlockInfoNames=*/true);
if (!MaybeNewBlockInfo)
@@ -758,8 +758,8 @@
if (Error Err = Stream.JumpToBit(BlockBitStart))
return Err;
// It's not really interesting to dump the contents of the blockinfo
- // block.
- DumpRecords = false;
+ // block, so only do it if the user explicitly requests it.
+ DumpRecords = O && O->DumpBlockinfo;
}
unsigned NumWords = 0;
Index: llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
===================================================================
--- llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
+++ llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
@@ -42,6 +42,8 @@
bool Symbolic = false;
/// Print binary blobs using hex escapes.
bool ShowBinaryBlobs = false;
+ /// Print BLOCKINFO block details.
+ bool DumpBlockinfo = false;
BCDumpOptions(raw_ostream &OS) : OS(OS) {}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107536.364348.patch
Type: text/x-patch
Size: 2504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/1f30de36/attachment.bin>
More information about the llvm-commits
mailing list