xref: /llvm-project/llvm/docs/CommandGuide/llvm-bcanalyzer.rst (revision 6746e6a37284e6d9aa83f1f2d0b76013898256cb)
1llvm-bcanalyzer - LLVM bitcode analyzer
2=======================================
3
4.. program:: llvm-bcanalyzer
5
6SYNOPSIS
7--------
8
9:program:`llvm-bcanalyzer` [*options*] [*filename*]
10
11DESCRIPTION
12-----------
13
14The :program:`llvm-bcanalyzer` command is a small utility for analyzing bitcode
15files.  The tool reads a bitcode file (such as generated with the
16:program:`llvm-as` tool) and produces a statistical report on the contents of
17the bitcode file.  The tool can also dump a low level but human readable
18version of the bitcode file.  This tool is probably not of much interest or
19utility except for those working directly with the bitcode file format.  Most
20LLVM users can just ignore this tool.
21
22If *filename* is omitted or is ``-``, then :program:`llvm-bcanalyzer` reads its
23input from standard input.  This is useful for combining the tool into a
24pipeline.  Output is written to the standard output.
25
26OPTIONS
27-------
28
29.. program:: llvm-bcanalyzer
30
31.. option:: --dump
32
33 Causes :program:`llvm-bcanalyzer` to dump the bitcode in a human readable
34 format.  This format is significantly different from LLVM assembly and
35 provides details about the encoding of the bitcode file.
36
37.. option:: --help
38
39 Print a summary of command line options.
40
41EXIT STATUS
42-----------
43
44If :program:`llvm-bcanalyzer` succeeds, it will exit with 0.  Otherwise, if an
45error occurs, it will exit with a non-zero value, usually 1.
46
47SUMMARY OUTPUT DEFINITIONS
48--------------------------
49
50The following items are always printed by llvm-bcanalyzer.  They comprize the
51summary output.
52
53**Bitcode Analysis Of Module**
54
55 This just provides the name of the module for which bitcode analysis is being
56 generated.
57
58**Bitcode Version Number**
59
60 The bitcode version (not LLVM version) of the file read by the analyzer.
61
62**File Size**
63
64 The size, in bytes, of the entire bitcode file.
65
66**Module Bytes**
67
68 The size, in bytes, of the module block.  Percentage is relative to File Size.
69
70**Function Bytes**
71
72 The size, in bytes, of all the function blocks.  Percentage is relative to File
73 Size.
74
75**Global Types Bytes**
76
77 The size, in bytes, of the Global Types Pool.  Percentage is relative to File
78 Size.  This is the size of the definitions of all types in the bitcode file.
79
80**Constant Pool Bytes**
81
82 The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
83 Size.
84
85**Module Globals Bytes**
86
87 Ths size, in bytes, of the Global Variable Definitions and their initializers.
88 Percentage is relative to File Size.
89
90**Instruction List Bytes**
91
92 The size, in bytes, of all the instruction lists in all the functions.
93 Percentage is relative to File Size.  Note that this value is also included in
94 the Function Bytes.
95
96**Compaction Table Bytes**
97
98 The size, in bytes, of all the compaction tables in all the functions.
99 Percentage is relative to File Size.  Note that this value is also included in
100 the Function Bytes.
101
102**Symbol Table Bytes**
103
104 The size, in bytes, of all the symbol tables in all the functions.  Percentage is
105 relative to File Size.  Note that this value is also included in the Function
106 Bytes.
107
108**Dependent Libraries Bytes**
109
110 The size, in bytes, of the list of dependent libraries in the module.  Percentage
111 is relative to File Size.  Note that this value is also included in the Module
112 Global Bytes.
113
114**Number Of Bitcode Blocks**
115
116 The total number of blocks of any kind in the bitcode file.
117
118**Number Of Functions**
119
120 The total number of function definitions in the bitcode file.
121
122**Number Of Types**
123
124 The total number of types defined in the Global Types Pool.
125
126**Number Of Constants**
127
128 The total number of constants (of any type) defined in the Constant Pool.
129
130**Number Of Basic Blocks**
131
132 The total number of basic blocks defined in all functions in the bitcode file.
133
134**Number Of Instructions**
135
136 The total number of instructions defined in all functions in the bitcode file.
137
138**Number Of Long Instructions**
139
140 The total number of long instructions defined in all functions in the bitcode
141 file.  Long instructions are those taking greater than 4 bytes.  Typically long
142 instructions are GetElementPtr with several indices, PHI nodes, and calls to
143 functions with large numbers of arguments.
144
145**Number Of Operands**
146
147 The total number of operands used in all instructions in the bitcode file.
148
149**Number Of Compaction Tables**
150
151 The total number of compaction tables in all functions in the bitcode file.
152
153**Number Of Symbol Tables**
154
155 The total number of symbol tables in all functions in the bitcode file.
156
157**Number Of Dependent Libs**
158
159 The total number of dependent libraries found in the bitcode file.
160
161**Total Instruction Size**
162
163 The total size of the instructions in all functions in the bitcode file.
164
165**Average Instruction Size**
166
167 The average number of bytes per instruction across all functions in the bitcode
168 file.  This value is computed by dividing Total Instruction Size by Number Of
169 Instructions.
170
171**Maximum Type Slot Number**
172
173 The maximum value used for a type's slot number.  Larger slot number values take
174 more bytes to encode.
175
176**Maximum Value Slot Number**
177
178 The maximum value used for a value's slot number.  Larger slot number values take
179 more bytes to encode.
180
181**Bytes Per Value**
182
183 The average size of a Value definition (of any type).  This is computed by
184 dividing File Size by the total number of values of any type.
185
186**Bytes Per Global**
187
188 The average size of a global definition (constants and global variables).
189
190**Bytes Per Function**
191
192 The average number of bytes per function definition.  This is computed by
193 dividing Function Bytes by Number Of Functions.
194
195**# of VBR 32-bit Integers**
196
197 The total number of 32-bit integers encoded using the Variable Bit Rate
198 encoding scheme.
199
200**# of VBR 64-bit Integers**
201
202 The total number of 64-bit integers encoded using the Variable Bit Rate encoding
203 scheme.
204
205**# of VBR Compressed Bytes**
206
207 The total number of bytes consumed by the 32-bit and 64-bit integers that use
208 the Variable Bit Rate encoding scheme.
209
210**# of VBR Expanded Bytes**
211
212 The total number of bytes that would have been consumed by the 32-bit and 64-bit
213 integers had they not been compressed with the Variable Bit Rage encoding
214 scheme.
215
216**Bytes Saved With VBR**
217
218 The total number of bytes saved by using the Variable Bit Rate encoding scheme.
219 The percentage is relative to # of VBR Expanded Bytes.
220
221DETAILED OUTPUT DEFINITIONS
222---------------------------
223
224The following definitions occur only if the -nodetails option was not given.
225The detailed output provides additional information on a per-function basis.
226
227**Type**
228
229 The type signature of the function.
230
231**Byte Size**
232
233 The total number of bytes in the function's block.
234
235**Basic Blocks**
236
237 The number of basic blocks defined by the function.
238
239**Instructions**
240
241 The number of instructions defined by the function.
242
243**Long Instructions**
244
245 The number of instructions using the long instruction format in the function.
246
247**Operands**
248
249 The number of operands used by all instructions in the function.
250
251**Instruction Size**
252
253 The number of bytes consumed by instructions in the function.
254
255**Average Instruction Size**
256
257 The average number of bytes consumed by the instructions in the function.
258 This value is computed by dividing Instruction Size by Instructions.
259
260**Bytes Per Instruction**
261
262 The average number of bytes used by the function per instruction.  This value
263 is computed by dividing Byte Size by Instructions.  Note that this is not the
264 same as Average Instruction Size.  It computes a number relative to the total
265 function size not just the size of the instruction list.
266
267**Number of VBR 32-bit Integers**
268
269 The total number of 32-bit integers found in this function (for any use).
270
271**Number of VBR 64-bit Integers**
272
273 The total number of 64-bit integers found in this function (for any use).
274
275**Number of VBR Compressed Bytes**
276
277 The total number of bytes in this function consumed by the 32-bit and 64-bit
278 integers that use the Variable Bit Rate encoding scheme.
279
280**Number of VBR Expanded Bytes**
281
282 The total number of bytes in this function that would have been consumed by
283 the 32-bit and 64-bit integers had they not been compressed with the Variable
284 Bit Rate encoding scheme.
285
286**Bytes Saved With VBR**
287
288 The total number of bytes saved in this function by using the Variable Bit
289 Rate encoding scheme.  The percentage is relative to # of VBR Expanded Bytes.
290
291SEE ALSO
292--------
293
294:manpage:`llvm-dis(1)`, :doc:`/BitCodeFormat`
295