Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 1 | llvm-bcanalyzer - LLVM bitcode analyzer |
| 2 | ======================================= |
| 3 | |
| 4 | |
| 5 | SYNOPSIS |
| 6 | -------- |
| 7 | |
| 8 | |
| 9 | **llvm-bcanalyzer** [*options*] [*filename*] |
| 10 | |
| 11 | |
| 12 | DESCRIPTION |
| 13 | ----------- |
| 14 | |
| 15 | |
| 16 | The **llvm-bcanalyzer** command is a small utility for analyzing bitcode files. |
| 17 | The tool reads a bitcode file (such as generated with the **llvm-as** tool) and |
| 18 | produces a statistical report on the contents of the bitcode file. The tool |
| 19 | can also dump a low level but human readable version of the bitcode file. |
| 20 | This tool is probably not of much interest or utility except for those working |
| 21 | directly with the bitcode file format. Most LLVM users can just ignore |
| 22 | this tool. |
| 23 | |
| 24 | If *filename* is omitted or is ``-``, then **llvm-bcanalyzer** reads its input |
| 25 | from standard input. This is useful for combining the tool into a pipeline. |
| 26 | Output is written to the standard output. |
| 27 | |
| 28 | |
| 29 | OPTIONS |
| 30 | ------- |
| 31 | |
| 32 | |
| 33 | |
| 34 | **-nodetails** |
| 35 | |
| 36 | Causes **llvm-bcanalyzer** to abbreviate its output by writing out only a module |
| 37 | level summary. The details for individual functions are not displayed. |
| 38 | |
| 39 | |
| 40 | |
| 41 | **-dump** |
| 42 | |
| 43 | Causes **llvm-bcanalyzer** to dump the bitcode in a human readable format. This |
| 44 | format is significantly different from LLVM assembly and provides details about |
| 45 | the encoding of the bitcode file. |
| 46 | |
| 47 | |
| 48 | |
| 49 | **-verify** |
| 50 | |
| 51 | Causes **llvm-bcanalyzer** to verify the module produced by reading the |
| 52 | bitcode. This ensures that the statistics generated are based on a consistent |
| 53 | module. |
| 54 | |
| 55 | |
| 56 | |
| 57 | **-help** |
| 58 | |
| 59 | Print a summary of command line options. |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | EXIT STATUS |
| 65 | ----------- |
| 66 | |
| 67 | |
| 68 | If **llvm-bcanalyzer** succeeds, it will exit with 0. Otherwise, if an error |
| 69 | occurs, it will exit with a non-zero value, usually 1. |
| 70 | |
| 71 | |
| 72 | SUMMARY OUTPUT DEFINITIONS |
| 73 | -------------------------- |
| 74 | |
| 75 | |
| 76 | The following items are always printed by llvm-bcanalyzer. They comprize the |
| 77 | summary output. |
| 78 | |
| 79 | |
| 80 | **Bitcode Analysis Of Module** |
| 81 | |
| 82 | This just provides the name of the module for which bitcode analysis is being |
| 83 | generated. |
| 84 | |
| 85 | |
| 86 | |
| 87 | **Bitcode Version Number** |
| 88 | |
| 89 | The bitcode version (not LLVM version) of the file read by the analyzer. |
| 90 | |
| 91 | |
| 92 | |
| 93 | **File Size** |
| 94 | |
| 95 | The size, in bytes, of the entire bitcode file. |
| 96 | |
| 97 | |
| 98 | |
| 99 | **Module Bytes** |
| 100 | |
| 101 | The size, in bytes, of the module block. Percentage is relative to File Size. |
| 102 | |
| 103 | |
| 104 | |
| 105 | **Function Bytes** |
| 106 | |
| 107 | The size, in bytes, of all the function blocks. Percentage is relative to File |
| 108 | Size. |
| 109 | |
| 110 | |
| 111 | |
| 112 | **Global Types Bytes** |
| 113 | |
| 114 | The size, in bytes, of the Global Types Pool. Percentage is relative to File |
| 115 | Size. This is the size of the definitions of all types in the bitcode file. |
| 116 | |
| 117 | |
| 118 | |
| 119 | **Constant Pool Bytes** |
| 120 | |
| 121 | The size, in bytes, of the Constant Pool Blocks Percentage is relative to File |
| 122 | Size. |
| 123 | |
| 124 | |
| 125 | |
| 126 | **Module Globals Bytes** |
| 127 | |
| 128 | Ths size, in bytes, of the Global Variable Definitions and their initializers. |
| 129 | Percentage is relative to File Size. |
| 130 | |
| 131 | |
| 132 | |
| 133 | **Instruction List Bytes** |
| 134 | |
| 135 | The size, in bytes, of all the instruction lists in all the functions. |
| 136 | Percentage is relative to File Size. Note that this value is also included in |
| 137 | the Function Bytes. |
| 138 | |
| 139 | |
| 140 | |
| 141 | **Compaction Table Bytes** |
| 142 | |
| 143 | The size, in bytes, of all the compaction tables in all the functions. |
| 144 | Percentage is relative to File Size. Note that this value is also included in |
| 145 | the Function Bytes. |
| 146 | |
| 147 | |
| 148 | |
| 149 | **Symbol Table Bytes** |
| 150 | |
| 151 | The size, in bytes, of all the symbol tables in all the functions. Percentage is |
| 152 | relative to File Size. Note that this value is also included in the Function |
| 153 | Bytes. |
| 154 | |
| 155 | |
| 156 | |
| 157 | **Dependent Libraries Bytes** |
| 158 | |
| 159 | The size, in bytes, of the list of dependent libraries in the module. Percentage |
| 160 | is relative to File Size. Note that this value is also included in the Module |
| 161 | Global Bytes. |
| 162 | |
| 163 | |
| 164 | |
| 165 | **Number Of Bitcode Blocks** |
| 166 | |
| 167 | The total number of blocks of any kind in the bitcode file. |
| 168 | |
| 169 | |
| 170 | |
| 171 | **Number Of Functions** |
| 172 | |
| 173 | The total number of function definitions in the bitcode file. |
| 174 | |
| 175 | |
| 176 | |
| 177 | **Number Of Types** |
| 178 | |
| 179 | The total number of types defined in the Global Types Pool. |
| 180 | |
| 181 | |
| 182 | |
| 183 | **Number Of Constants** |
| 184 | |
| 185 | The total number of constants (of any type) defined in the Constant Pool. |
| 186 | |
| 187 | |
| 188 | |
| 189 | **Number Of Basic Blocks** |
| 190 | |
| 191 | The total number of basic blocks defined in all functions in the bitcode file. |
| 192 | |
| 193 | |
| 194 | |
| 195 | **Number Of Instructions** |
| 196 | |
| 197 | The total number of instructions defined in all functions in the bitcode file. |
| 198 | |
| 199 | |
| 200 | |
| 201 | **Number Of Long Instructions** |
| 202 | |
| 203 | The total number of long instructions defined in all functions in the bitcode |
| 204 | file. Long instructions are those taking greater than 4 bytes. Typically long |
| 205 | instructions are GetElementPtr with several indices, PHI nodes, and calls to |
| 206 | functions with large numbers of arguments. |
| 207 | |
| 208 | |
| 209 | |
| 210 | **Number Of Operands** |
| 211 | |
| 212 | The total number of operands used in all instructions in the bitcode file. |
| 213 | |
| 214 | |
| 215 | |
| 216 | **Number Of Compaction Tables** |
| 217 | |
| 218 | The total number of compaction tables in all functions in the bitcode file. |
| 219 | |
| 220 | |
| 221 | |
| 222 | **Number Of Symbol Tables** |
| 223 | |
| 224 | The total number of symbol tables in all functions in the bitcode file. |
| 225 | |
| 226 | |
| 227 | |
| 228 | **Number Of Dependent Libs** |
| 229 | |
| 230 | The total number of dependent libraries found in the bitcode file. |
| 231 | |
| 232 | |
| 233 | |
| 234 | **Total Instruction Size** |
| 235 | |
| 236 | The total size of the instructions in all functions in the bitcode file. |
| 237 | |
| 238 | |
| 239 | |
| 240 | **Average Instruction Size** |
| 241 | |
| 242 | The average number of bytes per instruction across all functions in the bitcode |
| 243 | file. This value is computed by dividing Total Instruction Size by Number Of |
| 244 | Instructions. |
| 245 | |
| 246 | |
| 247 | |
| 248 | **Maximum Type Slot Number** |
| 249 | |
| 250 | The maximum value used for a type's slot number. Larger slot number values take |
| 251 | more bytes to encode. |
| 252 | |
| 253 | |
| 254 | |
| 255 | **Maximum Value Slot Number** |
| 256 | |
| 257 | The maximum value used for a value's slot number. Larger slot number values take |
| 258 | more bytes to encode. |
| 259 | |
| 260 | |
| 261 | |
| 262 | **Bytes Per Value** |
| 263 | |
| 264 | The average size of a Value definition (of any type). This is computed by |
| 265 | dividing File Size by the total number of values of any type. |
| 266 | |
| 267 | |
| 268 | |
| 269 | **Bytes Per Global** |
| 270 | |
| 271 | The average size of a global definition (constants and global variables). |
| 272 | |
| 273 | |
| 274 | |
| 275 | **Bytes Per Function** |
| 276 | |
| 277 | The average number of bytes per function definition. This is computed by |
| 278 | dividing Function Bytes by Number Of Functions. |
| 279 | |
| 280 | |
| 281 | |
| 282 | **# of VBR 32-bit Integers** |
| 283 | |
| 284 | The total number of 32-bit integers encoded using the Variable Bit Rate |
| 285 | encoding scheme. |
| 286 | |
| 287 | |
| 288 | |
| 289 | **# of VBR 64-bit Integers** |
| 290 | |
| 291 | The total number of 64-bit integers encoded using the Variable Bit Rate encoding |
| 292 | scheme. |
| 293 | |
| 294 | |
| 295 | |
| 296 | **# of VBR Compressed Bytes** |
| 297 | |
| 298 | The total number of bytes consumed by the 32-bit and 64-bit integers that use |
| 299 | the Variable Bit Rate encoding scheme. |
| 300 | |
| 301 | |
| 302 | |
| 303 | **# of VBR Expanded Bytes** |
| 304 | |
| 305 | The total number of bytes that would have been consumed by the 32-bit and 64-bit |
| 306 | integers had they not been compressed with the Variable Bit Rage encoding |
| 307 | scheme. |
| 308 | |
| 309 | |
| 310 | |
| 311 | **Bytes Saved With VBR** |
| 312 | |
| 313 | The total number of bytes saved by using the Variable Bit Rate encoding scheme. |
| 314 | The percentage is relative to # of VBR Expanded Bytes. |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | DETAILED OUTPUT DEFINITIONS |
| 320 | --------------------------- |
| 321 | |
| 322 | |
| 323 | The following definitions occur only if the -nodetails option was not given. |
| 324 | The detailed output provides additional information on a per-function basis. |
| 325 | |
| 326 | |
| 327 | **Type** |
| 328 | |
| 329 | The type signature of the function. |
| 330 | |
| 331 | |
| 332 | |
| 333 | **Byte Size** |
| 334 | |
| 335 | The total number of bytes in the function's block. |
| 336 | |
| 337 | |
| 338 | |
| 339 | **Basic Blocks** |
| 340 | |
| 341 | The number of basic blocks defined by the function. |
| 342 | |
| 343 | |
| 344 | |
| 345 | **Instructions** |
| 346 | |
| 347 | The number of instructions defined by the function. |
| 348 | |
| 349 | |
| 350 | |
| 351 | **Long Instructions** |
| 352 | |
| 353 | The number of instructions using the long instruction format in the function. |
| 354 | |
| 355 | |
| 356 | |
| 357 | **Operands** |
| 358 | |
| 359 | The number of operands used by all instructions in the function. |
| 360 | |
| 361 | |
| 362 | |
| 363 | **Instruction Size** |
| 364 | |
| 365 | The number of bytes consumed by instructions in the function. |
| 366 | |
| 367 | |
| 368 | |
| 369 | **Average Instruction Size** |
| 370 | |
| 371 | The average number of bytes consumed by the instructions in the function. This |
| 372 | value is computed by dividing Instruction Size by Instructions. |
| 373 | |
| 374 | |
| 375 | |
| 376 | **Bytes Per Instruction** |
| 377 | |
| 378 | The average number of bytes used by the function per instruction. This value is |
| 379 | computed by dividing Byte Size by Instructions. Note that this is not the same |
| 380 | as Average Instruction Size. It computes a number relative to the total function |
| 381 | size not just the size of the instruction list. |
| 382 | |
| 383 | |
| 384 | |
| 385 | **Number of VBR 32-bit Integers** |
| 386 | |
| 387 | The total number of 32-bit integers found in this function (for any use). |
| 388 | |
| 389 | |
| 390 | |
| 391 | **Number of VBR 64-bit Integers** |
| 392 | |
| 393 | The total number of 64-bit integers found in this function (for any use). |
| 394 | |
| 395 | |
| 396 | |
| 397 | **Number of VBR Compressed Bytes** |
| 398 | |
| 399 | The total number of bytes in this function consumed by the 32-bit and 64-bit |
| 400 | integers that use the Variable Bit Rate encoding scheme. |
| 401 | |
| 402 | |
| 403 | |
| 404 | **Number of VBR Expanded Bytes** |
| 405 | |
| 406 | The total number of bytes in this function that would have been consumed by |
| 407 | the 32-bit and 64-bit integers had they not been compressed with the Variable |
| 408 | Bit Rate encoding scheme. |
| 409 | |
| 410 | |
| 411 | |
| 412 | **Bytes Saved With VBR** |
| 413 | |
| 414 | The total number of bytes saved in this function by using the Variable Bit |
| 415 | Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes. |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | SEE ALSO |
| 421 | -------- |
| 422 | |
| 423 | |
| 424 | llvm-dis|llvm-dis, `http://llvm.org/docs/BitCodeFormat.html <http://llvm.org/docs/BitCodeFormat.html>`_ |