LLI(1)

πŸ’… LLI(1) β€” the lli page, aka the LLVM manual's main character ✨

okay so bestie, welcome to lli β€” yes that's the LLVM manual page, section 1, and she is literally the whole vibe. sit down, get a snack πŸ“, and let's get into it.


πŸŽ€ NAME πŸŽ€

lli β€” runs programs straight out of LLVM bitcode, no extra steps, no cap πŸ’…


✨ SYNOPSIS ✨

lli [options] [filename] [program args]

πŸ¦‹ DESCRIPTION πŸ¦‹

so lli directly executes programs that are in LLVM bitcode format. like, you hand her a program in LLVM bitcode and she runs it β€” using a just-in-time compiler or an interpreter. she's flexible like that 🫢

and no, she is not an emulator. not even a little bit. she will not execute IR from different architectures, periodt. she can only interpret (or JIT-compile) for the host architecture β€” that's her lane and she stays in it 😌

the JIT compiler takes the same arguments as other tools, like llc, but heads up: those args don't necessarily work for the interpreter. lowkey different beasts, iykyk πŸ’€

if filename isn't specified, then lli reads the LLVM bitcode for the program from standard input. stdin bestie, she'll take it 🌸

and the optional args you put on the command line? those get passed to the program as arguments. handing out lil gifts 🎁


πŸ’œ GENERAL OPTIONS πŸ’œ

  • -fake-argv0=executable β€” overrides the argv[0] value that gets passed into the executing program. lil identity swap moment πŸ™ˆ
  • -force-interpreter={false,true} β€” set it to true and she'll use the interpreter even if a just-in-time compiler is available for this architecture. defaults to false. yes she'll do it the hard way if you ask πŸ’…
  • -help β€” prints a summary of the command line options. the classic.
  • -load=pluginfilename β€” makes lli load the plugin (that's a shared object) named pluginfilename and use it for optimization. plug her in ✨
  • -stats β€” prints statistics from the code-generation passes. ngl this is only meaningful for the just-in-time compiler at present β€” she's honest about it 😭
  • -time-passes β€” records how much time each code-generation pass needed and prints it to standard error. clocking the girlypops ⏱️
  • -version β€” prints out the version of lli and exits without doing anything else. she said bye then left πŸ‘‘

πŸ”₯ TARGET OPTIONS πŸ”₯

  • -mtriple=target triple β€” overrides the target triple baked into the input bitcode file with the string you give her. ⚠️ careful bestie, this may result in a crash if you pick an architecture that isn't compatible with the current system. don't do her like that πŸ’€
  • -march=arch β€” specifies the architecture to generate assembly for, overriding the target encoded in the bitcode file. for a list of valid architectures, go see the output of llc -help. by default this is inferred from the target triple, or autodetected to the current architecture.
  • -mcpu=cpuname β€” specifies a specific chip in the current architecture to generate code for. by default this is inferred from the target triple and autodetected to the current architecture. for a list of available CPUs, use:
llvm-as < /dev/null | llc -march=xyz -mcpu=help
  • -mattr=a1,+a2,-a3,... β€” overrides or controls specific attributes of the target β€” stuff like whether SIMD operations are enabled or not. the default set of attributes is set by the current CPU. for a list of available attributes, use:
llvm-as < /dev/null | llc -march=xyz -mattr=help

🧚 FLOATING POINT OPTIONS 🧚

  • -disable-excess-fp-precision β€” disables optimizations that may increase floating point precision.
  • -enable-no-infs-fp-math β€” enables optimizations that assume no Inf values.
  • -enable-no-nans-fp-math β€” enables optimizations that assume no NAN values.
  • -enable-unsafe-fp-math β€” causes lli to enable optimizations that may decrease floating point precision. unsafe, she said it, not me 🫣
  • -soft-float β€” causes lli to generate software floating point library calls instead of the equivalent hardware instructions. doing it the soft way πŸ’…

⭐ CODE GENERATION OPTIONS ⭐

  • -code-model=model β€” picks the code model from these:
    • default: Target default code model
    • tiny: Tiny code model
    • small: Small code model
    • kernel: Kernel code model
    • medium: Medium code model
    • large: Large code model
  • -disable-post-RA-scheduler β€” disables scheduling after register allocation.
  • -disable-spill-fusing β€” disables fusing of spill code into instructions.
  • -jit-enable-eh β€” exception handling should be enabled in the just-in-time compiler.
  • -join-liveintervals β€” coalesce copies (default=true). she's a joiner 🫢
  • -nozero-initialized-in-bss β€” don't place zero-initialized symbols into the BSS section. nope, not there βœ‹
  • -pre-RA-sched=scheduler β€” the instruction schedulers available (before register allocation):
    • =default: Best scheduler for the target
    • =none: No scheduling: breadth first sequencing
    • =simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
    • =simple-noitin: Simple two pass scheduling: Same as simple except using generic latency
    • =list-burr: Bottom-up register reduction list scheduling
    • =list-tdrr: Top-down register reduction list scheduling
    • =list-td: Top-down list scheduler
  • -regalloc=allocator β€” the register allocator to use (default=linearscan):
    • =bigblock: Big-block register allocator
    • =linearscan: linear scan register allocator
    • =local: local register allocator
    • =simple: simple register allocator
  • -relocation-model=model β€” picks the relocation model from:
    • =default: Target default relocation model
    • =static: Non-relocatable code
    • =pic: Fully relocatable, position independent code
    • =dynamic-no-pic: Relocatable external references, non-relocatable code
  • -spiller β€” the spiller to use (default=local):
    • =simple: simple spiller
    • =local: local spiller
  • -x86-asm-syntax=syntax β€” picks the style of code emitted from the X86 backend:
    • =att: Emit AT&T-style assembly
    • =intel: Emit Intel-style assembly

πŸ‘‘ EXIT STATUS πŸ‘‘

if lli fails to load the program, she'll exit with an exit code of 1. that's the sad path 😭

otherwise? she returns the exit code of the program she executes. she's just the messenger, fr fr 🫢


🌈 SEE ALSO 🌈

llc(1) β€” go say hi to her sister πŸ’–


🌸 AUTHOR 🌸

maintained by the LLVM Team (https://llvm.org/). iconic, they ate πŸ‘‘


2003-2023, LLVM Project


and that's the whole page bestie!! this was page version 17, dated 2023-12-01 β€” go forth and lli responsibly, mwah πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from