Sean Eveson | 360f53a | 2017-11-30 12:43:25 +0000 | [diff] [blame] | 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:`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:: -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 | |
| 80 | .. option:: -mattr=a1,+a2,-a3,... |
| 81 | |
| 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: |
| 85 | |
| 86 | .. code-block:: none |
| 87 | |
| 88 | llvm-as < /dev/null | llc -march=xyz -mattr=help |
| 89 | |
Francis Visoiu Mistrih | 08223c3 | 2019-01-14 10:55:55 +0000 | [diff] [blame] | 90 | .. option:: --frame-pointer |
Sean Eveson | 360f53a | 2017-11-30 12:43:25 +0000 | [diff] [blame] | 91 | |
Francis Visoiu Mistrih | 08223c3 | 2019-01-14 10:55:55 +0000 | [diff] [blame] | 92 | Specify effect of frame pointer elimination optimization (all,non-leaf,none). |
Sean Eveson | 360f53a | 2017-11-30 12:43:25 +0000 | [diff] [blame] | 93 | |
| 94 | .. option:: --disable-excess-fp-precision |
| 95 | |
| 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 | |
| 100 | .. option:: --enable-no-infs-fp-math |
| 101 | |
| 102 | Enable optimizations that assume no Inf values. |
| 103 | |
| 104 | .. option:: --enable-no-nans-fp-math |
| 105 | |
| 106 | Enable optimizations that assume no NAN values. |
| 107 | |
| 108 | .. option:: --enable-unsafe-fp-math |
| 109 | |
| 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 |
| 113 | would otherwise not be usable (such as ``fsin`` on X86). |
| 114 | |
| 115 | .. option:: --stats |
| 116 | |
| 117 | Print statistics recorded by code-generation passes. |
| 118 | |
| 119 | .. option:: --time-passes |
| 120 | |
| 121 | Record the amount of time needed for each pass and print a report to standard |
| 122 | error. |
| 123 | |
| 124 | .. option:: --load=<dso_path> |
| 125 | |
| 126 | Dynamically load ``dso_path`` (a path to a dynamically shared object) that |
| 127 | implements an LLVM target. This will permit the target name to be used with |
| 128 | the :option:`-march` option so that code can be generated for that target. |
| 129 | |
| 130 | .. option:: -meabi=[default|gnu|4|5] |
| 131 | |
| 132 | Specify which EABI version should conform to. Valid EABI versions are *gnu*, |
| 133 | *4* and *5*. Default value (*default*) depends on the triple. |
| 134 | |
Sean Eveson | ab494c9 | 2017-11-30 13:05:14 +0000 | [diff] [blame] | 135 | .. option:: -stack-size-section |
| 136 | |
| 137 | Emit the .stack_sizes section which contains stack size metadata. The section |
Sean Eveson | a470b46 | 2018-01-17 09:01:29 +0000 | [diff] [blame] | 138 | contains an array of pairs of function symbol values (pointer size) and stack |
Sean Eveson | ab494c9 | 2017-11-30 13:05:14 +0000 | [diff] [blame] | 139 | sizes (unsigned LEB128). The stack size values only include the space allocated |
| 140 | in the function prologue. Functions with dynamic stack allocations are not |
| 141 | included. |
| 142 | |
Sean Eveson | 360f53a | 2017-11-30 12:43:25 +0000 | [diff] [blame] | 143 | |
| 144 | Tuning/Configuration Options |
| 145 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 146 | |
| 147 | .. option:: --print-machineinstrs |
| 148 | |
| 149 | Print generated machine code between compilation phases (useful for debugging). |
| 150 | |
| 151 | .. option:: --regalloc=<allocator> |
| 152 | |
| 153 | Specify the register allocator to use. |
| 154 | Valid register allocators are: |
| 155 | |
| 156 | *basic* |
| 157 | |
| 158 | Basic register allocator. |
| 159 | |
| 160 | *fast* |
| 161 | |
| 162 | Fast register allocator. It is the default for unoptimized code. |
| 163 | |
| 164 | *greedy* |
| 165 | |
| 166 | Greedy register allocator. It is the default for optimized code. |
| 167 | |
| 168 | *pbqp* |
| 169 | |
| 170 | Register allocator based on 'Partitioned Boolean Quadratic Programming'. |
| 171 | |
| 172 | .. option:: --spiller=<spiller> |
| 173 | |
| 174 | Specify the spiller to use for register allocators that support it. Currently |
| 175 | this option is used only by the linear scan register allocator. The default |
| 176 | ``spiller`` is *local*. Valid spillers are: |
| 177 | |
| 178 | *simple* |
| 179 | |
| 180 | Simple spiller |
| 181 | |
| 182 | *local* |
| 183 | |
| 184 | Local spiller |
| 185 | |
| 186 | Intel IA-32-specific Options |
| 187 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 188 | |
| 189 | .. option:: --x86-asm-syntax=[att|intel] |
| 190 | |
| 191 | Specify whether to emit assembly code in AT&T syntax (the default) or Intel |
| 192 | syntax. |
| 193 | |
| 194 | EXIT STATUS |
| 195 | ----------- |
| 196 | |
| 197 | If :program:`llc` succeeds, it will exit with 0. Otherwise, if an error |
| 198 | occurs, it will exit with a non-zero value. |
| 199 | |
| 200 | SEE ALSO |
| 201 | -------- |
| 202 | |
| 203 | lli |
| 204 | |