1OPT(1) LLVM Command Guide OPT(1)
2
3
4
6 opt - LLVM optimizer
7
9 opt [options] [filename]
10
12 The opt command is the modular LLVM optimizer and analyzer. It takes
13 LLVM source files as input, runs the specified optimizations or
14 analyses on it, and then outputs the optimized file or the analysis
15 results. The function of opt depends on whether the -analyze option is
16 given.
17
18 When -analyze is specified, opt performs various analyses of the input
19 source. It will usually print the results on standard output, but in a
20 few cases, it will print output to standard error or generate a file
21 with the analysis output, which is usually done when the output is
22 meant for another program.
23
24 While -analyze is not given, opt attempts to produce an optimized
25 output file. The optimizations available via opt depend upon what
26 libraries were linked into it as well as any additional libraries that
27 have been loaded with the -load option. Use the -help option to
28 determine what optimizations you can use.
29
30 If filename is omitted from the command line or is -, opt reads its
31 input from standard input. Inputs can be in either the LLVM assembly
32 language format (.ll) or the LLVM bitcode format (.bc).
33
34 If an output filename is not specified with the -o option, opt writes
35 its output to the standard output.
36
38 -f Enable binary output on terminals. Normally, opt will refuse to
39 write raw bitcode output if the output stream is a terminal. With
40 this option, opt will write raw bitcode regardless of the output
41 device.
42
43 -help
44 Print a summary of command line options.
45
46 -o filename
47 Specify the output filename.
48
49 -S Write output in LLVM intermediate language (instead of bitcode).
50
51 -{passname}
52 opt provides the ability to run any of LLVM's optimization or
53 analysis passes in any order. The -help option lists all the passes
54 available. The order in which the options occur on the command line
55 are the order in which they are executed (within pass constraints).
56
57 -std-compile-opts
58 This is short hand for a standard list of compile time optimization
59 passes. This is typically used to optimize the output from the
60 llvm-gcc front end. It might be useful for other front end
61 compilers as well. To discover the full set of options available,
62 use the following command:
63
64 llvm-as < /dev/null | opt -std-compile-opts -disable-output -debug-pass=Arguments
65
66 -disable-inlining
67 This option is only meaningful when -std-compile-opts is given. It
68 simply removes the inlining pass from the standard list.
69
70 -disable-opt
71 This option is only meaningful when -std-compile-opts is given. It
72 disables most, but not all, of the -std-compile-opts. The ones that
73 remain are -verify, -lower-setjmp, and -funcresolve.
74
75 -strip-debug
76 This option causes opt to strip debug information from the module
77 before applying other optimizations. It is essentially the same as
78 -strip but it ensures that stripping of debug information is done
79 first.
80
81 -verify-each
82 This option causes opt to add a verify pass after every pass
83 otherwise specified on the command line (including -verify). This
84 is useful for cases where it is suspected that a pass is creating
85 an invalid module but it is not clear which pass is doing it. The
86 combination of -std-compile-opts and -verify-each can quickly track
87 down this kind of problem.
88
89 -profile-info-file filename
90 Specify the name of the file loaded by the -profile-loader option.
91
92 -stats
93 Print statistics.
94
95 -time-passes
96 Record the amount of time needed for each pass and print it to
97 standard error.
98
99 -debug
100 If this is a debug build, this option will enable debug printouts
101 from passes which use the DEBUG() macro. See the LLVM Programmer's
102 Manual, section #DEBUG for more information.
103
104 -load=plugin
105 Load the dynamic object plugin. This object should register new
106 optimization or analysis passes. Once loaded, the object will add
107 new command line options to enable various optimizations or
108 analyses. To see the new complete list of optimizations, use the
109 -help and -load options together. For example:
110
111 opt -load=plugin.so -help
112
113 -p Print module after each transformation.
114
116 If opt succeeds, it will exit with 0. Otherwise, if an error occurs,
117 it will exit with a non-zero value.
118
120 Maintained by the LLVM Team (<http://llvm.org>).
121
122
123
124CVS 2010-05-07 OPT(1)