summaryrefslogtreecommitdiff
path: root/docs/CommandGuide/opt.html
blob: b205209794ad1c585b7dfde7135d63db72ef6091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<html>
<title>LLVM: opt tool</title>

<body bgcolor=white>

<center><h1>LLVM: <tt>opt</tt> tool</h1></center>
<HR>

<h3>NAME</h3>
<tt>opt</tt>

<h3>SYNOPSIS</h3>
<tt>opt [options] [filename]</tt>

<h3>DESCRIPTION</h3>

The <tt>opt</tt> command is the modular LLVM optimizer.  It takes LLVM bytecode
as input, runs the specified optimizations on it, and then outputs the optimized
LLVM bytecode.
<p>

The optimizations available via <tt>opt</tt> depend upon what libraries were
linked into it as well as any additional libraries that have been loaded with
the <tt>-load</tt> option.  Use the <tt>-help</tt> option to determine what
optimizations you can use.
<p>

If no filename is specified on the command line, <tt>opt</tt> reads its input
from standard input.
<p>

If an output filename is not specified with the <tt>-o</tt> option, <tt>opt</tt>
writes its output to the standard output.


<h3>OPTIONS</h3>

<ul>
	<li> -f
	<br>
	Force overwrite.  Normally, <tt>opt</tt> will refuse to overwrite an
	output file that already exists.  With this option, <tt>opt</tt> will
	overwrite the output file and replace it with new bytecode.
	<p>

	<li> -help
	<br>
	Print a summary of command line options.
	<p>

	<li> -o &lt;filename&gt;
	<br>
	Specify the output filename.
	<p>

	<li> -stats
	<br>
	Print statistics.
	<p>

	<li> -time-passes
	<br>
	Record the amount of time needed for each pass and print it to standard
	error.
	<p>

	<li> -debug
	<br>
	If this is a debug build, this option will enable debug printouts from
	passes which use the <tt>DEBUG</tt> macro.  See the <a
	href="../ProgrammersManual.html#DEBUG">Programmer's Manual</a> for more
	information.
	<p>
<!--
	<li> -internalize-public-api-file &lt;filename&gt;
	<br>
	Preserve the symbol names listed in the file filename.
	<p>

	<li> -internalize-public-api-list=&lt;list&gt;
	<br>
	Perserve the symbol names specified.
	<p>
-->

	<li> -q
	<br>
	Quiet mode.  Do not print messages on whether the program was modified.
	<p>

	<li> -load &lt;plugin.so&gt;
	<br>
	Load the dynamic object &lt;plugin.so&gt;.  This object should register new
	optimization passes.  Once loaded, the object will add new command line
	options to enable various optimizations.  To see the new complete list
	of optimizations, use the -help and -load options together:
	<p>
	<tt>opt -load  &lt;plugin.so&gt; -help</tt>
	<p>

	<li> -p
	<br>
	Print module after each transformation.
	<p>
</ul>

<h3>EXIT STATUS</h3>

If <tt>opt</tt> succeeds, it will exit with 0.  Otherwise, if an error occurs,
it will exit with a non-zero value.

<h3>SEE ALSO</h3>

<a href="analyze.html"><tt>analyze</tt></a>

<HR>
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
</body>
</html>