xref: /openbsd/gnu/llvm/llvm/docs/CommandGuide/llc.rst (revision 097a140d)
1llc - LLVM static compiler
2==========================
3
4.. program:: llc
5
6SYNOPSIS
7--------
8
9:program:`llc` [*options*] [*filename*]
10
11DESCRIPTION
12-----------
13
14The :program:`llc` command compiles LLVM source inputs into assembly language
15for a specified architecture.  The assembly language output can then be passed
16through a native assembler and linker to generate a native executable.
17
18The choice of architecture for the output assembly code is automatically
19determined from the input file, unless the :option:`-march` option is used to
20override the default.
21
22OPTIONS
23-------
24
25If ``filename`` is "``-``" or omitted, :program:`llc` reads from standard input.
26Otherwise, it will from ``filename``.  Inputs can be in either the LLVM assembly
27language format (``.ll``) or the LLVM bitcode format (``.bc``).
28
29If the :option:`-o` option is omitted, then :program:`llc` will send its output
30to standard output if the input is from standard input.  If the :option:`-o`
31option specifies "``-``", then the output will also be sent to standard output.
32
33If no :option:`-o` option is specified and an input file other than "``-``" is
34specified, then :program:`llc` creates the output filename by taking the input
35filename, removing any existing ``.bc`` extension, and adding a ``.s`` suffix.
36
37Other :program:`llc` options are described below.
38
39End-user Options
40~~~~~~~~~~~~~~~~
41
42.. option:: -help
43
44 Print a summary of command line options.
45
46.. option:: -o <filename>
47
48 Use ``<filename>`` as the output filename. See the summary above for more
49 details.
50
51.. option:: -O=uint
52
53 Generate code at different optimization levels.  These correspond to the
54 ``-O0``, ``-O1``, ``-O2``, and ``-O3`` optimization levels used by
55 :program:`clang`.
56
57.. option:: -mtriple=<target triple>
58
59 Override the target triple specified in the input file with the specified
60 string.
61
62.. option:: -march=<arch>
63
64 Specify the architecture for which to generate assembly, overriding the target
65 encoded in the input file.  See the output of ``llc -help`` for a list of
66 valid architectures.  By default this is inferred from the target triple or
67 autodetected to the current architecture.
68
69.. option:: -mcpu=<cpuname>
70
71 Specify a specific chip in the current architecture to generate code for.
72 By default this is inferred from the target triple and autodetected to
73 the current architecture.  For a list of available CPUs, use:
74
75 .. code-block:: none
76
77   llvm-as < /dev/null | llc -march=xyz -mcpu=help
78
79.. option:: -filetype=<output file type>
80
81 Specify what kind of output ``llc`` should generated.  Options are: ``asm``
82 for textual assembly ( ``'.s'``), ``obj`` for native object files (``'.o'``)
83 and ``null`` for not emitting anything (for performance testing).
84
85 Note that not all targets support all options.
86
87.. option:: -mattr=a1,+a2,-a3,...
88
89 Override or control specific attributes of the target, such as whether SIMD
90 operations are enabled or not.  The default set of attributes is set by the
91 current CPU.  For a list of available attributes, use:
92
93 .. code-block:: none
94
95   llvm-as < /dev/null | llc -march=xyz -mattr=help
96
97.. option:: --frame-pointer
98
99 Specify effect of frame pointer elimination optimization (all,non-leaf,none).
100
101.. option:: --disable-excess-fp-precision
102
103 Disable optimizations that may produce excess precision for floating point.
104 Note that this option can dramatically slow down code on some systems
105 (e.g. X86).
106
107.. option:: --enable-no-infs-fp-math
108
109 Enable optimizations that assume no Inf values.
110
111.. option:: --enable-no-nans-fp-math
112
113 Enable optimizations that assume no NAN values.
114
115.. option:: --enable-no-signed-zeros-fp-math
116
117 Enable FP math optimizations that assume the sign of 0 is insignificant.
118
119.. option:: --enable-no-trapping-fp-math
120
121 Enable setting the FP exceptions build attribute not to use exceptions.
122
123.. option:: --enable-unsafe-fp-math
124
125 Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
126 addition is associative) or may not work for all input ranges.  These
127 optimizations allow the code generator to make use of some instructions which
128 would otherwise not be usable (such as ``fsin`` on X86).
129
130.. option:: --stats
131
132 Print statistics recorded by code-generation passes.
133
134.. option:: --time-passes
135
136 Record the amount of time needed for each pass and print a report to standard
137 error.
138
139.. option:: --load=<dso_path>
140
141 Dynamically load ``dso_path`` (a path to a dynamically shared object) that
142 implements an LLVM target.  This will permit the target name to be used with
143 the :option:`-march` option so that code can be generated for that target.
144
145.. option:: -meabi=[default|gnu|4|5]
146
147 Specify which EABI version should conform to.  Valid EABI versions are *gnu*,
148 *4* and *5*.  Default value (*default*) depends on the triple.
149
150.. option:: -stack-size-section
151
152 Emit the .stack_sizes section which contains stack size metadata. The section
153 contains an array of pairs of function symbol values (pointer size) and stack
154 sizes (unsigned LEB128). The stack size values only include the space allocated
155 in the function prologue. Functions with dynamic stack allocations are not
156 included.
157
158.. option:: -remarks-section
159
160 Emit the __remarks (MachO) section which contains metadata about remark
161 diagnostics.
162
163Tuning/Configuration Options
164~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165
166.. option:: --print-machineinstrs
167
168 Print generated machine code between compilation phases (useful for debugging).
169
170.. option:: --regalloc=<allocator>
171
172 Specify the register allocator to use.
173 Valid register allocators are:
174
175 *basic*
176
177  Basic register allocator.
178
179 *fast*
180
181  Fast register allocator. It is the default for unoptimized code.
182
183 *greedy*
184
185  Greedy register allocator. It is the default for optimized code.
186
187 *pbqp*
188
189  Register allocator based on 'Partitioned Boolean Quadratic Programming'.
190
191.. option:: --spiller=<spiller>
192
193 Specify the spiller to use for register allocators that support it.  Currently
194 this option is used only by the linear scan register allocator.  The default
195 ``spiller`` is *local*.  Valid spillers are:
196
197 *simple*
198
199  Simple spiller
200
201 *local*
202
203  Local spiller
204
205Intel IA-32-specific Options
206~~~~~~~~~~~~~~~~~~~~~~~~~~~~
207
208.. option:: --x86-asm-syntax=[att|intel]
209
210 Specify whether to emit assembly code in AT&T syntax (the default) or Intel
211 syntax.
212
213EXIT STATUS
214-----------
215
216If :program:`llc` succeeds, it will exit with 0.  Otherwise, if an error
217occurs, it will exit with a non-zero value.
218
219SEE ALSO
220--------
221
222:manpage:`lli(1)`
223