LLVM: include/llvm/Bitcode/BitcodeAnalyzer.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_BITCODE_BITCODEANALYZER_H
14#define LLVM_BITCODE_BITCODEANALYZER_H
15
21#include
22#include
23#include
24
25namespace llvm {
26
28
29
37
52
57 std::optional BlockInfoStream;
58 unsigned NumTopBlocks = 0;
59
60 struct PerRecordStats {
61 unsigned NumInstances = 0;
62 unsigned NumAbbrev = 0;
64 PerRecordStats() = default;
65 };
66
67 struct PerBlockIDStats {
68
69 unsigned NumInstances = 0;
70
72
73 unsigned NumSubBlocks = 0;
74
75 unsigned NumAbbrevs = 0;
76
77
78 unsigned NumRecords = 0, NumAbbreviatedRecords = 0;
79
80 std::vector CodeFreq;
81 PerBlockIDStats() = default;
82 };
83
84 std::map<unsigned, PerBlockIDStats> BlockIDStats;
85
86public:
89 std::optional BlockInfoBuffer = std::nullopt);
90
92 std::optional CheckHash = std::nullopt);
93
95 std::optional Filename = std::nullopt);
96
97private:
98
99 Error parseBlock(unsigned BlockID, unsigned IndentLevel,
100 std::optional O = std::nullopt,
101 std::optional CheckHash = std::nullopt);
102
105};
106
107}
108
109#endif
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM_ABI BitcodeAnalyzer(StringRef Buffer, std::optional< StringRef > BlockInfoBuffer=std::nullopt)
LLVM_ABI Error analyze(std::optional< BCDumpOptions > O=std::nullopt, std::optional< StringRef > CheckHash=std::nullopt)
Analyze the bitcode file.
LLVM_ABI void printStats(BCDumpOptions O, std::optional< StringRef > Filename=std::nullopt)
Print stats about the bitcode file.
This class maintains the abbreviations read from a block info block.
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
CurStreamTypeType
CurStreamTypeType - A type for CurStreamType.
Definition BitcodeAnalyzer.h:30
@ UnknownBitstream
Definition BitcodeAnalyzer.h:31
@ ClangSerializedDiagnosticsBitstream
Definition BitcodeAnalyzer.h:34
@ LLVMIRBitstream
Definition BitcodeAnalyzer.h:32
@ ClangSerializedASTBitstream
Definition BitcodeAnalyzer.h:33
@ LLVMBitstreamRemarks
Definition BitcodeAnalyzer.h:35
Definition BitcodeAnalyzer.h:38
BCDumpOptions(raw_ostream &OS)
Definition BitcodeAnalyzer.h:50
raw_ostream & OS
The stream.
Definition BitcodeAnalyzer.h:40
bool Histogram
Print per-code histogram.
Definition BitcodeAnalyzer.h:42
bool Symbolic
Don't emit numeric info in dump if symbolic info is available.
Definition BitcodeAnalyzer.h:44
bool DumpBlockinfo
Print BLOCKINFO block details.
Definition BitcodeAnalyzer.h:48
bool ShowBinaryBlobs
Print binary blobs using hex escapes.
Definition BitcodeAnalyzer.h:46