LLC(1)

πŸ“¦
version 13.0.1 Β· 5 versions
, in ubuntu jammy

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

ok so this is the llc page from the LLVM manual (section 1 of the man pages, iykyk) and honestly she's kind of a big deal. let's get into it 🫢


✨ NAME ✨

llc β€” the LLVM static compiler. that's her. that's the whole name. iconic behavior.


🌸 SYNOPSIS 🌸

llc [options] [filename]

short, sweet, slays.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: llc takes your LLVM source input and compiles it into assembly language for whatever architecture you point it at. then you can hand that assembly off to a native assembler and linker and boom πŸ’₯ you've got yourself a native executable. literally the pipeline of all time.

and the architecture? she's not gonna make you spell it out β€” the choice of architecture for the output assembly code is automatically determined from the input file, unless you use the -march option to override the default. main character energy fr.


πŸŽ€ OPTIONS πŸŽ€

kay so first, the house rules about input. if filename is - or just... not there at all, llc reads from standard input. otherwise it reads from filename. and your inputs can be either in the LLVM assembly language format (.ll) or the LLVM bitcode format (.bc) β€” both are valid, no favorites here πŸ’–

now, output. if the -o option is omitted, then llc sends its output to standard output if the input is from standard input. and if -o specifies -, then the output goes to standard output too. same energy.

but listen β€” if no -o option is specified AND you gave it an input file other than -, then llc creates the output filename by taking the input filename, removing any existing .bc extension, and adding a .s suffix. cute little automatic naming moment ✨

all the other llc options are down below, let's go.

πŸ’œ End-user Options πŸ’œ

  • -help β€” prints a summary of the command line options. your little map when you're lost, we love her.
  • -o <filename> β€” use <filename> as the output filename. see the summary above for more deets (yes, the .s thing, go scroll up bestie).
  • -O=uint β€” generate code at different optimization levels. these correspond to the -O0, -O1, -O2, and -O3 optimization levels used by clang. pick your fighter 🌈
  • -mtriple=<target triple> β€” override the target triple specified in the input file with the specified string. you're in charge now πŸ‘‘
  • -march=<arch> β€” specify the architecture to generate assembly for, overriding the target encoded in the input file. see the output of llc -help for a list of valid architectures. by default this is inferred from the target triple or autodetected to the current architecture.
  • -mcpu=<cpuname> β€” specify 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
  • -filetype=<output file type> β€” specify what kind of output llc should generate. options are: asm for textual assembly ('.s'), obj for native object files ('.o') and null for not emitting anything (for performance testing). note that not all targets support all options β€” so don't come for her if your target's picky πŸ™ˆ
  • -mattr=a1,+a2,-a3,... β€” override or control 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 β€” specify the effect of the frame pointer elimination optimization (all, non-leaf, none).
  • --disable-excess-fp-precision β€” disable optimizations that may produce excess precision for floating point. ⚠️ heads up: this option can dramatically slow down code on some systems (e.g. X86). like, dramatically dramatically πŸ’€
  • --enable-no-infs-fp-math β€” enable optimizations that assume no Inf values.
  • --enable-no-nans-fp-math β€” enable optimizations that assume no NAN values.
  • --enable-no-signed-zeros-fp-math β€” enable FP math optimizations that assume the sign of 0 is insignificant.
  • --enable-no-trapping-fp-math β€” enable setting the FP exceptions build attribute not to use exceptions.
  • --enable-unsafe-fp-math β€” enable optimizations that make unsafe assumptions about IEEE math (e.g. that addition is associative) or may not work for all input ranges. these optimizations allow the code generator to make use of some instructions which would otherwise not be usable (such as fsin on X86). unsafe is literally in the name bestie, proceed with vibes and caution 🌸
  • --stats β€” print statistics recorded by code-generation passes.
  • --time-passes β€” record the amount of time needed for each pass and print a report to standard error.
  • --load=<dso_path> β€” dynamically load dso_path (a path to a dynamically shared object) that implements an LLVM target. this permits the target name to be used with the -march option so that code can be generated for that target. plug-in era πŸ”Œ
  • -meabi=[default|gnu|4|5] β€” specify which EABI version to conform to. valid EABI versions are gnu, 4 and 5. the default value (default) depends on the triple.
  • -stack-size-section β€” emit 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 dynamic girlies 😭
  • -remarks-section β€” emit the __remarks (MachO) section which contains metadata about remark diagnostics.

⭐ Tuning/Configuration Options ⭐

  • --print-after-isel β€” print generated machine code after instruction selection (useful for debugging). peek behind the curtain 🧚
  • --regalloc=<allocator> β€” specify the register allocator to use. valid register allocators are:
    • basic β€” basic register allocator.
    • fast β€” fast register allocator. it is the default for unoptimized code.
    • greedy β€” greedy register allocator. it is the default for optimized code.
    • pbqp β€” register allocator based on β€˜Partitioned Boolean Quadratic Programming’. yes that's a real name, no i can't pronounce it either πŸ’€
  • --spiller=<spiller> β€” specify 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] β€” specify whether to emit assembly code in AT&T syntax (the default) or Intel syntax. choose your syntax, choose your destiny ⭐

πŸ“ EXIT STATUS πŸ“

if llc succeeds, she exits with 0. 😌 otherwise, if an error occurs, she exits with a non-zero value. πŸ’€


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). the whole squad. 🫢


2003-2023, LLVM Project


okay that's the whole page, you're officially an llc girlie now πŸ’… this was page 13 of the manual, dated 2023-07-14 β€” go forth and compile something iconic bestie, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from