LLVM-MC(1)

๐Ÿ“ฆ version 12.0.1, in ubuntu jammy

๐Ÿ’– LLVM-MC(1) ๐Ÿ’–

okay bestie, welcome to the manual page for llvm-mc 12 โ€” yes it says "User Commands" up top, that's the section, we move ๐Ÿ’…


โœจ NAME โœจ

llvm-mc โ€” the manual page for llvm-mc 12 ๐ŸŽ€


๐ŸŒˆ DESCRIPTION ๐ŸŒˆ

OVERVIEW: the LLVM machine code playground ๐Ÿ›โœจ

USAGE:

llvm-mc [options] <input file>

OPTIONS: (there are a LOT, buckle up bestie, this is the whole menu) ๐Ÿ“


๐ŸŽจ Color Options ๐ŸŽจ

  • --color โ€” use colors in the output, obviously, we're not animals ๐Ÿ’… (default is autodetect, so it figures out the vibe itself)

โš™๏ธ General options โš™๏ธ

  • -I=<directory> โ€” directory where include files live ๐Ÿ“
  • --aarch64-neon-syntax=<value> โ€” pick which style of NEON code the AArch64 backend should emit:
    • =generic โ€” emit generic NEON assembly
    • =apple โ€” emit Apple-style NEON assembly ๐ŸŽ
  • --abort-on-max-devirt-iterations-reached โ€” bail out (abort) once the max iterations for the devirtualization CGSCC repeat pass has been hit ๐Ÿ’€
  • --amdgpu-bypass-slow-div โ€” skip the 64-bit divide for dynamic 32-bit values
  • --amdgpu-disable-loop-alignment โ€” don't align and prefetch loops, just leave them be ๐Ÿ™ˆ
  • --amdgpu-disable-power-sched โ€” turn off scheduling that exists to minimize mAI power bursts
  • --amdgpu-dpp-combine โ€” turn on the DPP combiner
  • --amdgpu-dump-hsa-metadata โ€” dump the AMDGPU HSA metadata
  • --amdgpu-enable-flat-scratch โ€” use flat scratch instructions
  • --amdgpu-enable-merge-m0 โ€” merge and hoist M0 initializations
  • --amdgpu-promote-alloca-to-vector-limit=<uint> โ€” the maximum byte size to even consider for promote alloca to vector
  • --amdgpu-reserve-vgpr-for-sgpr-spill โ€” allocates one VGPR for a future SGPR spill
  • --amdgpu-sdwa-peephole โ€” turn on the SDWA peepholer ๐Ÿ‘€
  • --amdgpu-use-aa-in-codegen โ€” enable using AA during codegen
  • --amdgpu-verify-hsa-metadata โ€” verify the AMDGPU HSA metadata
  • --amdgpu-vgpr-index-mode โ€” use GPR indexing mode instead of movrel for vector indexing
  • --arch=<string> โ€” the target arch to assemble for, and yes you can check -version to see which targets are actually available ๐ŸŽฏ
  • --arm-add-build-attributes โ€” (no description in the source at all, it's giving mystery ๐Ÿ•ต๏ธโ™€๏ธ)
  • --arm-implicit-it=<value> โ€” allow conditional instructions outside of an IT block:
    • =always โ€” accept in both ISAs, emit implicit ITs in Thumb
    • =never โ€” warn in ARM, reject in Thumb
    • =arm โ€” accept in ARM, reject in Thumb
    • =thumb โ€” warn in ARM, emit implicit ITs in Thumb
  • --asm-show-inst โ€” emit the internal instruction representation into the assembly file ๐Ÿซถ

๐ŸŽฌ Action to perform:

  • --as-lex โ€” lex tokens from a .s file
  • --assemble โ€” assemble a .s file (this is the default, bestie, the main character ๐Ÿ‘‘)
  • --disassemble โ€” disassemble strings of hex bytes
  • --mdis โ€” marked-up disassembly of strings of hex bytes โœจ
  • --atomic-counter-update-promoted โ€” do the counter update with atomic fetch add, but only for promoted counters
  • --atomic-first-counter โ€” use atomic fetch add for the first counter in a function (which is usually the entry counter)
  • --bounds-checking-single-trap โ€” use one trap block per function
  • --cfg-hide-deoptimize-paths โ€” (again, no description given, just vibes ๐Ÿฆ‹)
  • --cfg-hide-unreachable-paths โ€” (also undescribed, we simply don't know ๐Ÿ™ˆ)
  • --compress-debug-sections=<value> โ€” choose how DWARF debug sections get compressed:
    • =none โ€” no compression
    • =zlib โ€” use zlib compression
    • =zlib-gnu โ€” use zlib-gnu compression (deprecated, so likeโ€ฆ she's retired ๐Ÿ’€)
  • --cost-kind=<value> โ€” which target cost kind you want:
    • =throughput โ€” reciprocal throughput
    • =latency โ€” instruction latency
    • =code-size โ€” code size
    • =size-latency โ€” code size and latency
  • --cvp-dont-add-nowrap-flags โ€” (no description provided, it's mysterious and that's fine ๐ŸŽ€)
  • --debugify-level=<value> โ€” what kind of debug info to add:
    • =locations โ€” locations only
    • =location+variables โ€” locations and variables
  • --debugify-quiet โ€” suppress the verbose debugify output, shhh ๐Ÿคซ
  • --defsym=<string> โ€” defines a symbol to be an integer constant
  • --disable-promote-alloca-to-lds โ€” disable promote alloca to LDS
  • --disable-promote-alloca-to-vector โ€” disable promote alloca to vector
  • --do-counter-promotion โ€” do counter register promotion
  • --dot-cfg-mssa=<file name for generated dot file> โ€” the file name for the generated dot file
  • --dwarf-version=<int> โ€” the Dwarf version
  • --dwarf64 โ€” generate debugging info in the 64-bit DWARF format
  • --emscripten-cxx-exceptions-allowed=<string> โ€” the list of function names where Emscripten-style exception handling is enabled (peep the emscripten EMSCRIPTEN_CATCHING_ALLOWED options)
  • --enable-cse-in-irtranslator โ€” should enable CSE in irtranslator
  • --enable-cse-in-legalizer โ€” should enable CSE in Legalizer
  • --enable-emscripten-cxx-exceptions โ€” WebAssembly Emscripten-style exception handling
  • --enable-emscripten-sjlj โ€” WebAssembly Emscripten-style setjmp/longjmp handling
  • --enable-gvn-hoist โ€” enable the GVN hoisting pass (default = off)
  • --enable-gvn-memdep โ€” (no description, it's a secret ๐Ÿค)
  • --enable-gvn-sink โ€” enable the GVN sinking pass (default = off)
  • --enable-load-in-loop-pre โ€” (undescribed, love that for us ๐Ÿฆ‹)
  • --enable-load-pre โ€” (also undescribed ๐Ÿ’œ)
  • --enable-loop-simplifycfg-term-folding โ€” (no description here either, the mystery continues โœจ)
  • --enable-name-compression โ€” enable name/filename string compression
  • --enable-split-backedge-in-load-pre โ€” (no description, just a name and a dream ๐ŸŽ€)
  • --fatal-warnings โ€” treat warnings as errors, no mercy periodt ๐Ÿ”ฅ
  • --fdebug-compilation-dir=<string> โ€” specifies the debug info's compilation dir
  • --fdebug-prefix-map=<= separated key-value pairs> โ€” map file source paths in debug info
  • --filetype=<value> โ€” choose an output file type:
    • =asm โ€” emit an assembly (.s) file
    • =null โ€” don't emit anything at all (it's for timing purposes, bestie)
    • =obj โ€” emit a native object (.o) file
  • -g โ€” generate dwarf debugging info for assembly source files ๐Ÿ›
  • --gpsize=<uint> โ€” Global Pointer Addressing Size. The default size is 8.
  • --hash-based-counter-split โ€” rename the counter variable of a comdat function based on cfg hash
  • --hot-cold-split โ€” enable the hot-cold splitting pass
  • --import-all-index โ€” import all external functions in index
  • --incremental-linker-compatible โ€” when used with filetype=obj, emit an object file that can be used with an incremental linker
  • --instcombine-code-sinking โ€” enable code sinking
  • --instcombine-guard-widening-window=<uint> โ€” how wide an instruction window to bypass while looking for another guard
  • --instcombine-max-iterations=<uint> โ€” limit the maximum number of instruction combining iterations
  • --instcombine-max-num-phis=<uint> โ€” the maximum number of phis to handle in intptr/ptrint folding
  • --instcombine-maxarray-size=<uint> โ€” the maximum array size considered when doing a combine
  • --instcombine-negator-enabled โ€” should we attempt to sink negations? ๐Ÿค”
  • --instcombine-negator-max-depth=<uint> โ€” the maximal lookup depth when trying to check whether negation sinking is viable
  • --instcombine-unsafe-select-transform โ€” enable the poison-unsafe select to and/or transform
  • --instrprof-atomic-counter-update-all โ€” make all profile counter updates atomic (for testing only, so don't go shipping that ๐Ÿšจ)
  • --internalize-public-api-file=<filename> โ€” a file containing a list of symbol names to preserve
  • --internalize-public-api-list=<list> โ€” a list of symbol names to preserve
  • --iterative-counter-promotion โ€” allow counter promotion across the whole loop nest
  • --large-code-model โ€” create cfi directives that assume the code might be more than 2gb away
  • --lto-embed-bitcode=<value> โ€” embed LLVM bitcode in object files produced by LTO:
    • =none โ€” do not embed
    • =optimized โ€” embed after all optimization passes
    • =post-merge-pre-opt โ€” embed post merge, but before optimizations
  • --lto-pass-remarks-filter=<regex> โ€” only record optimization remarks from passes whose names match the given regular expression
  • --lto-pass-remarks-format=<format> โ€” the format used for serializing remarks (default: YAML)
  • --lto-pass-remarks-output=<filename> โ€” output filename for pass remarks
  • --main-file-name=<string> โ€” specifies the name we should consider the input file
  • --masm-hexfloats โ€” enable MASM-style hex float initializers (3F800000r)
  • --masm-integers โ€” enable binary and hex masm integers (0b110 and 0ABCh)
  • --matrix-default-layout=<value> โ€” sets the default matrix layout:
    • =column-major โ€” use column-major layout
    • =row-major โ€” use row-major layout
  • --mattr=<a1,+a2,-a3,...> โ€” target specific attributes (run -mattr=help for the details ๐Ÿซถ)
  • --max-counter-promotions=<int> โ€” the max number of allowed counter promotions
  • --max-counter-promotions-per-loop=<uint> โ€” the max number of counter promotions per loop, so you don't blow up register pressure too much

โ€ฆand that's only part 1, bestie, there is MORE coming, stay with me ๐Ÿ’–

  • --mc-relax-all โ€” when you're using it together with filetype=obj, it relaxes all the fixups in the emitted object file. all of them. every last one โœจ
  • --mcpu=<cpu-name> โ€” target a specific cpu type, like, be intentional about it. and if you're nosy about the options, -mcpu=help gives you the details ๐Ÿซ–
  • --merror-missing-parenthesis โ€” errors out when there's a missing parenthesis around predicate registers. no more freestyling, we're checking ๐Ÿ˜ค
  • --merror-noncontigious-register โ€” errors out for register names that aren't contigious. yes, that's the spelling, we're leaving it exactly as it is ๐Ÿ’…
  • --mhvx โ€” enable Hexagon Vector eXtensions ๐Ÿ”ฅ
  • --mhvx=<value> โ€” also enables Hexagon Vector eXtensions, but now you get to choose, main-character style:
    • =v60 โ€” build for HVX v60
    • =v62 โ€” build for HVX v62
    • =v65 โ€” build for HVX v65
    • =v66 โ€” build for HVX v66
    • =v67 โ€” build for HVX v67
  • --mips-compact-branches=<value> โ€” MIPS specific: compact branch policy. pick your era:
    • =never โ€” do not use compact branches if possible.
    • =optimal โ€” use compact branches where appropriate. this is the default, she's the moment ๐Ÿ’–
    • =always โ€” always use compact branches if possible.
  • --mips16-constant-islands โ€” enable mips16 constant islands ๐ŸŒธ
  • --mips16-hard-float โ€” enable mips16 hard float ๐ŸŒธ
  • --mir-strip-debugify-only โ€” should mir-strip-debug only strip debug info from debugified modules by default? that's the question bestie
  • --mno-compound โ€” disable looking for compound instructions for Hexagon
  • --mno-fixup โ€” disable fixing up resolved relocations for Hexagon
  • --mno-ldc1-sdc1 โ€” expand double precision loads and stores into their single precision counterparts
  • --mno-pairing โ€” disable looking for duplex instructions for Hexagon
  • --mwarn-missing-parenthesis โ€” warns (doesn't error, she's gentle) for missing parenthesis around predicate registers
  • --mwarn-noncontigious-register โ€” warns for register names that arent contigious (again: their spelling, not mine, love that for them)
  • --mwarn-sign-mismatch โ€” warns when a signed and unsigned value are mismatched
  • -n โ€” don't assume the assembly file starts in the text section. assumptions? not today
  • --no-deprecated-warn โ€” suppress all deprecated warnings
  • --no-discriminators โ€” disable generation of discriminator information.
  • --no-exec-stack โ€” the file doesn't need an exec stack
  • --no-warn โ€” suppress all warnings. silence, iconic, sometimes a little scary ๐Ÿซฃ
  • --nvptx-sched4reg โ€” NVPTX specific: schedule for register pressue (their typo, we're keeping it, it's part of the lore)
  • -o=<filename> โ€” output filename ๐Ÿ“
  • --output-asm-variant=<uint> โ€” which syntax variant to use for output printing
  • --poison-checking-function-local โ€” check that returns are non-poison. for testing purposes only, bestie, don't get any ideas
  • --position-independent โ€” position independent โœจ
  • --preserve-comments โ€” preserve comments in the outputted assembly. your notes stay, periodt
  • --print-imm-hex โ€” prefer hex format for immediate values
  • --r600-ir-structurize โ€” use the StructurizeCFG IR pass
  • --rdf-dump โ€” no description in the original. mysterious queen behaviour, she says nothing and we respect it ๐Ÿ’€
  • --rdf-limit=<uint> โ€” also no description. same energy
  • --relax-relocations โ€” emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL
  • --runtime-counter-relocation โ€” enable relocating counters at runtime.
  • --safepoint-ir-verifier-print-only โ€” again, no description. silent, powerful, unbothered
  • --sample-profile-check-record-coverage=<N> โ€” emit a warning if less than N% of records in the input profile are matched to the IR.
  • --sample-profile-check-sample-coverage=<N> โ€” emit a warning if less than N% of samples in the input profile are matched to the IR.
  • --sample-profile-max-propagate-iterations=<uint> โ€” maximum number of iterations to go through when propagating sample block/edge weights through the CFG.
  • --save-temp-labels โ€” don't discard temporary labels ๐Ÿ™
  • --show-encoding โ€” show instruction encodings
  • --show-inst โ€” show the internal instruction representation
  • --show-inst-operands โ€” show instruction operands as parsed
  • --skip-ret-exit-block โ€” suppress counter promotion if exit blocks contain ret.
  • --speculative-counter-promotion-max-exiting=<uint> โ€” the max number of exiting blocks of a loop to allow speculative counter promotion
  • --speculative-counter-promotion-to-loop โ€” when this option is false, if the target block is in a loop, the promotion will be disallowed unless the promoted counter update can be further/iteratively promoted into an acyclic region.
  • --split-dwarf-file=<filename> โ€” DWO output filename
  • --summary-file=<string> โ€” the summary file to use for function importing.
  • --tail-predication=<value> โ€” MVE tail-predication pass options. the menu:
    • =disabled โ€” don't tail-predicate loops
    • =enabled-no-reductions โ€” enable tail-predication, but not for reduction loops
    • =enabled โ€” enable tail-predication, including reduction loops
    • =force-enabled-no-reductions โ€” enable tail-predication, but not for reduction loops, and force this which might be unsafe โš ๏ธ
    • =force-enabled โ€” enable tail-predication, including reduction loops, and force this which might be unsafe โš ๏ธ
  • --thinlto-assume-merged โ€” assume the input has already undergone ThinLTO function importing and the other pre-optimization pipeline changes.
  • --threads=<int> โ€” no description given. she's booked and busy, no time to explain ๐Ÿ’…
  • --triple=<string> โ€” target triple to assemble for; peep -version for the available targets
  • --verify-region-info โ€” verify region info. heads up: it's time consuming โณ
  • --vp-counters-per-site=<number> โ€” the average number of profile counters allocated per value profiling site.
  • --vp-static-alloc โ€” do static counter allocation for the value profiler
  • --x86-align-branch=<string> โ€” specify which types of branches to align. it's a plus-separated list of types, and the types are:
    • jcc โ€” indicates conditional jumps
    • fused โ€” indicates fused conditional jumps
    • jmp โ€” indicates direct unconditional jumps
    • call โ€” indicates direct and indirect calls
    • ret โ€” indicates rets
    • indirect โ€” indicates indirect unconditional jumps
  • --x86-align-branch-boundary=<uint> โ€” controls how the assembler should align branches with NOP. if the boundary's size is not 0, it should be a power of 2 and no less than 32. branches get aligned so they don't end up across or against the boundary of that specified size. the default value 0 does not align branches.
  • --x86-branches-within-32B-boundaries โ€” align selected instructions to mitigate the negative performance impact of Intel's micro code update for errata skx102.
โš ๏ธ this one may break assumptions about labels corresponding to particular instructions, and it should be used with caution. bestie, read that twice.
  • --x86-pad-max-prefix-size=<uint> โ€” maximum number of prefixes to use for padding

โœจ Generic Options โœจ

  • --help โ€” display the available options (--help-hidden for more) ๐Ÿ‘‘
  • --help-list โ€” display the list of available options (--help-list-hidden for more) ๐Ÿ‘‘
  • --version โ€” display the version of this program

๐Ÿฆ‹ Polly Options ๐Ÿฆ‹ โ€” Configure the polly loop optimizer

  • --polly โ€” enable the polly optimizer. note that it only kicks in at -O3 โœจ
  • --polly-2nd-level-tiling โ€” enable a 2nd level loop of loop tiling
  • --polly-ast-print-accesses โ€” print memory access functions
  • --polly-context=<isl parameter set> โ€” provide additional constraints on the context parameters
  • --polly-dce-precise-steps=<int> โ€” the number of precise steps between two approximating iterations. (a value of -1 schedules another approximation stage before the actual dead code elimination. โ€” yes, that parenthesis never closes in the original, we're leaving it exactly as shipped ๐Ÿ™ˆ
  • --polly-delicm-max-ops=<int> โ€” maximum number of isl operations to invest for lifetime analysis; 0=no limit
  • --polly-detect-full-functions โ€” allow the detection of full functions
  • --polly-dump-after โ€” dump the module after Polly transformations into a file suffixed with "-after"
  • --polly-dump-after-file=<string> โ€” dump the module after Polly transformations to the given file
  • --polly-dump-before โ€” dump the module before Polly transformations into a file suffixed with "-before"
  • --polly-dump-before-file=<string> โ€” dump the module before Polly transformations to the given file
  • --polly-enable-simplify โ€” simplify SCoP after optimizations
  • --polly-ignore-func=<string> โ€” ignore functions that match a regex. multiple regexes can be comma separated. Scop detection will ignore all functions that match ANY of the regexes provided.
  • --polly-isl-arg=<argument> โ€” option passed to ISL
  • --polly-on-isl-error-abort โ€” abort if an isl error is encountered ๐Ÿ’€
  • --polly-only-func=<string> โ€” only run on functions that match a regex. multiple regexes can be comma separated. Scop detection will run on all functions that match ANY of the regexes provided.
  • --polly-only-region=<identifier> โ€” only run on certain regions, bestie. Heads up tho: that identifier you pass must appear in the name of the region's entry block, or it's simply not gonna find its people. ๐Ÿซถ
  • --polly-only-scop-detection โ€” run scop detection and that's it. No other optimizations, none, zero, nada. Just the detection era. ๐Ÿ”
  • --polly-optimized-scops โ€” Polly dumps the polyhedral description of Scops that got optimized with the isl scheduling optimizer, and the set of post-scheduling transformations is applied on the schedule tree. It's giving very "show me the receipts". ๐Ÿ“œ
  • --polly-parallel โ€” generate thread parallel code. (isl codegen only, so keep that in mind ๐Ÿ‘€)
  • --polly-parallel-force โ€” force generation of thread parallel code, ignoring any cost model whatsoever. No thoughts, no cost model, just parallel. ๐Ÿ˜ค
  • --polly-pattern-matching-based-opts โ€” perform optimizations based on pattern matching. โœจ
  • --polly-process-unprofitable โ€” process scops that are unlikely to benefit from Polly optimizations. Yes, even the ones that probably won't slay. Equal opportunity optimization. ๐Ÿ’–
  • --polly-register-tiling โ€” enable register tiling. ๐ŸŽ€
  • --polly-report โ€” print information about the activities of Polly. It's basically Polly's storytime. ๐Ÿ“ข
  • --polly-show โ€” highlight the code regions that will be optimized in a (CFG BBs and LLVM-IR instructions). ๐ŸŒˆ
  • --polly-show-only โ€” highlight the code regions that will be optimized in a (CFG only BBs). ๐ŸŒธ
  • --polly-stmt-granularity=<value> โ€” the algorithm to use for splitting basic blocks into multiple statements. Pick your fighter:
    • =bb โ€” one statement per basic block. ๐Ÿงฑ
    • =scalar-indep โ€” the scalar independence heuristic. ๐Ÿงฎ
    • =store โ€” store-level granularity. ๐Ÿ›’
  • --polly-target=<value> โ€” the hardware to target. Your pick:
    • =cpu โ€” generate CPU code. ๐Ÿ’ป
  • --polly-tiling โ€” enable loop tiling. ๐Ÿ”ฒ
  • --polly-vectorizer=<value> โ€” select the vectorization strategy. The lineup:
    • =none โ€” no Vectorization. Rest era. ๐Ÿ˜ด
    • =polly โ€” Polly internal vectorizer. ๐Ÿ‘‘
    • =stripmine โ€” strip-mine outer loops so the loop-vectorizer triggers. โ›๏ธ

And that's the whole page, fr fr. This masterpiece is from llvm-mc 12, dated February 2022, and it lives on the LLVM-MC(1) man page. Periodt. ๐Ÿ’…โœจ
๐Ÿ“ฆ where this page comes from