blob: 8d5c9ce8f8a1a62b05f43c755b2cf7a9a5a3076e [file] [log] [blame]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00001llc - LLVM static compiler
2==========================
3
Daniel Dunbar3b709d52012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Dmitri Gribenkodff966c2012-11-29 18:16:11 +00007:program:`llc` [*options*] [*filename*]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00008
9DESCRIPTION
10-----------
11
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000012The :program:`llc` command compiles LLVM source inputs into assembly language
13for a specified architecture. The assembly language output can then be passed
14through a native assembler and linker to generate a native executable.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000015
16The choice of architecture for the output assembly code is automatically
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000017determined from the input file, unless the :option:`-march` option is used to
18override the default.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000019
20OPTIONS
21-------
22
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000023If ``filename`` is "``-``" or omitted, :program:`llc` reads from standard input.
24Otherwise, it will from ``filename``. Inputs can be in either the LLVM assembly
25language format (``.ll``) or the LLVM bitcode format (``.bc``).
Daniel Dunbar3b709d52012-05-08 16:50:35 +000026
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000027If the :option:`-o` option is omitted, then :program:`llc` will send its output
28to standard output if the input is from standard input. If the :option:`-o`
29option specifies "``-``", then the output will also be sent to standard output.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000030
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000031If no :option:`-o` option is specified and an input file other than "``-``" is
32specified, then :program:`llc` creates the output filename by taking the input
33filename, removing any existing ``.bc`` extension, and adding a ``.s`` suffix.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000034
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000035Other :program:`llc` options are described below.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000036
37End-user Options
38~~~~~~~~~~~~~~~~
39
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000040.. option:: -help
Daniel Dunbar3b709d52012-05-08 16:50:35 +000041
42 Print a summary of command line options.
43
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000044.. option:: -O=uint
Daniel Dunbar3b709d52012-05-08 16:50:35 +000045
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000046 Generate code at different optimization levels. These correspond to the
47 ``-O0``, ``-O1``, ``-O2``, and ``-O3`` optimization levels used by
Stephen Hines36b56882014-04-23 16:57:46 -070048 :program:`clang`.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000049
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000050.. option:: -mtriple=<target triple>
Daniel Dunbar3b709d52012-05-08 16:50:35 +000051
52 Override the target triple specified in the input file with the specified
53 string.
54
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000055.. option:: -march=<arch>
Daniel Dunbar3b709d52012-05-08 16:50:35 +000056
57 Specify the architecture for which to generate assembly, overriding the target
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000058 encoded in the input file. See the output of ``llc -help`` for a list of
Daniel Dunbar3b709d52012-05-08 16:50:35 +000059 valid architectures. By default this is inferred from the target triple or
60 autodetected to the current architecture.
61
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000062.. option:: -mcpu=<cpuname>
Daniel Dunbar3b709d52012-05-08 16:50:35 +000063
64 Specify a specific chip in the current architecture to generate code for.
65 By default this is inferred from the target triple and autodetected to
66 the current architecture. For a list of available CPUs, use:
Daniel Dunbar3b709d52012-05-08 16:50:35 +000067
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000068 .. code-block:: none
Daniel Dunbar3b709d52012-05-08 16:50:35 +000069
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000070 llvm-as < /dev/null | llc -march=xyz -mcpu=help
Daniel Dunbar3b709d52012-05-08 16:50:35 +000071
Eli Bendersky72590d52013-04-22 17:16:35 +000072.. option:: -filetype=<output file type>
73
74 Specify what kind of output ``llc`` should generated. Options are: ``asm``
75 for textual assembly ( ``'.s'``), ``obj`` for native object files (``'.o'``)
76 and ``null`` for not emitting anything (for performance testing).
77
78 Note that not all targets support all options.
79
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000080.. option:: -mattr=a1,+a2,-a3,...
Daniel Dunbar3b709d52012-05-08 16:50:35 +000081
82 Override or control specific attributes of the target, such as whether SIMD
83 operations are enabled or not. The default set of attributes is set by the
84 current CPU. For a list of available attributes, use:
Daniel Dunbar3b709d52012-05-08 16:50:35 +000085
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000086 .. code-block:: none
Daniel Dunbar3b709d52012-05-08 16:50:35 +000087
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000088 llvm-as < /dev/null | llc -march=xyz -mattr=help
Daniel Dunbar3b709d52012-05-08 16:50:35 +000089
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000090.. option:: --disable-fp-elim
Daniel Dunbar3b709d52012-05-08 16:50:35 +000091
92 Disable frame pointer elimination optimization.
93
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000094.. option:: --disable-excess-fp-precision
Daniel Dunbar3b709d52012-05-08 16:50:35 +000095
96 Disable optimizations that may produce excess precision for floating point.
97 Note that this option can dramatically slow down code on some systems
98 (e.g. X86).
99
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000100.. option:: --enable-no-infs-fp-math
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000101
102 Enable optimizations that assume no Inf values.
103
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000104.. option:: --enable-no-nans-fp-math
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000105
106 Enable optimizations that assume no NAN values.
107
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000108.. option:: --enable-unsafe-fp-math
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000109
110 Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
111 addition is associative) or may not work for all input ranges. These
112 optimizations allow the code generator to make use of some instructions which
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000113 would otherwise not be usable (such as ``fsin`` on X86).
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000114
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000115.. option:: --stats
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000116
117 Print statistics recorded by code-generation passes.
118
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000119.. option:: --time-passes
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000120
121 Record the amount of time needed for each pass and print a report to standard
122 error.
123
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000124.. option:: --load=<dso_path>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000125
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000126 Dynamically load ``dso_path`` (a path to a dynamically shared object) that
127 implements an LLVM target. This will permit the target name to be used with
128 the :option:`-march` option so that code can be generated for that target.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000129
130Tuning/Configuration Options
131~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000133.. option:: --print-machineinstrs
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000134
135 Print generated machine code between compilation phases (useful for debugging).
136
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000137.. option:: --regalloc=<allocator>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000138
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000139 Specify the register allocator to use.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000140 Valid register allocators are:
141
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000142 *basic*
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000143
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000144 Basic register allocator.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000145
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000146 *fast*
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000147
Bill Wendling51b6fb42013-08-05 23:29:16 +0000148 Fast register allocator. It is the default for unoptimized code.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000149
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000150 *greedy*
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000151
Bill Wendling51b6fb42013-08-05 23:29:16 +0000152 Greedy register allocator. It is the default for optimized code.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000153
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000154 *pbqp*
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000155
Jakob Stoklund Olesenf32ec172013-07-24 17:45:11 +0000156 Register allocator based on 'Partitioned Boolean Quadratic Programming'.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000157
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000158.. option:: --spiller=<spiller>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000159
160 Specify the spiller to use for register allocators that support it. Currently
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000161 this option is used only by the linear scan register allocator. The default
162 ``spiller`` is *local*. Valid spillers are:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000163
164 *simple*
165
166 Simple spiller
167
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000168 *local*
169
170 Local spiller
171
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000172Intel IA-32-specific Options
173~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000175.. option:: --x86-asm-syntax=[att|intel]
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000176
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000177 Specify whether to emit assembly code in AT&T syntax (the default) or Intel
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000178 syntax.
179
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000180EXIT STATUS
181-----------
182
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000183If :program:`llc` succeeds, it will exit with 0. Otherwise, if an error
184occurs, it will exit with a non-zero value.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000185
186SEE ALSO
187--------
188
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000189lli
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000190