LLVM-BCANALYZER(1)

๐Ÿ’… llvm-bcanalyzer โ€” the LLVM bitcode analyzer, bestie edition โœจ

okay so real talk: this is the llvm-bcanalyzer page from the LLVM manual, and I'm gonna walk you through it like we're texting at 2am ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

llvm-bcanalyzer โ€” LLVM bitcode analyzer. that's it, that's the whole vibe ๐Ÿ’–


โœจ SYNOPSIS โœจ

llvm-bcanalyzer [options] [filename]

literally just that. iconic. no cap ๐ŸŽ€


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so the llvm-bcanalyzer command is this cute little utility for analyzing bitcode files. it reads a bitcode file โ€” like, one you'd generate with the llvm-as tool โ€” and then it produces a statistical report on what's inside that bitcode file. so you get the receipts on your bytes โœจ

the tool can also dump a low level but human readable version of the bitcode file. so like, both the stats and the actual guts, your choice ๐Ÿ’…

now, important vibe check: this tool is probably not of much interest or utility except for those working directly with the bitcode file format. most LLVM users can just ignore this tool. i said what i said โ€” it's a niche icon, and that's okay ๐Ÿ”ฅ

if filename is omitted or is -, then llvm-bcanalyzer reads its input from standard input. this is useful for combining the tool into a pipeline, which is honestly so slay of it ๐ŸŒˆ. output is written to the standard output.


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

  • --dump โ€” causes llvm-bcanalyzer to dump the bitcode in a human readable format. this format is significantly different from LLVM assembly and provides details about the encoding of the bitcode file. it's giving "behind the scenes director's cut" ๐ŸŽฌ
  • --help โ€” print a summary of command line options. the classic, the beloved, the "help me help you" ๐Ÿซถ

๐Ÿงš EXIT STATUS ๐Ÿงš

if llvm-bcanalyzer succeeds, it will exit with 0. otherwise, if an error occurs, it will exit with a non-zero value, usually 1. so 0 = slay, anything else = ๐Ÿ˜ญ


๐Ÿ’œ SUMMARY OUTPUT DEFINITIONS ๐Ÿ’œ

the following items are always printed by llvm-bcanalyzer. they comprize the summary output. (yes, "comprize" โ€” that's what the page says, we keep the facts, periodt ๐Ÿ’…)

๐ŸŒธ Bitcode Analysis Of Module

this just provides the name of the module for which bitcode analysis is being generated. name tag energy ๐Ÿท๏ธ

๐ŸŒธ Bitcode Version Number

the bitcode version (not LLVM version) of the file read by the analyzer. important distinction, bestie โ€” bitcode version, not LLVM version ๐Ÿ‘€

๐ŸŒธ File Size

the size, in bytes, of the entire bitcode file. the whole thing, head to toe ๐Ÿ’–

๐ŸŒธ Module Bytes

the size, in bytes, of the module block. percentage is relative to File Size.

๐ŸŒธ Function Bytes

the size, in bytes, of all the function blocks. percentage is relative to File Size.

๐ŸŒธ Global Types Bytes

the size, in bytes, of the Global Types Pool. percentage is relative to File Size. this is the size of the definitions of all types in the bitcode file. so basically the type lore ๐Ÿ“–

๐ŸŒธ Constant Pool Bytes

the size, in bytes, of the Constant Pool Blocks. percentage is relative to File Size. (the original page runs these two together in one line, and we're not about to separate them ๐Ÿ’€)

๐ŸŒธ Module Globals Bytes

Ths size, in bytes, of the Global Variable Definitions and their initializers. percentage is relative to File Size. ("Ths" โ€” keeping the typo, it's canon now ๐Ÿ™ˆ)

๐ŸŒธ Instruction List Bytes

the size, in bytes, of all the instruction lists in all the functions. percentage is relative to File Size. note that this value is also included in the Function Bytes. so it's double-dipping in the accounting, and we respect that ๐Ÿซก

๐ŸŒธ Compaction Table Bytes

the size, in bytes, of all the compaction tables in all the functions. percentage is relative to File Size. note that this value is also included in the Function Bytes.

๐ŸŒธ Symbol Table Bytes

the size, in bytes, of all the symbol tables in all the functions. percentage is relative to File Size. note that this value is also included in the Function Bytes.

๐ŸŒธ Dependent Libraries Bytes

the size, in bytes, of the list of dependent libraries in the module. percentage is relative to File Size. note that this value is also included in the Module Global Bytes.

๐ŸŒธ Number Of Bitcode Blocks

the total number of blocks of any kind in the bitcode file. any kind!! no discrimination ๐Ÿ’…

๐ŸŒธ Number Of Functions

the total number of function definitions in the bitcode file.

๐ŸŒธ Number Of Types

the total number of types defined in the Global Types Pool.

๐ŸŒธ Number Of Constants

the total number of constants (of any type) defined in the Constant Pool.

๐ŸŒธ Number Of Basic Blocks

the total number of basic blocks defined in all functions in the bitcode file.

๐ŸŒธ Number Of Instructions

the total number of instructions defined in all functions in the bitcode file.

๐ŸŒธ Number Of Long Instructions

the total number of long instructions defined in all functions in the bitcode file. long instructions are those taking greater than 4 bytes. typically long instructions are GetElementPtr with several indices, PHI nodes, and calls to functions with large numbers of arguments. big instruction energy ๐Ÿ”ฅ

๐ŸŒธ Number Of Operands

the total number of operands used in all instructions in the bitcode file.

๐ŸŒธ Number Of Compaction Tables

the total number of compaction tables in all functions in the bitcode file.

๐ŸŒธ Number Of Symbol Tables

the total number of symbol tables in all functions in the bitcode file.

๐ŸŒธ Number Of Dependent Libs

the total number of dependent libraries found in the bitcode file.

๐ŸŒธ Total Instruction Size

the total size of the instructions in all functions in the bitcode file.

๐ŸŒธ Average Instruction Size

the average number of bytes per instruction across all functions in the bitcode file. this value is computed by dividing Total Instruction Size by Number Of Instructions. math girlies rise ๐Ÿงฎ

๐ŸŒธ Maximum Type Slot Number

the maximum value used for a type's slot number. larger slot number values take more bytes to encode. so like, small numbers are lowkey cheaper ๐ŸŒฑ

๐ŸŒธ Maximum Value Slot Number

the maximum value used for a value's slot number. larger slot number values take more bytes to encode.

๐ŸŒธ Bytes Per Value

the average size of a Value definition (of any type). this is computed by dividing File Size by the total number of values of any type.

๐ŸŒธ Bytes Per Global

the average size of a global definition (constants and global variables).

๐ŸŒธ Bytes Per Function

the average number of bytes per function definition. this is computed by dividing Function Bytes by Number Of Functions.

๐ŸŒธ # of VBR 32-bit Integers

the total number of 32-bit integers encoded using the Variable Bit Rate encoding scheme.

๐ŸŒธ # of VBR 64-bit Integers

the total number of 64-bit integers encoded using the Variable Bit Rate encoding scheme.

๐ŸŒธ # of VBR Compressed Bytes

the total number of bytes consumed by the 32-bit and 64-bit integers that use the Variable Bit Rate encoding scheme.

๐ŸŒธ # of VBR Expanded Bytes

the total number of bytes that would have been consumed by the 32-bit and 64-bit integers had they not been compressed with the Variable Bit Rage encoding scheme. ("Bit Rage" โ€” yes, rage. it's in the original. it's giving typo but make it fashion ๐Ÿ’€)

๐ŸŒธ Bytes Saved With VBR

the total number of bytes saved by using the Variable Bit Rate encoding scheme. the percentage is relative to # of VBR Expanded Bytes.


๐ŸŽ€ DETAILED OUTPUT DEFINITIONS ๐ŸŽ€

the following definitions occur only if the -nodetails option was not given. the detailed output provides additional information on a per-function basis. per-function!! the main character breakdown ๐Ÿ‘‘

๐Ÿฆ‹ Type

the type signature of the function.

๐Ÿฆ‹ Byte Size

the total number of bytes in the function's block.

๐Ÿฆ‹ Basic Blocks

the number of basic blocks defined by the function.

๐Ÿฆ‹ Instructions

the number of instructions defined by the function.

๐Ÿฆ‹ Long Instructions

the number of instructions using the long instruction format in the function.

๐Ÿฆ‹ Operands

the number of operands used by all instructions in the function.

๐Ÿฆ‹ Instruction Size

the number of bytes consumed by instructions in the function.

๐Ÿฆ‹ Average Instruction Size

the average number of bytes consumed by the instructions in the function. this value is computed by dividing Instruction Size by Instructions.

๐Ÿฆ‹ Bytes Per Instruction

the average number of bytes used by the function per instruction. this value is computed by dividing Byte Size by Instructions. note that this is not the same as Average Instruction Size. it computes a number relative to the total function size not just the size of the instruction list. two different things, bestie, don't get it twisted ๐Ÿซถ

๐Ÿฆ‹ Number of VBR 32-bit Integers

the total number of 32-bit integers found in this function (for any use).

๐Ÿฆ‹ Number of VBR 64-bit Integers

the total number of 64-bit integers found in this function (for any use).

๐Ÿฆ‹ Number of VBR Compressed Bytes

the total number of bytes in this function consumed by the 32-bit and 64-bit integers that use the Variable Bit Rate encoding scheme.

๐Ÿฆ‹ Number of VBR Expanded Bytes

the total number of bytes in this function that would have been consumed by the 32-bit and 64-bit integers had they not been compressed with the Variable Bit Rate encoding scheme.

๐Ÿฆ‹ Bytes Saved With VBR

the total number of bytes saved in this function by using the Variable Bit Rate encoding scheme. the percentage is relative to # of VBR Expanded Bytes.


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

go read those next, iykyk ๐Ÿ“š๐Ÿ’–


โญ AUTHOR โญ

maintained by the LLVM Team (https://llvm.org/). love them for it ๐Ÿซถ


2003-2023, LLVM Project


and that's the whole page, bestie! ๐ŸŒธ this was LLVM-BCANALYZER(1) from the LLVM manual, dated 2023-07-14, page 15 โ€” mwah, go analyze some bitcode, you absolute icon ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from