blob: 70354b0343e5b86df3b64f38194c4ee97ebdc6df [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
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000072.. option:: -mattr=a1,+a2,-a3,...
Daniel Dunbar3b709d52012-05-08 16:50:35 +000073
74 Override or control specific attributes of the target, such as whether SIMD
75 operations are enabled or not. The default set of attributes is set by the
76 current CPU. For a list of available attributes, use:
Daniel Dunbar3b709d52012-05-08 16:50:35 +000077
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000078 .. code-block:: none
Daniel Dunbar3b709d52012-05-08 16:50:35 +000079
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000080 llvm-as < /dev/null | llc -march=xyz -mattr=help
Daniel Dunbar3b709d52012-05-08 16:50:35 +000081
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000082.. option:: --disable-fp-elim
Daniel Dunbar3b709d52012-05-08 16:50:35 +000083
84 Disable frame pointer elimination optimization.
85
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000086.. option:: --disable-excess-fp-precision
Daniel Dunbar3b709d52012-05-08 16:50:35 +000087
88 Disable optimizations that may produce excess precision for floating point.
89 Note that this option can dramatically slow down code on some systems
90 (e.g. X86).
91
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000092.. option:: --enable-no-infs-fp-math
Daniel Dunbar3b709d52012-05-08 16:50:35 +000093
94 Enable optimizations that assume no Inf values.
95
Dmitri Gribenkodff966c2012-11-29 18:16:11 +000096.. option:: --enable-no-nans-fp-math
Daniel Dunbar3b709d52012-05-08 16:50:35 +000097
98 Enable optimizations that assume no NAN values.
99
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000100.. option:: --enable-unsafe-fp-math
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000101
102 Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
103 addition is associative) or may not work for all input ranges. These
104 optimizations allow the code generator to make use of some instructions which
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000105 would otherwise not be usable (such as ``fsin`` on X86).
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000106
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000107.. option:: --enable-correct-eh-support
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000108
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000109 Instruct the **lowerinvoke** pass to insert code for correct exception
110 handling support. This is expensive and is by default omitted for efficiency.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000111
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000112.. option:: --stats
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000113
114 Print statistics recorded by code-generation passes.
115
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000116.. option:: --time-passes
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000117
118 Record the amount of time needed for each pass and print a report to standard
119 error.
120
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000121.. option:: --load=<dso_path>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000122
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000123 Dynamically load ``dso_path`` (a path to a dynamically shared object) that
124 implements an LLVM target. This will permit the target name to be used with
125 the :option:`-march` option so that code can be generated for that target.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000126
127Tuning/Configuration Options
128~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000130.. option:: --print-machineinstrs
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000131
132 Print generated machine code between compilation phases (useful for debugging).
133
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000134.. option:: --regalloc=<allocator>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000135
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000136 Specify the register allocator to use. The default ``allocator`` is *local*.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000137 Valid register allocators are:
138
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000139 *simple*
140
141 Very simple "always spill" register allocator
142
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000143 *local*
144
145 Local register allocator
146
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000147 *linearscan*
148
149 Linear scan global register allocator
150
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000151 *iterativescan*
152
153 Iterative scan global register allocator
154
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000155.. option:: --spiller=<spiller>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000156
157 Specify the spiller to use for register allocators that support it. Currently
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000158 this option is used only by the linear scan register allocator. The default
159 ``spiller`` is *local*. Valid spillers are:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000160
161 *simple*
162
163 Simple spiller
164
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000165 *local*
166
167 Local spiller
168
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000169Intel IA-32-specific Options
170~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000172.. option:: --x86-asm-syntax=[att|intel]
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000173
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000174 Specify whether to emit assembly code in AT&T syntax (the default) or Intel
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000175 syntax.
176
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000177EXIT STATUS
178-----------
179
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000180If :program:`llc` succeeds, it will exit with 0. Otherwise, if an error
181occurs, it will exit with a non-zero value.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000182
183SEE ALSO
184--------
185
Dmitri Gribenkodff966c2012-11-29 18:16:11 +0000186lli
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000187