blob: 7254088ec9461c9fb61703f9647331b4fbbdc6c4 [file] [log] [blame]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00001llvm-bcanalyzer - LLVM bitcode analyzer
2=======================================
3
Daniel Dunbar3b709d52012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Dmitri Gribenko8ce12092012-12-12 19:15:53 +00007:program:`llvm-bcanalyzer` [*options*] [*filename*]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00008
9DESCRIPTION
10-----------
11
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000012The :program:`llvm-bcanalyzer` command is a small utility for analyzing bitcode
13files. The tool reads a bitcode file (such as generated with the
14:program:`llvm-as` tool) and produces a statistical report on the contents of
15the bitcode file. The tool can also dump a low level but human readable
16version of the bitcode file. This tool is probably not of much interest or
17utility except for those working directly with the bitcode file format. Most
18LLVM users can just ignore this tool.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000019
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000020If *filename* is omitted or is ``-``, then :program:`llvm-bcanalyzer` reads its
21input from standard input. This is useful for combining the tool into a
22pipeline. Output is written to the standard output.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000023
24OPTIONS
25-------
26
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000027.. program:: llvm-bcanalyzer
Daniel Dunbar3b709d52012-05-08 16:50:35 +000028
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000029.. option:: -nodetails
Daniel Dunbar3b709d52012-05-08 16:50:35 +000030
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000031 Causes :program:`llvm-bcanalyzer` to abbreviate its output by writing out only
32 a module level summary. The details for individual functions are not
33 displayed.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000034
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000035.. option:: -dump
Daniel Dunbar3b709d52012-05-08 16:50:35 +000036
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000037 Causes :program:`llvm-bcanalyzer` to dump the bitcode in a human readable
38 format. This format is significantly different from LLVM assembly and
39 provides details about the encoding of the bitcode file.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000040
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000041.. option:: -verify
Daniel Dunbar3b709d52012-05-08 16:50:35 +000042
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000043 Causes :program:`llvm-bcanalyzer` to verify the module produced by reading the
44 bitcode. This ensures that the statistics generated are based on a consistent
Daniel Dunbar3b709d52012-05-08 16:50:35 +000045 module.
46
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000047.. option:: -help
Daniel Dunbar3b709d52012-05-08 16:50:35 +000048
49 Print a summary of command line options.
50
Daniel Dunbar3b709d52012-05-08 16:50:35 +000051EXIT STATUS
52-----------
53
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000054If :program:`llvm-bcanalyzer` succeeds, it will exit with 0. Otherwise, if an
55error occurs, it will exit with a non-zero value, usually 1.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000056
57SUMMARY OUTPUT DEFINITIONS
58--------------------------
59
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000060The following items are always printed by llvm-bcanalyzer. They comprize the
Daniel Dunbar3b709d52012-05-08 16:50:35 +000061summary output.
62
Daniel Dunbar3b709d52012-05-08 16:50:35 +000063**Bitcode Analysis Of Module**
64
65 This just provides the name of the module for which bitcode analysis is being
66 generated.
67
Daniel Dunbar3b709d52012-05-08 16:50:35 +000068**Bitcode Version Number**
69
70 The bitcode version (not LLVM version) of the file read by the analyzer.
71
Daniel Dunbar3b709d52012-05-08 16:50:35 +000072**File Size**
73
74 The size, in bytes, of the entire bitcode file.
75
Daniel Dunbar3b709d52012-05-08 16:50:35 +000076**Module Bytes**
77
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000078 The size, in bytes, of the module block. Percentage is relative to File Size.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000079
80**Function Bytes**
81
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000082 The size, in bytes, of all the function blocks. Percentage is relative to File
Daniel Dunbar3b709d52012-05-08 16:50:35 +000083 Size.
84
Daniel Dunbar3b709d52012-05-08 16:50:35 +000085**Global Types Bytes**
86
Dmitri Gribenko8ce12092012-12-12 19:15:53 +000087 The size, in bytes, of the Global Types Pool. Percentage is relative to File
88 Size. This is the size of the definitions of all types in the bitcode file.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000089
90**Constant Pool Bytes**
91
92 The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
93 Size.
94
Daniel Dunbar3b709d52012-05-08 16:50:35 +000095**Module Globals Bytes**
96
97 Ths size, in bytes, of the Global Variable Definitions and their initializers.
98 Percentage is relative to File Size.
99
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000100**Instruction List Bytes**
101
102 The size, in bytes, of all the instruction lists in all the functions.
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000103 Percentage is relative to File Size. Note that this value is also included in
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000104 the Function Bytes.
105
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000106**Compaction Table Bytes**
107
108 The size, in bytes, of all the compaction tables in all the functions.
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000109 Percentage is relative to File Size. Note that this value is also included in
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000110 the Function Bytes.
111
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000112**Symbol Table Bytes**
113
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000114 The size, in bytes, of all the symbol tables in all the functions. Percentage is
115 relative to File Size. Note that this value is also included in the Function
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000116 Bytes.
117
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000118**Dependent Libraries Bytes**
119
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000120 The size, in bytes, of the list of dependent libraries in the module. Percentage
121 is relative to File Size. Note that this value is also included in the Module
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000122 Global Bytes.
123
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000124**Number Of Bitcode Blocks**
125
126 The total number of blocks of any kind in the bitcode file.
127
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000128**Number Of Functions**
129
130 The total number of function definitions in the bitcode file.
131
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000132**Number Of Types**
133
134 The total number of types defined in the Global Types Pool.
135
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000136**Number Of Constants**
137
138 The total number of constants (of any type) defined in the Constant Pool.
139
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000140**Number Of Basic Blocks**
141
142 The total number of basic blocks defined in all functions in the bitcode file.
143
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000144**Number Of Instructions**
145
146 The total number of instructions defined in all functions in the bitcode file.
147
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000148**Number Of Long Instructions**
149
150 The total number of long instructions defined in all functions in the bitcode
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000151 file. Long instructions are those taking greater than 4 bytes. Typically long
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000152 instructions are GetElementPtr with several indices, PHI nodes, and calls to
153 functions with large numbers of arguments.
154
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000155**Number Of Operands**
156
157 The total number of operands used in all instructions in the bitcode file.
158
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000159**Number Of Compaction Tables**
160
161 The total number of compaction tables in all functions in the bitcode file.
162
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000163**Number Of Symbol Tables**
164
165 The total number of symbol tables in all functions in the bitcode file.
166
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000167**Number Of Dependent Libs**
168
169 The total number of dependent libraries found in the bitcode file.
170
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000171**Total Instruction Size**
172
173 The total size of the instructions in all functions in the bitcode file.
174
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000175**Average Instruction Size**
176
177 The average number of bytes per instruction across all functions in the bitcode
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000178 file. This value is computed by dividing Total Instruction Size by Number Of
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000179 Instructions.
180
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000181**Maximum Type Slot Number**
182
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000183 The maximum value used for a type's slot number. Larger slot number values take
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000184 more bytes to encode.
185
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000186**Maximum Value Slot Number**
187
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000188 The maximum value used for a value's slot number. Larger slot number values take
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000189 more bytes to encode.
190
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000191**Bytes Per Value**
192
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000193 The average size of a Value definition (of any type). This is computed by
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000194 dividing File Size by the total number of values of any type.
195
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000196**Bytes Per Global**
197
198 The average size of a global definition (constants and global variables).
199
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000200**Bytes Per Function**
201
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000202 The average number of bytes per function definition. This is computed by
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000203 dividing Function Bytes by Number Of Functions.
204
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000205**# of VBR 32-bit Integers**
206
207 The total number of 32-bit integers encoded using the Variable Bit Rate
208 encoding scheme.
209
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000210**# of VBR 64-bit Integers**
211
212 The total number of 64-bit integers encoded using the Variable Bit Rate encoding
213 scheme.
214
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000215**# of VBR Compressed Bytes**
216
217 The total number of bytes consumed by the 32-bit and 64-bit integers that use
218 the Variable Bit Rate encoding scheme.
219
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000220**# of VBR Expanded Bytes**
221
222 The total number of bytes that would have been consumed by the 32-bit and 64-bit
223 integers had they not been compressed with the Variable Bit Rage encoding
224 scheme.
225
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000226**Bytes Saved With VBR**
227
228 The total number of bytes saved by using the Variable Bit Rate encoding scheme.
229 The percentage is relative to # of VBR Expanded Bytes.
230
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000231DETAILED OUTPUT DEFINITIONS
232---------------------------
233
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000234The following definitions occur only if the -nodetails option was not given.
235The detailed output provides additional information on a per-function basis.
236
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000237**Type**
238
239 The type signature of the function.
240
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000241**Byte Size**
242
243 The total number of bytes in the function's block.
244
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000245**Basic Blocks**
246
247 The number of basic blocks defined by the function.
248
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000249**Instructions**
250
251 The number of instructions defined by the function.
252
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000253**Long Instructions**
254
255 The number of instructions using the long instruction format in the function.
256
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000257**Operands**
258
259 The number of operands used by all instructions in the function.
260
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000261**Instruction Size**
262
263 The number of bytes consumed by instructions in the function.
264
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000265**Average Instruction Size**
266
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000267 The average number of bytes consumed by the instructions in the function.
268 This value is computed by dividing Instruction Size by Instructions.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000269
270**Bytes Per Instruction**
271
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000272 The average number of bytes used by the function per instruction. This value
273 is computed by dividing Byte Size by Instructions. Note that this is not the
274 same as Average Instruction Size. It computes a number relative to the total
275 function size not just the size of the instruction list.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000276
277**Number of VBR 32-bit Integers**
278
279 The total number of 32-bit integers found in this function (for any use).
280
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000281**Number of VBR 64-bit Integers**
282
283 The total number of 64-bit integers found in this function (for any use).
284
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000285**Number of VBR Compressed Bytes**
286
287 The total number of bytes in this function consumed by the 32-bit and 64-bit
288 integers that use the Variable Bit Rate encoding scheme.
289
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000290**Number of VBR Expanded Bytes**
291
292 The total number of bytes in this function that would have been consumed by
293 the 32-bit and 64-bit integers had they not been compressed with the Variable
294 Bit Rate encoding scheme.
295
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000296**Bytes Saved With VBR**
297
298 The total number of bytes saved in this function by using the Variable Bit
Dmitri Gribenko8ce12092012-12-12 19:15:53 +0000299 Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000300
301SEE ALSO
302--------
303
Dmitri Gribenkoaf9de4f2012-12-12 21:16:29 +0000304:doc:`/CommandGuide/llvm-dis`, :doc:`/BitCodeFormat`
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000305