blob: 2e531a9202bda609ff9db59f145c9836a4edf0b0 [file] [log] [blame]
John Criswellecf32e52003-09-11 19:58:03 +00001<html>
Chris Lattner26814d02003-10-07 20:17:24 +00002<title>LLVM: opt tool</title>
John Criswellecf32e52003-09-11 19:58:03 +00003
Chris Lattner08a04fd2003-10-07 20:12:05 +00004<body bgcolor=white>
John Criswellecf32e52003-09-11 19:58:03 +00005
Chris Lattner26814d02003-10-07 20:17:24 +00006<center><h1>LLVM: <tt>opt</tt> tool</h1></center>
John Criswellecf32e52003-09-11 19:58:03 +00007<HR>
8
Chris Lattner26814d02003-10-07 20:17:24 +00009<h3>NAME</h3>
10<tt>opt</tt>
John Criswellecf32e52003-09-11 19:58:03 +000011
Chris Lattner26814d02003-10-07 20:17:24 +000012<h3>SYNOPSIS</h3>
13<tt>opt [options] [filename]</tt>
John Criswellecf32e52003-09-11 19:58:03 +000014
Chris Lattner26814d02003-10-07 20:17:24 +000015<h3>DESCRIPTION</h3>
John Criswellecf32e52003-09-11 19:58:03 +000016
Chris Lattner26814d02003-10-07 20:17:24 +000017The <tt>opt</tt> command is the modular LLVM optimizer. It takes LLVM bytecode
18as input, runs the specified optimizations on it, and then outputs the optimized
19LLVM bytecode.
John Criswell62435342003-09-26 16:32:00 +000020<p>
John Criswellecf32e52003-09-11 19:58:03 +000021
Chris Lattner26814d02003-10-07 20:17:24 +000022The optimizations available via <tt>opt</tt> depend upon what libraries were
23linked into it as well as any additional libraries that have been loaded with
24the <tt>-load</tt> option. Use the <tt>-help</tt> option to determine what
25optimizations you can use.
John Criswell62435342003-09-26 16:32:00 +000026<p>
John Criswellecf32e52003-09-11 19:58:03 +000027
Chris Lattner26814d02003-10-07 20:17:24 +000028If no filename is specified on the command line, <tt>opt</tt> reads its input
29from standard input.
John Criswell62435342003-09-26 16:32:00 +000030<p>
31
Chris Lattner26814d02003-10-07 20:17:24 +000032If an output filename is not specified with the <tt>-o</tt> option, <tt>opt</tt>
33writes its output to the standard output.
34
35
36<h3>OPTIONS</h3>
John Criswellecf32e52003-09-11 19:58:03 +000037
38<ul>
39 <li> -f
40 <br>
Chris Lattner26814d02003-10-07 20:17:24 +000041 Force overwrite. Normally, <tt>opt</tt> will refuse to overwrite an
42 output file that already exists. With this option, <tt>opt</tt> will
43 overwrite the output file and replace it with new bytecode.
John Criswellecf32e52003-09-11 19:58:03 +000044 <p>
45
46 <li> -help
47 <br>
48 Print a summary of command line options.
49 <p>
50
51 <li> -o &lt;filename&gt;
52 <br>
53 Specify the output filename.
54 <p>
55
John Criswell84171422004-03-12 22:45:35 +000056 <li> -profile-info-file &lt;filename&gt;
57 <br>
58 Specify the name of the file loaded by the -profile-loader option.
59 <p>
60
John Criswellecf32e52003-09-11 19:58:03 +000061 <li> -stats
62 <br>
63 Print statistics.
64 <p>
65
66 <li> -time-passes
67 <br>
68 Record the amount of time needed for each pass and print it to standard
69 error.
70 <p>
71
Chris Lattnera2a628f2003-10-07 16:33:42 +000072 <li> -debug
73 <br>
74 If this is a debug build, this option will enable debug printouts from
75 passes which use the <tt>DEBUG</tt> macro. See the <a
76 href="../ProgrammersManual.html#DEBUG">Programmer's Manual</a> for more
77 information.
78 <p>
79<!--
John Criswellecf32e52003-09-11 19:58:03 +000080 <li> -internalize-public-api-file &lt;filename&gt;
81 <br>
82 Preserve the symbol names listed in the file filename.
83 <p>
84
85 <li> -internalize-public-api-list=&lt;list&gt;
86 <br>
87 Perserve the symbol names specified.
88 <p>
Chris Lattnera2a628f2003-10-07 16:33:42 +000089-->
John Criswellecf32e52003-09-11 19:58:03 +000090
91 <li> -q
92 <br>
93 Quiet mode. Do not print messages on whether the program was modified.
94 <p>
95
John Criswellf9c78652004-01-26 21:26:54 +000096 <li> -load &lt;plugin&gt;
John Criswellecf32e52003-09-11 19:58:03 +000097 <br>
John Criswellf9c78652004-01-26 21:26:54 +000098 Load the dynamic object &lt;plugin&gt;. This object should register new
John Criswellecf32e52003-09-11 19:58:03 +000099 optimization passes. Once loaded, the object will add new command line
100 options to enable various optimizations. To see the new complete list
101 of optimizations, use the -help and -load options together:
102 <p>
John Criswellf9c78652004-01-26 21:26:54 +0000103 <tt>opt -load &lt;plugin&gt; -help</tt>
John Criswellecf32e52003-09-11 19:58:03 +0000104 <p>
105
106 <li> -p
107 <br>
108 Print module after each transformation.
109 <p>
110</ul>
111
Chris Lattner26814d02003-10-07 20:17:24 +0000112<h3>EXIT STATUS</h3>
John Criswellecf32e52003-09-11 19:58:03 +0000113
Chris Lattner26814d02003-10-07 20:17:24 +0000114If <tt>opt</tt> succeeds, it will exit with 0. Otherwise, if an error occurs,
115it will exit with a non-zero value.
John Criswellecf32e52003-09-11 19:58:03 +0000116
Chris Lattner26814d02003-10-07 20:17:24 +0000117<h3>SEE ALSO</h3>
118
119<a href="analyze.html"><tt>analyze</tt></a>
John Criswellecf32e52003-09-11 19:58:03 +0000120
121<HR>
Chris Lattner08a04fd2003-10-07 20:12:05 +0000122Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
John Criswellecf32e52003-09-11 19:58:03 +0000123</body>
124</html>
125