5 llvm-bcanalyzer - LLVM bytecode analyzer
9 B<llvm-bcanalyzer> [I<options>] [I<filename>]
13 The B<llvm-bcanalyzer> command is a small utility for analyzing bytecode files.
14 The tool reads a bytecode file (such as generated with the B<llvm-as> tool) and
15 produces a statistical report on the contents of the byteocde file. The tool
16 will also dump a low level but human readable version of the bytecode file.
17 This tool is probably not of much interest or utility except for those working
18 directly with the bytecode file format. Most LLVM users can just ignore
21 If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input
22 from standard input. This is useful for combining the tool into a pipeline.
24 Output is written to the standard output.
33 Causes B<llvm-bcanalyzer> to abbreviate its output by writing out only a module
34 level summary. The details for individual functions are not displayed.
38 Causes B<llvm-bcanalyzer> to dump the bytecode in a human readable format. This
39 format is significantly different from LLVM assembly and provides details about
40 the encoding of the bytecode file.
44 Causes B<llvm-bcanalyzer> to verify the module produced by by reading the
45 bytecode. This ensures that the statistics generated are based on a consistent
50 Print a summary of command line options.
56 If B<llvm-bcanalyzer> succeeds, it will exit with 0. Otherwise, if an error
57 occurs, it will exit with a non-zero value, usually 1.
59 =head1 SUMMARY OUTPUT DEFINITIONS
61 The following items are always printed by llvm-bcanalyzer. They comprize the
66 =item B<Bytecode Analysis Of Module>
68 This just provides the name of the module for which bytecode analysis is being
71 =item B<Bytecode Version Number>
73 The bytecode version (not LLVM version) of the file read by the analyzer.
77 The size, in bytes, of the entire bytecode file.
81 The size, in bytes, of the module block. Percentage is relative to File Size.
83 =item B<Function Bytes>
85 The size, in bytes, of all the function blocks. Percentage is relative to File
88 =item B<Global Types Bytes>
90 The size, in bytes, of the Global Types Pool. Percentage is relative to File
91 Size. This is the size of the definitions of all types in the bytecode file.
93 =item B<Constant Pool Bytes>
95 The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
98 =item B<Module Globals Bytes>
100 Ths size, in bytes, of the Global Variable Definitions and their initializers.
101 Percentage is relative to File Size.
103 =item B<Instruction List Bytes>
105 The size, in bytes, of all the instruction lists in all the functions.
106 Percentage is relative to File Size. Note that this value is also included in
109 =item B<Compaction Table Bytes>
111 The size, in bytes, of all the compaction tables in all the functions.
112 Percentage is relative to File Size. Note that this value is also included in
115 =item B<Compaction Table Bytes>
117 The size, in bytes, of all the symbol tables in all the functions. Percentage is
118 relative to File Size. Note that this value is also included in the Function
121 =item B<Dependent Libraries Bytes>
123 The size, in bytes, of the list of dependent libraries in the module. Percentage
124 is relative to File Size. Note that this value is also included in the Module
127 =item B<Number Of Bytecode Blocks>
129 The total number of blocks of any kind in the bytecode file.
131 =item B<Number Of Functions>
133 The total number of function definitions in the bytecode file.
135 =item B<Number Of Types>
137 The total number of types defined in the Global Types Pool.
139 =item B<Number Of Constants>
141 The total number of constants (of any type) defined in the Constant Pool.
143 =item B<Number Of Basic Blocks>
145 The total number of basic blocks defined in all functions in the bytecode file.
147 =item B<Number Of Instructions>
149 The total number of instructions defined in all functions in the bytecode file.
151 =item B<Number Of Long Instructions>
153 The total number of long instructions defined in all functions in the bytecode
154 file. Long instructions are those taking greater than 4 bytes. Typically long
155 instructions are GetElementPtr with several indices, PHI nodes, and calls to
156 functions with large numbers of arguments.
158 =item B<Number Of Operands>
160 The total number of operands used in all instructions in the bytecode file.
162 =item B<Number Of Compaction Tables>
164 The total number of compaction tables in all functions in the bytecode file.
166 =item B<Number Of Symbol Tables>
168 The total number of symbol tables in all functions in the bytecode file.
170 =item B<Number Of Dependent Libs>
172 The total number of dependent libraries found in the bytecode file.
174 =item B<Total Instruction Size>
176 The total size of the instructions in all functions in the bytecode file.
178 =item B<Average Instruction Size>
180 The average number of bytes per instruction across all functions in the bytecode
181 file. This value is computed by dividing Total Instruction Size by Number Of
184 =item B<Maximum Type Slot Number>
186 The maximum value used for a type's slot number. Larger slot number values take
187 more bytes to encode.
189 =item B<Maximum Value Slot Number>
191 The maximum value used for a value's slot number. Larger slot number values take
192 more bytes to encode.
194 =item B<Bytes Per Value>
196 The average size of a Value definition (of any type). This is computed by
197 dividing File Size by the total number of values of any type.
199 =item B<Bytes Per Global>
201 The average size of a global definition (constants and global variables).
203 =item B<Bytes Per Function>
205 The average number of bytes per function definition. This is computed by
206 dividing Function Bytes by Number Of Functions.
208 =item B<# of VBR 32-bit Integers>
210 The total number of 32-bit integers encoded using the Variable Bit Rate
213 =item B<# of VBR 64-bit Integers>
215 The total number of 64-bit integers encoded using the Variable Bit Rate encoding
218 =item B<# of VBR Compressed Bytes>
220 The total number of bytes consumed by the 32-bit and 64-bit integers that use
221 the Variable Bit Rate encoding scheme.
223 =item B<# of VBR Expanded Bytes>
225 The total number of bytes that would have been consumed by the 32-bit and 64-bit
226 integers had they not been compressed with the Variable Bit Rage encoding
229 =item B<Bytes Saved With VBR>
231 The total number of bytes saved by using the Variable Bit Rate encoding scheme.
232 The percentage is relative to # of VBR Expanded Bytes.
236 =head1 DETAILED OUTPUT DEFINITIONS
238 The following definitions occur only if the -nodetails option was not given.
239 The detailed output provides additional information on a per-function basis.
245 The type signature of the function.
249 The total number of bytes in the function's block.
251 =item B<Basic Blocks>
253 The number of basic blocks defined by the function.
255 =item B<Instructions>
257 The number of instructions defined by the function.
259 =item B<Long Instructions>
261 The number of instructions using the long instruction format in the function.
265 The number of operands used by all instructions in the function.
267 =item B<Instruction Size>
269 The number of bytes consumed by instructions in the function.
271 =item B<Average Instruction Size>
273 The average number of bytes consumed by the instructions in the funtion. This
274 value is computed by dividing Instruction Size by Instructions.
276 =item B<Bytes Per Instruction>
278 The average number of bytes used by the function per instruction. This value is
279 computed by dividing Byte Size by Instructions. Note that this is not the same
280 as Average Instruction Size. It computes a number relative to the total function
281 size not just the size of the instruction list.
283 =item B<# of VBR 32-bit Integers>
285 The total number of 32-bit integers found in this function (for any use).
287 =item B<# of VBR 64-bit Integers>
289 The total number of 64-bit integers found in this function (for any use).
291 =item B<# of VBR Compressed Bytes>
293 The total number of bytes in this function consumed by the 32-bit and 64-bit
294 integers that use the Variable Bit Rate encoding scheme.
296 =item B<# of VBR Expanded Bytes>
298 The total number of bytes in this function that would have been consumed by
299 the 32-bit and 64-bit integers had they not been compressed with the Variable
300 Bit Rate encoding scheme.
302 =item B<Bytes Saved With VBR>
304 The total number of bytes saved in this function by using the Variable Bit
305 Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
311 L<llvm-dis|llvm-dis>, L<http://llvm.cs.uiuc.edu/docs/BytecodeFormat.html>
315 Maintained by Reid Spencer (L<http://llvm.x10sys.com/rspencer>).