4134bfefb89db1c8dc9fe7d3ba55d38898a65da1
[oota-llvm.git] / docs / CommandGuide / opt.pod
1 =pod
2
3 =head1 NAME
4
5 opt - LLVM optimizer
6
7 =head1 SYNOPSIS
8
9 B<opt> [I<options>] [I<filename>]
10
11 =head1 DESCRIPTION
12
13 The B<opt> command is the modular LLVM optimizer and analyzer.  It takes LLVM 
14 bytecode as input, runs the specified optimizations or analyses on it, and then
15 outputs the optimized LLVM bytecode or the analysis results.  The function of 
16 B<opt> depends on whether the B<-analyze> option is given. 
17
18 When B<-analyze> is specified, B<opt> performs various analyses of LLVM 
19 bytecode.  It will usually print the results on standard output, but in a few 
20 cases, it will print output to standard error or generate a file with the 
21 analysis output, which is usually done when the output is meant for another 
22 program.  
23
24 While B<-analyze> is I<not> given, B<opt> attempts to produce an optimized 
25 bytecode file.  The optimizations available via B<opt> depend upon what 
26 libraries were linked into it as well as any additional libraries that have 
27 been loaded with the B<-load> option.  Use the B<-help> option to determine 
28 what optimizations you can use.
29
30 If I<filename> is omitted from the command line or is I<->, B<opt> reads its
31 input from standard input. The input must be an LLVM bytecode file.
32
33 If an output filename is not specified with the B<-o> option, B<opt>
34 writes its output to the standard output.
35
36 =head1 OPTIONS
37
38 =over
39
40 =item B<-f>
41
42 Force overwrite.  Normally, B<opt> will refuse to overwrite an
43 output file that already exists.  With this option, B<opt> will
44 overwrite the output file and replace it with new bytecode.
45
46 =item B<-help>
47
48 Print a summary of command line options.
49
50 =item B<-o> I<filename>
51
52 Specify the output filename.
53
54 =item B<-profile-info-file> I<filename>
55
56 Specify the name of the file loaded by the -profile-loader option.
57
58 =item B<-stats>
59
60 Print statistics.
61
62 =item B<-time-passes>
63
64 Record the amount of time needed for each pass and print it to standard
65 error.
66
67 =item B<-debug>
68
69 If this is a debug build, this option will enable debug printouts
70 from passes which use the I<DEBUG()> macro.  See the B<LLVM Programmer's
71 Manual>, section I<#DEBUG> for more information.
72
73 =item B<-load>=I<plugin>
74
75 Load the dynamic object I<plugin>.  This object should register new optimization
76 or analysis passes. Once loaded, the object will add new command line options to
77 enable various optimizations or analyses.  To see the new complete list of 
78 optimizations, use the B<-help> and B<-load> options together. For example:
79
80 =over
81
82 B<opt -load>=I<plugin> B<-help>
83
84 =back
85
86 =item B<-p>
87
88 Print module after each transformation.
89
90 =back
91
92 =head1 EXIT STATUS
93
94 If B<opt> succeeds, it will exit with 0.  Otherwise, if an error
95 occurs, it will exit with a non-zero value.
96
97 =head1 AUTHORS
98
99 Maintained by the LLVM Team (L<http://llvm.org>).
100
101 =cut