OSDN Git Service

Documentation for llc: reformat.
[android-x86/external-llvm.git] / docs / CommandGuide / llc.rst
1 llc - LLVM static compiler
2 ==========================
3
4 SYNOPSIS
5 --------
6
7 :program:`llc` [*options*] [*filename*]
8
9 DESCRIPTION
10 -----------
11
12 The :program:`llc` command compiles LLVM source inputs into assembly language
13 for a specified architecture.  The assembly language output can then be passed
14 through a native assembler and linker to generate a native executable.
15
16 The choice of architecture for the output assembly code is automatically
17 determined from the input file, unless the :option:`-march` option is used to
18 override the default.
19
20 OPTIONS
21 -------
22
23 If ``filename`` is "``-``" or omitted, :program:`llc` reads from standard input.
24 Otherwise, it will from ``filename``.  Inputs can be in either the LLVM assembly
25 language format (``.ll``) or the LLVM bitcode format (``.bc``).
26
27 If the :option:`-o` option is omitted, then :program:`llc` will send its output
28 to standard output if the input is from standard input.  If the :option:`-o`
29 option specifies "``-``", then the output will also be sent to standard output.
30
31 If no :option:`-o` option is specified and an input file other than "``-``" is
32 specified, then :program:`llc` creates the output filename by taking the input
33 filename, removing any existing ``.bc`` extension, and adding a ``.s`` suffix.
34
35 Other :program:`llc` options are described below.
36
37 End-user Options
38 ~~~~~~~~~~~~~~~~
39
40 .. option:: -help
41
42  Print a summary of command line options.
43
44 .. option:: -O=uint
45
46  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`.
49
50 .. option:: -mtriple=<target triple>
51
52  Override the target triple specified in the input file with the specified
53  string.
54
55 .. option:: -march=<arch>
56
57  Specify the architecture for which to generate assembly, overriding the target
58  encoded in the input file.  See the output of ``llc -help`` for a list of
59  valid architectures.  By default this is inferred from the target triple or
60  autodetected to the current architecture.
61
62 .. option:: -mcpu=<cpuname>
63
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:
67
68  .. code-block:: none
69
70    llvm-as < /dev/null | llc -march=xyz -mcpu=help
71
72 .. option:: -mattr=a1,+a2,-a3,...
73
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:
77
78  .. code-block:: none
79
80    llvm-as < /dev/null | llc -march=xyz -mattr=help
81
82 .. option:: --disable-fp-elim
83
84  Disable frame pointer elimination optimization.
85
86 .. option:: --disable-excess-fp-precision
87
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
92 .. option:: --enable-no-infs-fp-math
93
94  Enable optimizations that assume no Inf values.
95
96 .. option:: --enable-no-nans-fp-math
97
98  Enable optimizations that assume no NAN values.
99
100 .. option:: --enable-unsafe-fp-math
101
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
105  would otherwise not be usable (such as ``fsin`` on X86).
106
107 .. option:: --enable-correct-eh-support
108
109  Instruct the **lowerinvoke** pass to insert code for correct exception
110  handling support.  This is expensive and is by default omitted for efficiency.
111
112 .. option:: --stats
113
114  Print statistics recorded by code-generation passes.
115
116 .. option:: --time-passes
117
118  Record the amount of time needed for each pass and print a report to standard
119  error.
120
121 .. option:: --load=<dso_path>
122
123  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.
126
127 Tuning/Configuration Options
128 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129
130 .. option:: --print-machineinstrs
131
132  Print generated machine code between compilation phases (useful for debugging).
133
134 .. option:: --regalloc=<allocator>
135
136  Specify the register allocator to use.  The default ``allocator`` is *local*.
137  Valid register allocators are:
138
139  *simple*
140
141   Very simple "always spill" register allocator
142
143  *local*
144
145   Local register allocator
146
147  *linearscan*
148
149   Linear scan global register allocator
150
151  *iterativescan*
152
153   Iterative scan global register allocator
154
155 .. option:: --spiller=<spiller>
156
157  Specify the spiller to use for register allocators that support it.  Currently
158  this option is used only by the linear scan register allocator.  The default
159  ``spiller`` is *local*.  Valid spillers are:
160
161  *simple*
162
163   Simple spiller
164
165  *local*
166
167   Local spiller
168
169 Intel IA-32-specific Options
170 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171
172 .. option:: --x86-asm-syntax=[att|intel]
173
174  Specify whether to emit assembly code in AT&T syntax (the default) or Intel
175  syntax.
176
177 EXIT STATUS
178 -----------
179
180 If :program:`llc` succeeds, it will exit with 0.  Otherwise, if an error
181 occurs, it will exit with a non-zero value.
182
183 SEE ALSO
184 --------
185
186 lli
187