]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - usr.bin/clang/opt/opt.1
MFC r244628:
[FreeBSD/stable/9.git] / usr.bin / clang / opt / opt.1
1 .\" $FreeBSD$
2 .TH "OPT" "1" "2012-08-16" "3.2" "LLVM"
3 .SH NAME
4 opt \- LLVM optimizer
5 .
6 .nr rst2man-indent-level 0
7 .
8 .de1 rstReportMargin
9 \\$1 \\n[an-margin]
10 level \\n[rst2man-indent-level]
11 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
12 -
13 \\n[rst2man-indent0]
14 \\n[rst2man-indent1]
15 \\n[rst2man-indent2]
16 ..
17 .de1 INDENT
18 .\" .rstReportMargin pre:
19 . RS \\$1
20 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
21 . nr rst2man-indent-level +1
22 .\" .rstReportMargin post:
23 ..
24 .de UNINDENT
25 . RE
26 .\" indent \\n[an-margin]
27 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
28 .nr rst2man-indent-level -1
29 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
30 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
31 ..
32 .\" Man page generated from reStructuredText.
33 .
34 .SH SYNOPSIS
35 .sp
36 \fBopt\fP [\fIoptions\fP] [\fIfilename\fP]
37 .SH DESCRIPTION
38 .sp
39 The \fBopt\fP command is the modular LLVM optimizer and analyzer.  It takes LLVM
40 source files as input, runs the specified optimizations or analyses on it, and then
41 outputs the optimized file or the analysis results.  The function of
42 \fBopt\fP depends on whether the \fB\-analyze\fP option is given.
43 .sp
44 When \fB\-analyze\fP is specified, \fBopt\fP performs various analyses of the input
45 source.  It will usually print the results on standard output, but in a few
46 cases, it will print output to standard error or generate a file with the
47 analysis output, which is usually done when the output is meant for another
48 program.
49 .sp
50 While \fB\-analyze\fP is \fInot\fP given, \fBopt\fP attempts to produce an optimized
51 output file.  The optimizations available via \fBopt\fP depend upon what
52 libraries were linked into it as well as any additional libraries that have
53 been loaded with the \fB\-load\fP option.  Use the \fB\-help\fP option to determine
54 what optimizations you can use.
55 .sp
56 If \fIfilename\fP is omitted from the command line or is \fI\-\fP, \fBopt\fP reads its
57 input from standard input. Inputs can be in either the LLVM assembly language
58 format (.ll) or the LLVM bitcode format (.bc).
59 .sp
60 If an output filename is not specified with the \fB\-o\fP option, \fBopt\fP
61 writes its output to the standard output.
62 .SH OPTIONS
63 .sp
64 \fB\-f\fP
65 .INDENT 0.0
66 .INDENT 3.5
67 Enable binary output on terminals.  Normally, \fBopt\fP will refuse to
68 write raw bitcode output if the output stream is a terminal. With this option,
69 \fBopt\fP will write raw bitcode regardless of the output device.
70 .UNINDENT
71 .UNINDENT
72 .sp
73 \fB\-help\fP
74 .INDENT 0.0
75 .INDENT 3.5
76 Print a summary of command line options.
77 .UNINDENT
78 .UNINDENT
79 .sp
80 \fB\-o\fP \fIfilename\fP
81 .INDENT 0.0
82 .INDENT 3.5
83 Specify the output filename.
84 .UNINDENT
85 .UNINDENT
86 .sp
87 \fB\-S\fP
88 .INDENT 0.0
89 .INDENT 3.5
90 Write output in LLVM intermediate language (instead of bitcode).
91 .UNINDENT
92 .UNINDENT
93 .sp
94 \fB\-{passname}\fP
95 .INDENT 0.0
96 .INDENT 3.5
97 \fBopt\fP provides the ability to run any of LLVM\(aqs optimization or analysis passes
98 in any order. The \fB\-help\fP option lists all the passes available. The order in
99 which the options occur on the command line are the order in which they are
100 executed (within pass constraints).
101 .UNINDENT
102 .UNINDENT
103 .sp
104 \fB\-std\-compile\-opts\fP
105 .INDENT 0.0
106 .INDENT 3.5
107 This is short hand for a standard list of \fIcompile time optimization\fP passes.
108 This is typically used to optimize the output from the llvm\-gcc front end. It
109 might be useful for other front end compilers as well. To discover the full set
110 of options available, use the following command:
111 .sp
112 .nf
113 .ft C
114 llvm\-as < /dev/null | opt \-std\-compile\-opts \-disable\-output \-debug\-pass=Arguments
115 .ft P
116 .fi
117 .UNINDENT
118 .UNINDENT
119 .sp
120 \fB\-disable\-inlining\fP
121 .INDENT 0.0
122 .INDENT 3.5
123 This option is only meaningful when \fB\-std\-compile\-opts\fP is given. It simply
124 removes the inlining pass from the standard list.
125 .UNINDENT
126 .UNINDENT
127 .sp
128 \fB\-disable\-opt\fP
129 .INDENT 0.0
130 .INDENT 3.5
131 This option is only meaningful when \fB\-std\-compile\-opts\fP is given. It disables
132 most, but not all, of the \fB\-std\-compile\-opts\fP. The ones that remain are
133 \fB\-verify\fP, \fB\-lower\-setjmp\fP, and \fB\-funcresolve\fP.
134 .UNINDENT
135 .UNINDENT
136 .sp
137 \fB\-strip\-debug\fP
138 .INDENT 0.0
139 .INDENT 3.5
140 This option causes opt to strip debug information from the module before
141 applying other optimizations. It is essentially the same as \fB\-strip\fP but it
142 ensures that stripping of debug information is done first.
143 .UNINDENT
144 .UNINDENT
145 .sp
146 \fB\-verify\-each\fP
147 .INDENT 0.0
148 .INDENT 3.5
149 This option causes opt to add a verify pass after every pass otherwise specified
150 on the command line (including \fB\-verify\fP).  This is useful for cases where it
151 is suspected that a pass is creating an invalid module but it is not clear which
152 pass is doing it. The combination of \fB\-std\-compile\-opts\fP and \fB\-verify\-each\fP
153 can quickly track down this kind of problem.
154 .UNINDENT
155 .UNINDENT
156 .sp
157 \fB\-profile\-info\-file\fP \fIfilename\fP
158 .INDENT 0.0
159 .INDENT 3.5
160 Specify the name of the file loaded by the \-profile\-loader option.
161 .UNINDENT
162 .UNINDENT
163 .sp
164 \fB\-stats\fP
165 .INDENT 0.0
166 .INDENT 3.5
167 Print statistics.
168 .UNINDENT
169 .UNINDENT
170 .sp
171 \fB\-time\-passes\fP
172 .INDENT 0.0
173 .INDENT 3.5
174 Record the amount of time needed for each pass and print it to standard
175 error.
176 .UNINDENT
177 .UNINDENT
178 .sp
179 \fB\-debug\fP
180 .INDENT 0.0
181 .INDENT 3.5
182 If this is a debug build, this option will enable debug printouts
183 from passes which use the \fIDEBUG()\fP macro.  See the \fBLLVM Programmer\(aqs
184 Manual\fP, section \fI#DEBUG\fP for more information.
185 .UNINDENT
186 .UNINDENT
187 .sp
188 \fB\-load\fP=\fIplugin\fP
189 .INDENT 0.0
190 .INDENT 3.5
191 Load the dynamic object \fIplugin\fP.  This object should register new optimization
192 or analysis passes. Once loaded, the object will add new command line options to
193 enable various optimizations or analyses.  To see the new complete list of
194 optimizations, use the \fB\-help\fP and \fB\-load\fP options together. For example:
195 .sp
196 .nf
197 .ft C
198 opt \-load=plugin.so \-help
199 .ft P
200 .fi
201 .UNINDENT
202 .UNINDENT
203 .sp
204 \fB\-p\fP
205 .INDENT 0.0
206 .INDENT 3.5
207 Print module after each transformation.
208 .UNINDENT
209 .UNINDENT
210 .SH EXIT STATUS
211 .sp
212 If \fBopt\fP succeeds, it will exit with 0.  Otherwise, if an error
213 occurs, it will exit with a non\-zero value.
214 .SH AUTHOR
215 Maintained by The LLVM Team (http://llvm.org/).
216 .SH COPYRIGHT
217 2012, LLVM Project
218 .\" Generated by docutils manpage writer.
219 .