ReST-ify some markup in the LIT document
[oota-llvm.git] / docs / CommandGuide / llc.rst
1 llc - LLVM static compiler
2 ==========================
3
4
5 SYNOPSIS
6 --------
7
8
9 **llc** [*options*] [*filename*]
10
11
12 DESCRIPTION
13 -----------
14
15
16 The **llc** command compiles LLVM source inputs into assembly language for a
17 specified architecture.  The assembly language output can then be passed through
18 a native assembler and linker to generate a native executable.
19
20 The choice of architecture for the output assembly code is automatically
21 determined from the input file, unless the **-march** option is used to override
22 the default.
23
24
25 OPTIONS
26 -------
27
28
29 If *filename* is - or omitted, **llc** reads from standard input.  Otherwise, it
30 will from *filename*.  Inputs can be in either the LLVM assembly language
31 format (.ll) or the LLVM bitcode format (.bc).
32
33 If the **-o** option is omitted, then **llc** will send its output to standard
34 output if the input is from standard input.  If the **-o** option specifies -,
35 then the output will also be sent to standard output.
36
37 If no **-o** option is specified and an input file other than - is specified,
38 then **llc** creates the output filename by taking the input filename,
39 removing any existing *.bc* extension, and adding a *.s* suffix.
40
41 Other **llc** options are as follows:
42
43 End-user Options
44 ~~~~~~~~~~~~~~~~
45
46
47
48 **-help**
49
50  Print a summary of command line options.
51
52
53
54 **-O**\ =\ *uint*
55
56  Generate code at different optimization levels. These correspond to the *-O0*,
57  *-O1*, *-O2*, and *-O3* optimization levels used by **llvm-gcc** and
58  **clang**.
59
60
61
62 **-mtriple**\ =\ *target triple*
63
64  Override the target triple specified in the input file with the specified
65  string.
66
67
68
69 **-march**\ =\ *arch*
70
71  Specify the architecture for which to generate assembly, overriding the target
72  encoded in the input file.  See the output of **llc -help** for a list of
73  valid architectures.  By default this is inferred from the target triple or
74  autodetected to the current architecture.
75
76
77
78 **-mcpu**\ =\ *cpuname*
79
80  Specify a specific chip in the current architecture to generate code for.
81  By default this is inferred from the target triple and autodetected to
82  the current architecture.  For a list of available CPUs, use:
83  **llvm-as < /dev/null | llc -march=xyz -mcpu=help**
84
85
86
87 **-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  **llvm-as < /dev/null | llc -march=xyz -mattr=help**
93
94
95
96 **--disable-fp-elim**
97
98  Disable frame pointer elimination optimization.
99
100
101
102 **--disable-excess-fp-precision**
103
104  Disable optimizations that may produce excess precision for floating point.
105  Note that this option can dramatically slow down code on some systems
106  (e.g. X86).
107
108
109
110 **--enable-no-infs-fp-math**
111
112  Enable optimizations that assume no Inf values.
113
114
115
116 **--enable-no-nans-fp-math**
117
118  Enable optimizations that assume no NAN values.
119
120
121
122 **--enable-unsafe-fp-math**
123
124  Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
125  addition is associative) or may not work for all input ranges.  These
126  optimizations allow the code generator to make use of some instructions which
127  would otherwise not be usable (such as fsin on X86).
128
129
130
131 **--enable-correct-eh-support**
132
133  Instruct the **lowerinvoke** pass to insert code for correct exception handling
134  support.  This is expensive and is by default omitted for efficiency.
135
136
137
138 **--stats**
139
140  Print statistics recorded by code-generation passes.
141
142
143
144 **--time-passes**
145
146  Record the amount of time needed for each pass and print a report to standard
147  error.
148
149
150
151 **--load**\ =\ *dso_path*
152
153  Dynamically load *dso_path* (a path to a dynamically shared object) that
154  implements an LLVM target. This will permit the target name to be used with the
155  **-march** option so that code can be generated for that target.
156
157
158
159
160 Tuning/Configuration Options
161 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
163
164
165 **--print-machineinstrs**
166
167  Print generated machine code between compilation phases (useful for debugging).
168
169
170
171 **--regalloc**\ =\ *allocator*
172
173  Specify the register allocator to use. The default *allocator* is *local*.
174  Valid register allocators are:
175
176
177  *simple*
178
179   Very simple "always spill" register allocator
180
181
182
183  *local*
184
185   Local register allocator
186
187
188
189  *linearscan*
190
191   Linear scan global register allocator
192
193
194
195  *iterativescan*
196
197   Iterative scan global register allocator
198
199
200
201
202
203 **--spiller**\ =\ *spiller*
204
205  Specify the spiller to use for register allocators that support it.  Currently
206  this option is used only by the linear scan register allocator. The default
207  *spiller* is *local*.  Valid spillers are:
208
209
210  *simple*
211
212   Simple spiller
213
214
215
216  *local*
217
218   Local spiller
219
220
221
222
223
224
225 Intel IA-32-specific Options
226 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227
228
229
230 **--x86-asm-syntax=att|intel**
231
232  Specify whether to emit assembly code in AT&T syntax (the default) or intel
233  syntax.
234
235
236
237
238
239 EXIT STATUS
240 -----------
241
242
243 If **llc** succeeds, it will exit with 0.  Otherwise, if an error occurs,
244 it will exit with a non-zero value.
245
246
247 SEE ALSO
248 --------
249
250
251 lli|lli