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