109467b48Spatrickopt - LLVM optimizer 209467b48Spatrick==================== 309467b48Spatrick 409467b48Spatrick.. program:: opt 509467b48Spatrick 609467b48SpatrickSYNOPSIS 709467b48Spatrick-------- 809467b48Spatrick 909467b48Spatrick:program:`opt` [*options*] [*filename*] 1009467b48Spatrick 1109467b48SpatrickDESCRIPTION 1209467b48Spatrick----------- 1309467b48Spatrick 14*d415bd75SrobertThe :program:`opt` command is the modular LLVM optimizer and analyzer. It takes 15*d415bd75SrobertLLVM source files as input, runs the specified optimizations or analyses on it, 16*d415bd75Srobertand then outputs the optimized file. The optimizations available via 17*d415bd75Srobert:program:`opt` depend upon what libraries were linked into it as well as any 18*d415bd75Srobertadditional libraries that have been loaded with the :option:`-load` option. Use 19*d415bd75Srobertthe :option:`-help` option to determine what optimizations you can use. 2009467b48Spatrick 2109467b48SpatrickIf ``filename`` is omitted from the command line or is "``-``", :program:`opt` 2209467b48Spatrickreads its input from standard input. Inputs can be in either the LLVM assembly 2309467b48Spatricklanguage format (``.ll``) or the LLVM bitcode format (``.bc``). 2409467b48Spatrick 2509467b48SpatrickIf an output filename is not specified with the :option:`-o` option, 2609467b48Spatrick:program:`opt` writes its output to the standard output. 2709467b48Spatrick 2809467b48SpatrickOPTIONS 2909467b48Spatrick------- 3009467b48Spatrick 3109467b48Spatrick.. option:: -f 3209467b48Spatrick 3309467b48Spatrick Enable binary output on terminals. Normally, :program:`opt` will refuse to 3409467b48Spatrick write raw bitcode output if the output stream is a terminal. With this option, 3509467b48Spatrick :program:`opt` will write raw bitcode regardless of the output device. 3609467b48Spatrick 3709467b48Spatrick.. option:: -help 3809467b48Spatrick 3909467b48Spatrick Print a summary of command line options. 4009467b48Spatrick 4109467b48Spatrick.. option:: -o <filename> 4209467b48Spatrick 4309467b48Spatrick Specify the output filename. 4409467b48Spatrick 4509467b48Spatrick.. option:: -S 4609467b48Spatrick 4709467b48Spatrick Write output in LLVM intermediate language (instead of bitcode). 4809467b48Spatrick 4909467b48Spatrick.. option:: -{passname} 5009467b48Spatrick 5109467b48Spatrick :program:`opt` provides the ability to run any of LLVM's optimization or 5209467b48Spatrick analysis passes in any order. The :option:`-help` option lists all the passes 5309467b48Spatrick available. The order in which the options occur on the command line are the 5409467b48Spatrick order in which they are executed (within pass constraints). 5509467b48Spatrick 5609467b48Spatrick.. option:: -strip-debug 5709467b48Spatrick 5809467b48Spatrick This option causes opt to strip debug information from the module before 5909467b48Spatrick applying other optimizations. It is essentially the same as `-strip` 6009467b48Spatrick but it ensures that stripping of debug information is done first. 6109467b48Spatrick 6209467b48Spatrick.. option:: -verify-each 6309467b48Spatrick 6409467b48Spatrick This option causes opt to add a verify pass after every pass otherwise 6509467b48Spatrick specified on the command line (including `-verify`). This is useful 6609467b48Spatrick for cases where it is suspected that a pass is creating an invalid module but 6709467b48Spatrick it is not clear which pass is doing it. 6809467b48Spatrick 6909467b48Spatrick.. option:: -stats 7009467b48Spatrick 7109467b48Spatrick Print statistics. 7209467b48Spatrick 7309467b48Spatrick.. option:: -time-passes 7409467b48Spatrick 7509467b48Spatrick Record the amount of time needed for each pass and print it to standard 7609467b48Spatrick error. 7709467b48Spatrick 7809467b48Spatrick.. option:: -debug 7909467b48Spatrick 8009467b48Spatrick If this is a debug build, this option will enable debug printouts from passes 8109467b48Spatrick which use the ``LLVM_DEBUG()`` macro. See the `LLVM Programmer's Manual 8209467b48Spatrick <../ProgrammersManual.html>`_, section ``#DEBUG`` for more information. 8309467b48Spatrick 8409467b48Spatrick.. option:: -load=<plugin> 8509467b48Spatrick 8609467b48Spatrick Load the dynamic object ``plugin``. This object should register new 8709467b48Spatrick optimization or analysis passes. Once loaded, the object will add new command 8809467b48Spatrick line options to enable various optimizations or analyses. To see the new 8909467b48Spatrick complete list of optimizations, use the :option:`-help` and :option:`-load` 9009467b48Spatrick options together. For example: 9109467b48Spatrick 9209467b48Spatrick .. code-block:: sh 9309467b48Spatrick 9409467b48Spatrick opt -load=plugin.so -help 9509467b48Spatrick 96*d415bd75Srobert.. option:: -print-passes 9709467b48Spatrick 98*d415bd75Srobert Print all available passes and exit. 9909467b48Spatrick 10009467b48SpatrickEXIT STATUS 10109467b48Spatrick----------- 10209467b48Spatrick 10309467b48SpatrickIf :program:`opt` succeeds, it will exit with 0. Otherwise, if an error 10409467b48Spatrickoccurs, it will exit with a non-zero value. 105