Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 1 | llvm-bcanalyzer - LLVM bitcode analyzer |
| 2 | ======================================= |
| 3 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 4 | SYNOPSIS |
| 5 | -------- |
| 6 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 7 | :program:`llvm-bcanalyzer` [*options*] [*filename*] |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 8 | |
| 9 | DESCRIPTION |
| 10 | ----------- |
| 11 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 19 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 23 | |
| 24 | OPTIONS |
| 25 | ------- |
| 26 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 27 | .. program:: llvm-bcanalyzer |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 28 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 29 | .. option:: -nodetails |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 30 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 34 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 35 | .. option:: -dump |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 36 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 40 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 41 | .. option:: -verify |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 42 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 45 | module. |
| 46 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 47 | .. option:: -help |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 48 | |
| 49 | Print a summary of command line options. |
| 50 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 51 | EXIT STATUS |
| 52 | ----------- |
| 53 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 56 | |
| 57 | SUMMARY OUTPUT DEFINITIONS |
| 58 | -------------------------- |
| 59 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 60 | The following items are always printed by llvm-bcanalyzer. They comprize the |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 61 | summary output. |
| 62 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 63 | **Bitcode Analysis Of Module** |
| 64 | |
| 65 | This just provides the name of the module for which bitcode analysis is being |
| 66 | generated. |
| 67 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 68 | **Bitcode Version Number** |
| 69 | |
| 70 | The bitcode version (not LLVM version) of the file read by the analyzer. |
| 71 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 72 | **File Size** |
| 73 | |
| 74 | The size, in bytes, of the entire bitcode file. |
| 75 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 76 | **Module Bytes** |
| 77 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 78 | The size, in bytes, of the module block. Percentage is relative to File Size. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 79 | |
| 80 | **Function Bytes** |
| 81 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 82 | The size, in bytes, of all the function blocks. Percentage is relative to File |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 83 | Size. |
| 84 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 85 | **Global Types Bytes** |
| 86 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 89 | |
| 90 | **Constant Pool Bytes** |
| 91 | |
| 92 | The size, in bytes, of the Constant Pool Blocks Percentage is relative to File |
| 93 | Size. |
| 94 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 100 | **Instruction List Bytes** |
| 101 | |
| 102 | The size, in bytes, of all the instruction lists in all the functions. |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 103 | Percentage is relative to File Size. Note that this value is also included in |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 104 | the Function Bytes. |
| 105 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 106 | **Compaction Table Bytes** |
| 107 | |
| 108 | The size, in bytes, of all the compaction tables in all the functions. |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 109 | Percentage is relative to File Size. Note that this value is also included in |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 110 | the Function Bytes. |
| 111 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 112 | **Symbol Table Bytes** |
| 113 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 116 | Bytes. |
| 117 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 118 | **Dependent Libraries Bytes** |
| 119 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 122 | Global Bytes. |
| 123 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 124 | **Number Of Bitcode Blocks** |
| 125 | |
| 126 | The total number of blocks of any kind in the bitcode file. |
| 127 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 128 | **Number Of Functions** |
| 129 | |
| 130 | The total number of function definitions in the bitcode file. |
| 131 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 132 | **Number Of Types** |
| 133 | |
| 134 | The total number of types defined in the Global Types Pool. |
| 135 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 136 | **Number Of Constants** |
| 137 | |
| 138 | The total number of constants (of any type) defined in the Constant Pool. |
| 139 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 140 | **Number Of Basic Blocks** |
| 141 | |
| 142 | The total number of basic blocks defined in all functions in the bitcode file. |
| 143 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 144 | **Number Of Instructions** |
| 145 | |
| 146 | The total number of instructions defined in all functions in the bitcode file. |
| 147 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 148 | **Number Of Long Instructions** |
| 149 | |
| 150 | The total number of long instructions defined in all functions in the bitcode |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 151 | file. Long instructions are those taking greater than 4 bytes. Typically long |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 152 | instructions are GetElementPtr with several indices, PHI nodes, and calls to |
| 153 | functions with large numbers of arguments. |
| 154 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 155 | **Number Of Operands** |
| 156 | |
| 157 | The total number of operands used in all instructions in the bitcode file. |
| 158 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 159 | **Number Of Compaction Tables** |
| 160 | |
| 161 | The total number of compaction tables in all functions in the bitcode file. |
| 162 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 163 | **Number Of Symbol Tables** |
| 164 | |
| 165 | The total number of symbol tables in all functions in the bitcode file. |
| 166 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 167 | **Number Of Dependent Libs** |
| 168 | |
| 169 | The total number of dependent libraries found in the bitcode file. |
| 170 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 171 | **Total Instruction Size** |
| 172 | |
| 173 | The total size of the instructions in all functions in the bitcode file. |
| 174 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 175 | **Average Instruction Size** |
| 176 | |
| 177 | The average number of bytes per instruction across all functions in the bitcode |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 178 | file. This value is computed by dividing Total Instruction Size by Number Of |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 179 | Instructions. |
| 180 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 181 | **Maximum Type Slot Number** |
| 182 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 183 | The maximum value used for a type's slot number. Larger slot number values take |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 184 | more bytes to encode. |
| 185 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 186 | **Maximum Value Slot Number** |
| 187 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 188 | The maximum value used for a value's slot number. Larger slot number values take |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 189 | more bytes to encode. |
| 190 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 191 | **Bytes Per Value** |
| 192 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 193 | The average size of a Value definition (of any type). This is computed by |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 194 | dividing File Size by the total number of values of any type. |
| 195 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 196 | **Bytes Per Global** |
| 197 | |
| 198 | The average size of a global definition (constants and global variables). |
| 199 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 200 | **Bytes Per Function** |
| 201 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 202 | The average number of bytes per function definition. This is computed by |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 203 | dividing Function Bytes by Number Of Functions. |
| 204 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 231 | DETAILED OUTPUT DEFINITIONS |
| 232 | --------------------------- |
| 233 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 237 | **Type** |
| 238 | |
| 239 | The type signature of the function. |
| 240 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 241 | **Byte Size** |
| 242 | |
| 243 | The total number of bytes in the function's block. |
| 244 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 245 | **Basic Blocks** |
| 246 | |
| 247 | The number of basic blocks defined by the function. |
| 248 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 249 | **Instructions** |
| 250 | |
| 251 | The number of instructions defined by the function. |
| 252 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 253 | **Long Instructions** |
| 254 | |
| 255 | The number of instructions using the long instruction format in the function. |
| 256 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 257 | **Operands** |
| 258 | |
| 259 | The number of operands used by all instructions in the function. |
| 260 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 261 | **Instruction Size** |
| 262 | |
| 263 | The number of bytes consumed by instructions in the function. |
| 264 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 265 | **Average Instruction Size** |
| 266 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 267 | The average number of bytes consumed by the instructions in the function. |
| 268 | This value is computed by dividing Instruction Size by Instructions. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 269 | |
| 270 | **Bytes Per Instruction** |
| 271 | |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 281 | **Number of VBR 64-bit Integers** |
| 282 | |
| 283 | The total number of 64-bit integers found in this function (for any use). |
| 284 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 296 | **Bytes Saved With VBR** |
| 297 | |
| 298 | The total number of bytes saved in this function by using the Variable Bit |
Dmitri Gribenko | 8ce1209 | 2012-12-12 19:15:53 +0000 | [diff] [blame] | 299 | Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 300 | |
| 301 | SEE ALSO |
| 302 | -------- |
| 303 | |
Dmitri Gribenko | af9de4f | 2012-12-12 21:16:29 +0000 | [diff] [blame^] | 304 | :doc:`/CommandGuide/llvm-dis`, :doc:`/BitCodeFormat` |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 305 | |