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