1opt - LLVM optimizer 2==================== 3 4.. program:: opt 5 6SYNOPSIS 7-------- 8 9:program:`opt` [*options*] [*filename*] 10 11DESCRIPTION 12----------- 13 14The :program:`opt` command is the modular LLVM optimizer and analyzer. It takes 15LLVM source files as input, runs the specified optimizations or analyses on it, 16and then outputs the optimized file. The optimizations available via 17:program:`opt` depend upon what libraries were linked into it as well as any 18additional libraries that have been loaded with the :option:`-load` option. Use 19the :option:`-help` option to determine what optimizations you can use. 20 21If ``filename`` is omitted from the command line or is "``-``", :program:`opt` 22reads its input from standard input. Inputs can be in either the LLVM assembly 23language format (``.ll``) or the LLVM bitcode format (``.bc``). 24 25If an output filename is not specified with the :option:`-o` option, 26:program:`opt` writes its output to the standard output. 27 28OPTIONS 29------- 30 31.. option:: -f 32 33 Enable binary output on terminals. Normally, :program:`opt` will refuse to 34 write raw bitcode output if the output stream is a terminal. With this option, 35 :program:`opt` will write raw bitcode regardless of the output device. 36 37.. option:: -help 38 39 Print a summary of command line options. 40 41.. option:: -o <filename> 42 43 Specify the output filename. 44 45.. option:: -S 46 47 Write output in LLVM intermediate language (instead of bitcode). 48 49.. option:: -{passname} 50 51 :program:`opt` provides the ability to run any of LLVM's optimization or 52 analysis passes in any order. The :option:`-help` option lists all the passes 53 available. The order in which the options occur on the command line are the 54 order in which they are executed (within pass constraints). 55 56.. option:: -strip-debug 57 58 This option causes opt to strip debug information from the module before 59 applying other optimizations. It is essentially the same as `-strip` 60 but it ensures that stripping of debug information is done first. 61 62.. option:: -verify-each 63 64 This option causes opt to add a verify pass after every pass otherwise 65 specified on the command line (including `-verify`). This is useful 66 for cases where it is suspected that a pass is creating an invalid module but 67 it is not clear which pass is doing it. 68 69.. option:: -stats 70 71 Print statistics. 72 73.. option:: -time-passes 74 75 Record the amount of time needed for each pass and print it to standard 76 error. 77 78.. option:: -debug 79 80 If this is a debug build, this option will enable debug printouts from passes 81 which use the ``LLVM_DEBUG()`` macro. See the `LLVM Programmer's Manual 82 <../ProgrammersManual.html>`_, section ``#DEBUG`` for more information. 83 84.. option:: -load=<plugin> 85 86 Load the dynamic object ``plugin``. This object should register new 87 optimization or analysis passes. Once loaded, the object will add new command 88 line options to enable various optimizations or analyses. To see the new 89 complete list of optimizations, use the :option:`-help` and :option:`-load` 90 options together. For example: 91 92 .. code-block:: sh 93 94 opt -load=plugin.so -help 95 96.. option:: -print-passes 97 98 Print all available passes and exit. 99 100EXIT STATUS 101----------- 102 103If :program:`opt` succeeds, it will exit with 0. Otherwise, if an error 104occurs, it will exit with a non-zero value. 105