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