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