blob: 36ad3998ea4b10160ff2807e53a2c9fe7f160607 [file] [log] [blame]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00001llvm-bcanalyzer - LLVM bitcode analyzer
2=======================================
3
James Hendersona0566842019-06-27 13:24:46 +00004.. program:: llvm-bcanalyzer
5
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00006SYNOPSIS
7--------
8
Dmitri Gribenko28574d32012-12-12 19:15:53 +00009:program:`llvm-bcanalyzer` [*options*] [*filename*]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000010
11DESCRIPTION
12-----------
13
Dmitri Gribenko28574d32012-12-12 19:15:53 +000014The :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.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000021
Dmitri Gribenko28574d32012-12-12 19:15:53 +000022If *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.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000025
26OPTIONS
27-------
28
Dmitri Gribenko28574d32012-12-12 19:15:53 +000029.. program:: llvm-bcanalyzer
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000030
Dmitri Gribenko28574d32012-12-12 19:15:53 +000031.. option:: -nodetails
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000032
Dmitri Gribenko28574d32012-12-12 19:15:53 +000033 Causes :program:`llvm-bcanalyzer` to abbreviate its output by writing out only
34 a module level summary. The details for individual functions are not
35 displayed.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000036
Dmitri Gribenko28574d32012-12-12 19:15:53 +000037.. option:: -dump
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000038
Dmitri Gribenko28574d32012-12-12 19:15:53 +000039 Causes :program:`llvm-bcanalyzer` to dump the bitcode in a human readable
40 format. This format is significantly different from LLVM assembly and
41 provides details about the encoding of the bitcode file.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000042
Dmitri Gribenko28574d32012-12-12 19:15:53 +000043.. option:: -verify
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000044
Dmitri Gribenko28574d32012-12-12 19:15:53 +000045 Causes :program:`llvm-bcanalyzer` to verify the module produced by reading the
46 bitcode. This ensures that the statistics generated are based on a consistent
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000047 module.
48
Dmitri Gribenko28574d32012-12-12 19:15:53 +000049.. option:: -help
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000050
51 Print a summary of command line options.
52
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000053EXIT STATUS
54-----------
55
Dmitri Gribenko28574d32012-12-12 19:15:53 +000056If :program:`llvm-bcanalyzer` succeeds, it will exit with 0. Otherwise, if an
57error occurs, it will exit with a non-zero value, usually 1.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000058
59SUMMARY OUTPUT DEFINITIONS
60--------------------------
61
Dmitri Gribenko28574d32012-12-12 19:15:53 +000062The following items are always printed by llvm-bcanalyzer. They comprize the
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000063summary output.
64
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000065**Bitcode Analysis Of Module**
66
67 This just provides the name of the module for which bitcode analysis is being
68 generated.
69
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000070**Bitcode Version Number**
71
72 The bitcode version (not LLVM version) of the file read by the analyzer.
73
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000074**File Size**
75
76 The size, in bytes, of the entire bitcode file.
77
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000078**Module Bytes**
79
Dmitri Gribenko28574d32012-12-12 19:15:53 +000080 The size, in bytes, of the module block. Percentage is relative to File Size.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000081
82**Function Bytes**
83
Dmitri Gribenko28574d32012-12-12 19:15:53 +000084 The size, in bytes, of all the function blocks. Percentage is relative to File
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000085 Size.
86
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000087**Global Types Bytes**
88
Dmitri Gribenko28574d32012-12-12 19:15:53 +000089 The size, in bytes, of the Global Types Pool. Percentage is relative to File
90 Size. This is the size of the definitions of all types in the bitcode file.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000091
92**Constant Pool Bytes**
93
94 The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
95 Size.
96
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000097**Module Globals Bytes**
98
99 Ths size, in bytes, of the Global Variable Definitions and their initializers.
100 Percentage is relative to File Size.
101
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000102**Instruction List Bytes**
103
104 The size, in bytes, of all the instruction lists in all the functions.
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000105 Percentage is relative to File Size. Note that this value is also included in
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000106 the Function Bytes.
107
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000108**Compaction Table Bytes**
109
110 The size, in bytes, of all the compaction tables in all the functions.
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000111 Percentage is relative to File Size. Note that this value is also included in
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000112 the Function Bytes.
113
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000114**Symbol Table Bytes**
115
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000116 The size, in bytes, of all the symbol tables in all the functions. Percentage is
117 relative to File Size. Note that this value is also included in the Function
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000118 Bytes.
119
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000120**Dependent Libraries Bytes**
121
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000122 The size, in bytes, of the list of dependent libraries in the module. Percentage
123 is relative to File Size. Note that this value is also included in the Module
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000124 Global Bytes.
125
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000126**Number Of Bitcode Blocks**
127
128 The total number of blocks of any kind in the bitcode file.
129
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000130**Number Of Functions**
131
132 The total number of function definitions in the bitcode file.
133
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000134**Number Of Types**
135
136 The total number of types defined in the Global Types Pool.
137
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000138**Number Of Constants**
139
140 The total number of constants (of any type) defined in the Constant Pool.
141
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000142**Number Of Basic Blocks**
143
144 The total number of basic blocks defined in all functions in the bitcode file.
145
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000146**Number Of Instructions**
147
148 The total number of instructions defined in all functions in the bitcode file.
149
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000150**Number Of Long Instructions**
151
152 The total number of long instructions defined in all functions in the bitcode
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000153 file. Long instructions are those taking greater than 4 bytes. Typically long
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000154 instructions are GetElementPtr with several indices, PHI nodes, and calls to
155 functions with large numbers of arguments.
156
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000157**Number Of Operands**
158
159 The total number of operands used in all instructions in the bitcode file.
160
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000161**Number Of Compaction Tables**
162
163 The total number of compaction tables in all functions in the bitcode file.
164
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000165**Number Of Symbol Tables**
166
167 The total number of symbol tables in all functions in the bitcode file.
168
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000169**Number Of Dependent Libs**
170
171 The total number of dependent libraries found in the bitcode file.
172
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000173**Total Instruction Size**
174
175 The total size of the instructions in all functions in the bitcode file.
176
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000177**Average Instruction Size**
178
179 The average number of bytes per instruction across all functions in the bitcode
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000180 file. This value is computed by dividing Total Instruction Size by Number Of
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000181 Instructions.
182
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000183**Maximum Type Slot Number**
184
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000185 The maximum value used for a type's slot number. Larger slot number values take
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000186 more bytes to encode.
187
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000188**Maximum Value Slot Number**
189
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000190 The maximum value used for a value's slot number. Larger slot number values take
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000191 more bytes to encode.
192
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000193**Bytes Per Value**
194
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000195 The average size of a Value definition (of any type). This is computed by
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000196 dividing File Size by the total number of values of any type.
197
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000198**Bytes Per Global**
199
200 The average size of a global definition (constants and global variables).
201
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000202**Bytes Per Function**
203
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000204 The average number of bytes per function definition. This is computed by
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000205 dividing Function Bytes by Number Of Functions.
206
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000207**# of VBR 32-bit Integers**
208
209 The total number of 32-bit integers encoded using the Variable Bit Rate
210 encoding scheme.
211
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000212**# of VBR 64-bit Integers**
213
214 The total number of 64-bit integers encoded using the Variable Bit Rate encoding
215 scheme.
216
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000217**# of VBR Compressed Bytes**
218
219 The total number of bytes consumed by the 32-bit and 64-bit integers that use
220 the Variable Bit Rate encoding scheme.
221
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000222**# of VBR Expanded Bytes**
223
224 The total number of bytes that would have been consumed by the 32-bit and 64-bit
225 integers had they not been compressed with the Variable Bit Rage encoding
226 scheme.
227
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000228**Bytes Saved With VBR**
229
230 The total number of bytes saved by using the Variable Bit Rate encoding scheme.
231 The percentage is relative to # of VBR Expanded Bytes.
232
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000233DETAILED OUTPUT DEFINITIONS
234---------------------------
235
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000236The following definitions occur only if the -nodetails option was not given.
237The detailed output provides additional information on a per-function basis.
238
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000239**Type**
240
241 The type signature of the function.
242
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000243**Byte Size**
244
245 The total number of bytes in the function's block.
246
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000247**Basic Blocks**
248
249 The number of basic blocks defined by the function.
250
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000251**Instructions**
252
253 The number of instructions defined by the function.
254
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000255**Long Instructions**
256
257 The number of instructions using the long instruction format in the function.
258
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000259**Operands**
260
261 The number of operands used by all instructions in the function.
262
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000263**Instruction Size**
264
265 The number of bytes consumed by instructions in the function.
266
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000267**Average Instruction Size**
268
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000269 The average number of bytes consumed by the instructions in the function.
270 This value is computed by dividing Instruction Size by Instructions.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000271
272**Bytes Per Instruction**
273
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000274 The average number of bytes used by the function per instruction. This value
275 is computed by dividing Byte Size by Instructions. Note that this is not the
276 same as Average Instruction Size. It computes a number relative to the total
277 function size not just the size of the instruction list.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000278
279**Number of VBR 32-bit Integers**
280
281 The total number of 32-bit integers found in this function (for any use).
282
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000283**Number of VBR 64-bit Integers**
284
285 The total number of 64-bit integers found in this function (for any use).
286
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000287**Number of VBR Compressed Bytes**
288
289 The total number of bytes in this function consumed by the 32-bit and 64-bit
290 integers that use the Variable Bit Rate encoding scheme.
291
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000292**Number of VBR Expanded Bytes**
293
294 The total number of bytes in this function that would have been consumed by
295 the 32-bit and 64-bit integers had they not been compressed with the Variable
296 Bit Rate encoding scheme.
297
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000298**Bytes Saved With VBR**
299
300 The total number of bytes saved in this function by using the Variable Bit
Dmitri Gribenko28574d32012-12-12 19:15:53 +0000301 Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000302
303SEE ALSO
304--------
305
Alex Brachet09a066b2019-07-04 21:19:05 +0000306:manpage:`llvm-dis(1)`, :doc:`/BitCodeFormat`