blob: 4134bfefb89db1c8dc9fe7d3ba55d38898a65da1 [file] [log] [blame]
Misha Brukman69985172004-07-01 15:25:04 +00001=pod
2
3=head1 NAME
4
5opt - LLVM optimizer
6
7=head1 SYNOPSIS
8
Misha Brukmanc08937a2004-07-02 16:06:19 +00009B<opt> [I<options>] [I<filename>]
Misha Brukman69985172004-07-01 15:25:04 +000010
11=head1 DESCRIPTION
12
Reid Spencer84f82f72006-08-28 00:34:19 +000013The B<opt> command is the modular LLVM optimizer and analyzer. It takes LLVM
14bytecode as input, runs the specified optimizations or analyses on it, and then
15outputs the optimized LLVM bytecode or the analysis results. The function of
16B<opt> depends on whether the B<-analyze> option is given.
Misha Brukman69985172004-07-01 15:25:04 +000017
Reid Spencer84f82f72006-08-28 00:34:19 +000018When B<-analyze> is specified, B<opt> performs various analyses of LLVM
19bytecode. 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.
Misha Brukman69985172004-07-01 15:25:04 +000023
Reid Spencer84f82f72006-08-28 00:34:19 +000024While B<-analyze> is I<not> given, B<opt> attempts to produce an optimized
25bytecode 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. The input must be an LLVM bytecode file.
Misha Brukman69985172004-07-01 15:25:04 +000032
33If an output filename is not specified with the B<-o> option, B<opt>
34writes its output to the standard output.
35
36=head1 OPTIONS
37
38=over
39
40=item B<-f>
41
42Force overwrite. Normally, B<opt> will refuse to overwrite an
43output file that already exists. With this option, B<opt> will
44overwrite the output file and replace it with new bytecode.
45
46=item B<-help>
47
48Print a summary of command line options.
49
50=item B<-o> I<filename>
51
52Specify the output filename.
53
54=item B<-profile-info-file> I<filename>
55
56Specify the name of the file loaded by the -profile-loader option.
57
58=item B<-stats>
59
60Print statistics.
61
62=item B<-time-passes>
63
64Record the amount of time needed for each pass and print it to standard
65error.
66
67=item B<-debug>
68
69If this is a debug build, this option will enable debug printouts
70from passes which use the I<DEBUG()> macro. See the B<LLVM Programmer's
71Manual>, section I<#DEBUG> for more information.
72
73=item B<-load>=I<plugin>
74
Reid Spencer84f82f72006-08-28 00:34:19 +000075Load the dynamic object I<plugin>. This object should register new optimization
76or analysis passes. Once loaded, the object will add new command line options to
77enable various optimizations or analyses. To see the new complete list of
78optimizations, use the B<-help> and B<-load> options together. For example:
Misha Brukman69985172004-07-01 15:25:04 +000079
80=over
81
82B<opt -load>=I<plugin> B<-help>
83
84=back
85
86=item B<-p>
87
88Print module after each transformation.
89
90=back
91
92=head1 EXIT STATUS
93
94If B<opt> succeeds, it will exit with 0. Otherwise, if an error
95occurs, it will exit with a non-zero value.
96
Misha Brukman69985172004-07-01 15:25:04 +000097=head1 AUTHORS
98
Reid Spencercd143fc2006-03-14 05:42:07 +000099Maintained by the LLVM Team (L<http://llvm.org>).
Misha Brukman69985172004-07-01 15:25:04 +0000100
101=cut