blob: e6a59767aaff91d4c56f8a875b1ba54aba597937 [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
48 :program:`llvm-gcc` and :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:: --enable-correct-eh-support
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000116
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000117 Instruct the **lowerinvoke** pass to insert code for correct exception
118 handling support. This is expensive and is by default omitted for efficiency.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000119
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000120.. option:: --stats
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000121
122 Print statistics recorded by code-generation passes.
123
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000124.. option:: --time-passes
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000125
126 Record the amount of time needed for each pass and print a report to standard
127 error.
128
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000129.. option:: --load=<dso_path>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000130
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000131 Dynamically load ``dso_path`` (a path to a dynamically shared object) that
132 implements an LLVM target. This will permit the target name to be used with
133 the :option:`-march` option so that code can be generated for that target.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000134
135Tuning/Configuration Options
136~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000138.. option:: --print-machineinstrs
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000139
140 Print generated machine code between compilation phases (useful for debugging).
141
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000142.. option:: --regalloc=<allocator>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000143
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000144 Specify the register allocator to use. The default ``allocator`` is *local*.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000145 Valid register allocators are:
146
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000147 *simple*
148
149 Very simple "always spill" register allocator
150
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000151 *local*
152
153 Local register allocator
154
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000155 *linearscan*
156
157 Linear scan global register allocator
158
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000159 *iterativescan*
160
161 Iterative scan global register allocator
162
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000163.. option:: --spiller=<spiller>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000164
165 Specify the spiller to use for register allocators that support it. Currently
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000166 this option is used only by the linear scan register allocator. The default
167 ``spiller`` is *local*. Valid spillers are:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000168
169 *simple*
170
171 Simple spiller
172
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000173 *local*
174
175 Local spiller
176
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000177Intel IA-32-specific Options
178~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000180.. option:: --x86-asm-syntax=[att|intel]
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000181
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000182 Specify whether to emit assembly code in AT&T syntax (the default) or Intel
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000183 syntax.
184
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000185EXIT STATUS
186-----------
187
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000188If :program:`llc` succeeds, it will exit with 0. Otherwise, if an error
189occurs, it will exit with a non-zero value.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000190
191SEE ALSO
192--------
193
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000194lli
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000195