LLC(1)

πŸ“¦ version 15.0.7, in opensuse-leap 16.0

πŸ’… LLC(1) β€” the LLVM static compiler, bestie edition ✨

okay so real talk, this is the manual page for llc, aka the LLVM static compiler β€” and yes she's part of the whole LLVM situation. grab a boba, we're doing this πŸ§‹


🌸 NAME 🌸

llc β€” the LLVM static compiler. that's it, that's the vibe. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

llc [options] [filename]

✨ DESCRIPTION ✨

so what does llc actually do? literally this: it takes LLVM source inputs and compiles them into assembly language for whatever architecture you point it at. then you can take that assembly output, run it through a native assembler and a linker, and boom πŸ’₯ β€” you've got yourself a native executable. main character energy fr.

and how does it pick which architecture to spit out assembly for? it just... knows. it figures it out automatically from the input file ✨ unless you use the -march option to override the default, in which case you're the boss. 🫢


πŸ’– OPTIONS πŸ’–

k so first, the input tea β˜•: if filename is - or it's just straight-up omitted, llc reads from standard input. otherwise it reads from filename. and your inputs can be either the LLVM assembly language format (.ll) or the LLVM bitcode format (.bc). both slay.

now for output: if the -o option is omitted, then llc sends its output to standard output β€” but only if the input is from standard input, ok? and if -o specifies -, then the output also goes to standard output.

and if no -o option is specified and you gave an input file that isn't -, then llc comes up with the output filename itself by taking your input filename, removing any existing .bc extension, and adding a .s suffix. cute little naming convention, no notes. πŸŽ€

other llc options are down below πŸ‘‡

🌈 End-user Options 🌈

  • -help β€” prints a summary of all the command line options. your little map πŸ—ΊοΈ
  • -o <filename> β€” use <filename> as the output filename. peep the summary above for the deets.
  • -O=uint β€” generates code at different optimization levels. these correspond exactly to the -O0, -O1, -O2, and -O3 optimization levels that clang uses. pick your fighter πŸ’…
  • -mtriple=<target triple> β€” overrides the target triple that's specified in the input file with the string you give it. rude but effective.
  • -march=<arch> β€” specifies the architecture to generate assembly for, overriding the target encoded in the input file. for a list of valid architectures, go look at the output of llc -help. by default this gets inferred from the target triple, or autodetected to the current architecture. iykyk πŸ¦‹
  • -mcpu=<cpuname> β€” specifies a specific chip in the current architecture to generate code for. by default it's 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
  • -filetype=<output file type> β€” specifies what kind of output llc should generate. the options are: asm for textual assembly ('.s'), obj for native object files ('.o'), and null for not emitting anything at all (this one's for performance testing). ⚠️ note that not all targets support all options β€” so don't come for me if your target's picky.
  • -mattr=a1,+a2,-a3,... β€” overrides or controls specific attributes of the target, 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
  • --frame-pointer β€” specifies the effect of the frame pointer elimination optimization (all,non-leaf,none). pick one 🫑
  • --disable-excess-fp-precision β€” disables optimizations that may produce excess precision for floating point. but heads up bestie: this option can dramatically slow down code on some systems (e.g. X86). so, like, use with intention πŸ’€
  • --enable-no-infs-fp-math β€” enables optimizations that assume there are no Inf values. living dangerously ✨
  • --enable-no-nans-fp-math β€” enables optimizations that assume there are no NAN values. bold.
  • --enable-no-signed-zeros-fp-math β€” enables FP math optimizations that assume the sign of 0 is insignificant. zero? irrelevant.
  • --enable-no-trapping-fp-math β€” enables setting the FP exceptions build attribute to not use exceptions.
  • --enable-unsafe-fp-math β€” enables optimizations that make unsafe assumptions about IEEE math (e.g. that addition is associative) or that may not work for all input ranges. these optimizations let the code generator use some instructions that would otherwise be unusable (such as fsin on X86). it's giving "i can fix him" but with floats 😭
  • --stats β€” prints statistics recorded by code-generation passes. numbers!! πŸ“Š
  • --time-passes β€” records the amount of time each pass takes and prints a report to standard error. clock it ⏱️
  • --load=<dso_path> β€” dynamically loads dso_path (a path to a dynamically shared object) that implements an LLVM target. this lets you use that target name with the -march option so code can be generated for that target. plug in and slay πŸ”Œ
  • -meabi=[default|gnu|4|5] β€” specifies which EABI version to conform to. valid EABI versions are gnu, 4 and 5. the default value (default) depends on the triple. it's giving "it depends" and honestly same.
  • -stack-size-section β€” emits the .stack_sizes section, which contains stack size metadata. the section contains an array of pairs of function symbol values (pointer size) and stack sizes (unsigned LEB128). the stack size values only include the space allocated in the function prologue β€” functions with dynamic stack allocations are not included. sorry to those functions πŸ’”
  • -remarks-section β€” emits the __remarks (MachO) section, which contains metadata about remark diagnostics. πŸ“

πŸ¦‹ Tuning/Configuration Options πŸ¦‹

  • --print-after-isel β€” prints the generated machine code after instruction selection. super useful for debugging πŸ›
  • --regalloc=<allocator> β€” specifies the register allocator to use. valid register allocators are:
    • basic β€” basic register allocator. does what it says on the tin.
    • fast β€” fast register allocator. it's the default for unoptimized code.
    • greedy β€” greedy register allocator. it's the default for optimized code. greedy but make it fashion πŸ’…
    • pbqp β€” register allocator based on 'Partitioned Boolean Quadratic Programming'. say that five times fast 😭 iconic name ngl
  • --spiller=<spiller> β€” specifies the spiller to use for register allocators that support it. currently this option is used only by the linear scan register allocator. the default spiller is local. valid spillers are:
    • simple β€” simple spiller
    • local β€” local spiller

πŸ’œ Intel IA-32-specific Options πŸ’œ

  • --x86-asm-syntax=[att|intel] β€” specifies whether to emit assembly code in AT&T syntax (the default) or Intel syntax. choose your aesthetic πŸŽ€

πŸ”₯ EXIT STATUS πŸ”₯

if llc succeeds, it exits with 0. πŸŽ‰ otherwise, if an error occurs, it exits with a non-zero value. 😭 that's the whole thing, no hidden lore.


🌈 SEE ALSO 🌈

lli(1) β€” go say hi, she's right there 🫢


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). absolute legends, no cap.


2003-2023, LLVM Project


and that's the whole page bestie πŸ’– this was page 15, dated 2023-01-14, and yeah β€” it's LLC(1) and she ate. periodt. πŸŒΈπŸ¦‹βœ¨

πŸ“¦ where this page comes from