llc.rst 6.1 KB

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