blob: 49bb3c3b19fc42c56dcfd86af9f83b067cc6566c [file] [log] [blame]
Chris Lattner46e18c72004-04-02 05:06:57 +00001//===- opt.cpp - The LLVM Modular Optimizer -------------------------------===//
Misha Brukman650ba8e2005-04-22 00:00:37 +00002//
John Criswell09344dc2003-10-20 17:47:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner345353d2007-12-29 20:44:31 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman650ba8e2005-04-22 00:00:37 +00007//
John Criswell09344dc2003-10-20 17:47:21 +00008//===----------------------------------------------------------------------===//
Chris Lattner2f7c9632001-06-06 20:29:01 +00009//
Chris Lattner2f7c9632001-06-06 20:29:01 +000010// Optimizations may be specified an arbitrary number of times on the command
Reid Spencer378f7d52006-08-18 06:34:30 +000011// line, They are run in the order specified.
Chris Lattner2f7c9632001-06-06 20:29:01 +000012//
Chris Lattner6fc7ff42001-10-18 06:05:15 +000013//===----------------------------------------------------------------------===//
Chris Lattner2f7c9632001-06-06 20:29:01 +000014
Chandler Carruth66445382014-01-11 08:16:35 +000015#include "NewPMDriver.h"
Eli Benderskyb60f8382014-02-10 23:34:23 +000016#include "PassPrinters.h"
Devang Patel0abc4632011-04-04 19:51:17 +000017#include "llvm/ADT/StringSet.h"
Chris Lattner15c8b5e2011-02-18 22:13:01 +000018#include "llvm/ADT/Triple.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000019#include "llvm/Analysis/CallGraph.h"
Chandler Carruth839a98e2013-01-07 15:26:48 +000020#include "llvm/Analysis/CallGraphSCCPass.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000021#include "llvm/Analysis/LoopPass.h"
22#include "llvm/Analysis/RegionPass.h"
Chandler Carruthb7bdfd62014-01-13 07:38:24 +000023#include "llvm/Bitcode/BitcodeWriterPass.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000024#include "llvm/CodeGen/CommandFlags.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000025#include "llvm/DebugInfo.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000026#include "llvm/IR/DataLayout.h"
Chandler Carruthb8ddc702014-01-12 11:10:32 +000027#include "llvm/IR/IRPrintingPasses.h"
Chandler Carruth66445382014-01-11 08:16:35 +000028#include "llvm/IR/LLVMContext.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000029#include "llvm/IR/Module.h"
Chandler Carruth5ad5f152014-01-13 09:26:24 +000030#include "llvm/IR/Verifier.h"
Chandler Carruthe60e57b2013-03-26 02:25:37 +000031#include "llvm/IRReader/IRReader.h"
Jakub Staszak63e77d52013-01-10 21:56:40 +000032#include "llvm/LinkAllIR.h"
Chandler Carruth1fe21fc2013-01-19 08:03:47 +000033#include "llvm/LinkAllPasses.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000034#include "llvm/MC/SubtargetFeature.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000035#include "llvm/PassManager.h"
David Greeneed8a1de2010-01-05 01:30:32 +000036#include "llvm/Support/Debug.h"
Chris Lattner76d46322006-12-06 01:18:01 +000037#include "llvm/Support/ManagedStatic.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000038#include "llvm/Support/PassNameParser.h"
Reid Spencer7c16caa2004-09-01 22:55:40 +000039#include "llvm/Support/PluginLoader.h"
Chris Lattner4b2a6e22009-12-09 00:41:28 +000040#include "llvm/Support/PrettyStackTrace.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000041#include "llvm/Support/Signals.h"
Chandler Carruthe60e57b2013-03-26 02:25:37 +000042#include "llvm/Support/SourceMgr.h"
Reid Spencer7c16caa2004-09-01 22:55:40 +000043#include "llvm/Support/SystemUtils.h"
Nadav Rotem5dc203e2012-10-18 23:22:48 +000044#include "llvm/Support/TargetRegistry.h"
Nadav Rotemac9a3442012-10-24 17:23:50 +000045#include "llvm/Support/TargetSelect.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000046#include "llvm/Support/ToolOutputFile.h"
47#include "llvm/Target/TargetLibraryInfo.h"
48#include "llvm/Target/TargetMachine.h"
Rafael Espindola591eaa42011-08-02 21:50:24 +000049#include "llvm/Transforms/IPO/PassManagerBuilder.h"
Chris Lattner5a48a242002-07-23 18:12:22 +000050#include <algorithm>
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000051#include <memory>
Brian Gaeke960707c2003-11-11 22:41:34 +000052using namespace llvm;
Chandler Carruth949282e2014-01-13 03:08:40 +000053using namespace opt_tool;
Chris Lattnerb86b11a2002-04-12 18:21:13 +000054
Chris Lattner5a48a242002-07-23 18:12:22 +000055// The OptimizationList is automatically populated with registered Passes by the
56// PassNameParser.
57//
Chris Lattner8e5e13b2006-08-27 22:07:01 +000058static cl::list<const PassInfo*, bool, PassNameParser>
59PassList(cl::desc("Optimizations available:"));
Chris Lattner5a48a242002-07-23 18:12:22 +000060
Chandler Carruth66445382014-01-11 08:16:35 +000061// This flag specifies a textual description of the optimization pass pipeline
62// to run over the module. This flag switches opt to use the new pass manager
63// infrastructure, completely disabling all of the flags specific to the old
64// pass management.
65static cl::opt<std::string> PassPipeline(
66 "passes",
67 cl::desc("A textual description of the pass pipeline for optimizing"),
68 cl::Hidden);
69
Chris Lattner5a48a242002-07-23 18:12:22 +000070// Other command line options...
Chris Lattnerc90d6ba2002-01-31 00:47:12 +000071//
Chris Lattner02a16832003-05-22 20:13:16 +000072static cl::opt<std::string>
Eric Christophere64061f2009-08-21 23:29:40 +000073InputFilename(cl::Positional, cl::desc("<input bitcode file>"),
Reid Spencer378f7d52006-08-18 06:34:30 +000074 cl::init("-"), cl::value_desc("filename"));
Chris Lattnerf5cad152002-07-22 02:10:13 +000075
Chris Lattner02a16832003-05-22 20:13:16 +000076static cl::opt<std::string>
Chris Lattnerf5cad152002-07-22 02:10:13 +000077OutputFilename("o", cl::desc("Override output filename"),
Dan Gohmanb01aed12010-08-18 17:40:10 +000078 cl::value_desc("filename"));
Chris Lattnerf5cad152002-07-22 02:10:13 +000079
80static cl::opt<bool>
Dan Gohman61a87962009-08-25 15:34:52 +000081Force("f", cl::desc("Enable binary output on terminals"));
Chris Lattnerf5cad152002-07-22 02:10:13 +000082
83static cl::opt<bool>
84PrintEachXForm("p", cl::desc("Print module after each transformation"));
85
86static cl::opt<bool>
Chris Lattner30f40d92003-02-26 20:00:41 +000087NoOutput("disable-output",
Gabor Greife16561c2007-07-05 17:07:56 +000088 cl::desc("Do not write result bitcode file"), cl::Hidden);
Chris Lattner4dbe59b2003-02-12 18:43:33 +000089
90static cl::opt<bool>
Duncan Sands6f2ffce2009-10-14 20:01:39 +000091OutputAssembly("S", cl::desc("Write output as LLVM assembly"));
Daniel Dunbar6b3153b2009-09-05 11:34:53 +000092
93static cl::opt<bool>
Chris Lattner30f40d92003-02-26 20:00:41 +000094NoVerify("disable-verify", cl::desc("Do not verify result module"), cl::Hidden);
Chris Lattnerb84505992003-02-12 18:45:08 +000095
96static cl::opt<bool>
Reid Spencer22dbfb62007-02-02 14:46:29 +000097VerifyEach("verify-each", cl::desc("Verify after each transform"));
98
99static cl::opt<bool>
100StripDebug("strip-debug",
101 cl::desc("Strip debugger symbol info from translation unit"));
102
103static cl::opt<bool>
104DisableInline("disable-inlining", cl::desc("Do not run the inliner pass"));
105
Eric Christophere64061f2009-08-21 23:29:40 +0000106static cl::opt<bool>
107DisableOptimizations("disable-opt",
Reid Spencer22dbfb62007-02-02 14:46:29 +0000108 cl::desc("Do not run any optimization passes"));
109
Eric Christophere64061f2009-08-21 23:29:40 +0000110static cl::opt<bool>
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000111DisableInternalize("disable-internalize",
112 cl::desc("Do not mark all symbols as internal"));
113
Reid Spencer22dbfb62007-02-02 14:46:29 +0000114static cl::opt<bool>
Eric Christophere64061f2009-08-21 23:29:40 +0000115StandardCompileOpts("std-compile-opts",
Reid Spencer22dbfb62007-02-02 14:46:29 +0000116 cl::desc("Include the standard compile time optimizations"));
117
118static cl::opt<bool>
Eric Christophere64061f2009-08-21 23:29:40 +0000119StandardLinkOpts("std-link-opts",
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000120 cl::desc("Include the standard link time optimizations"));
121
122static cl::opt<bool>
Devang Patel9966ccf2008-09-16 22:25:14 +0000123OptLevelO1("O1",
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000124 cl::desc("Optimization level 1. Similar to clang -O1"));
Devang Patel9966ccf2008-09-16 22:25:14 +0000125
126static cl::opt<bool>
127OptLevelO2("O2",
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000128 cl::desc("Optimization level 2. Similar to clang -O2"));
129
130static cl::opt<bool>
131OptLevelOs("Os",
132 cl::desc("Like -O2 with extra optimizations for size. Similar to clang -Os"));
133
134static cl::opt<bool>
135OptLevelOz("Oz",
136 cl::desc("Like -Os but reduces code size further. Similar to clang -Oz"));
Devang Patel9966ccf2008-09-16 22:25:14 +0000137
138static cl::opt<bool>
139OptLevelO3("O3",
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000140 cl::desc("Optimization level 3. Similar to clang -O3"));
Devang Patel9966ccf2008-09-16 22:25:14 +0000141
Joe Groff1b738692012-04-17 23:05:48 +0000142static cl::opt<std::string>
143TargetTriple("mtriple", cl::desc("Override target triple for module"));
144
Devang Patel9966ccf2008-09-16 22:25:14 +0000145static cl::opt<bool>
146UnitAtATime("funit-at-a-time",
Eric Christopherc8f625b2009-08-21 23:30:30 +0000147 cl::desc("Enable IPO. This is same as llvm-gcc's -funit-at-a-time"),
Duncan Sands41b4a6b2010-07-12 08:16:59 +0000148 cl::init(true));
Devang Patel9966ccf2008-09-16 22:25:14 +0000149
150static cl::opt<bool>
Hal Finkel6d099042013-08-28 18:33:10 +0000151DisableLoopUnrolling("disable-loop-unrolling",
152 cl::desc("Disable loop unrolling in all relevant passes"),
153 cl::init(false));
Arnold Schwaighofer46db7252013-12-03 16:33:06 +0000154static cl::opt<bool>
155DisableLoopVectorization("disable-loop-vectorization",
156 cl::desc("Disable the loop vectorization pass"),
157 cl::init(false));
158
159static cl::opt<bool>
160DisableSLPVectorization("disable-slp-vectorization",
161 cl::desc("Disable the slp vectorization pass"),
162 cl::init(false));
163
Hal Finkel6d099042013-08-28 18:33:10 +0000164
165static cl::opt<bool>
Devang Patel9966ccf2008-09-16 22:25:14 +0000166DisableSimplifyLibCalls("disable-simplify-libcalls",
Devang Patel7293f0f2008-09-17 16:01:39 +0000167 cl::desc("Disable simplify-libcalls"));
Devang Patel9966ccf2008-09-16 22:25:14 +0000168
169static cl::opt<bool>
Chris Lattner1553edc2004-05-27 20:32:10 +0000170Quiet("q", cl::desc("Obsolete option"), cl::Hidden);
Chris Lattnerf5cad152002-07-22 02:10:13 +0000171
Reid Spencerc8878ed2004-05-27 16:28:54 +0000172static cl::alias
173QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet));
174
Reid Spencer378f7d52006-08-18 06:34:30 +0000175static cl::opt<bool>
176AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization"));
177
Devang Patel786a05e2010-12-07 00:33:43 +0000178static cl::opt<bool>
Andrew Trickb826ae82011-04-05 18:41:31 +0000179PrintBreakpoints("print-breakpoints-for-testing",
Devang Patel786a05e2010-12-07 00:33:43 +0000180 cl::desc("Print select breakpoints location for testing"));
181
Chris Lattnercfa19112009-10-22 00:44:10 +0000182static cl::opt<std::string>
Andrew Trickb826ae82011-04-05 18:41:31 +0000183DefaultDataLayout("default-data-layout",
Chris Lattnercfa19112009-10-22 00:44:10 +0000184 cl::desc("data layout string to use if not specified by module"),
185 cl::value_desc("layout-string"), cl::init(""));
186
Reid Spencer378f7d52006-08-18 06:34:30 +0000187namespace {
188
Devang Patel0abc4632011-04-04 19:51:17 +0000189struct BreakpointPrinter : public ModulePass {
Devang Patel786a05e2010-12-07 00:33:43 +0000190 raw_ostream &Out;
191 static char ID;
Manman Ren116868e2013-09-09 19:47:11 +0000192 DITypeIdentifierMap TypeIdentifierMap;
Devang Patel786a05e2010-12-07 00:33:43 +0000193
194 BreakpointPrinter(raw_ostream &out)
Devang Patel0abc4632011-04-04 19:51:17 +0000195 : ModulePass(ID), Out(out) {
Devang Patel786a05e2010-12-07 00:33:43 +0000196 }
197
Devang Patel0abc4632011-04-04 19:51:17 +0000198 void getContextName(DIDescriptor Context, std::string &N) {
199 if (Context.isNameSpace()) {
200 DINameSpace NS(Context);
201 if (!NS.getName().empty()) {
202 getContextName(NS.getContext(), N);
203 N = N + NS.getName().str() + "::";
Devang Patelb07ec832011-01-31 21:36:24 +0000204 }
Devang Patel0abc4632011-04-04 19:51:17 +0000205 } else if (Context.isType()) {
206 DIType TY(Context);
207 if (!TY.getName().empty()) {
Manman Ren116868e2013-09-09 19:47:11 +0000208 getContextName(TY.getContext().resolve(TypeIdentifierMap), N);
Devang Patel0abc4632011-04-04 19:51:17 +0000209 N = N + TY.getName().str() + "::";
210 }
211 }
212 }
213
214 virtual bool runOnModule(Module &M) {
Manman Ren116868e2013-09-09 19:47:11 +0000215 TypeIdentifierMap.clear();
216 NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
217 if (CU_Nodes)
218 TypeIdentifierMap = generateDITypeIdentifierMap(CU_Nodes);
219
Devang Patel0abc4632011-04-04 19:51:17 +0000220 StringSet<> Processed;
221 if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.sp"))
222 for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
223 std::string Name;
224 DISubprogram SP(NMD->getOperand(i));
Manman Ren983a16c2013-06-28 05:43:10 +0000225 assert((!SP || SP.isSubprogram()) &&
226 "A MDNode in llvm.dbg.sp should be null or a DISubprogram.");
227 if (!SP)
228 continue;
Manman Renc50fa112013-10-10 18:40:01 +0000229 getContextName(SP.getContext().resolve(TypeIdentifierMap), Name);
Devang Patel0abc4632011-04-04 19:51:17 +0000230 Name = Name + SP.getDisplayName().str();
231 if (!Name.empty() && Processed.insert(Name)) {
232 Out << Name << "\n";
233 }
234 }
Devang Patel786a05e2010-12-07 00:33:43 +0000235 return false;
236 }
237
238 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
239 AU.setPreservesAll();
240 }
241};
Greg Bedwell1411aeb2013-10-09 08:55:27 +0000242
Chris Lattner3d70add2011-05-22 00:21:33 +0000243} // anonymous namespace
Devang Patel786a05e2010-12-07 00:33:43 +0000244
245char BreakpointPrinter::ID = 0;
246
Chris Lattner3d70add2011-05-22 00:21:33 +0000247static inline void addPass(PassManagerBase &PM, Pass *P) {
Reid Spencer22dbfb62007-02-02 14:46:29 +0000248 // Add the pass to the pass manager...
249 PM.add(P);
250
251 // If we are verifying all of the intermediate steps, add the verifier...
252 if (VerifyEach) PM.add(createVerifierPass());
253}
254
Eric Christophere64061f2009-08-21 23:29:40 +0000255/// AddOptimizationPasses - This routine adds optimization passes
256/// based on selected optimization level, OptLevel. This routine
Devang Patel9966ccf2008-09-16 22:25:14 +0000257/// duplicates llvm-gcc behaviour.
258///
259/// OptLevel - Optimization Level
Chris Lattner3d70add2011-05-22 00:21:33 +0000260static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM,
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000261 unsigned OptLevel, unsigned SizeLevel) {
Duncan Sands0f19e912011-12-07 17:14:20 +0000262 FPM.add(createVerifierPass()); // Verify that input is correct
263
Chris Lattner3d70add2011-05-22 00:21:33 +0000264 PassManagerBuilder Builder;
265 Builder.OptLevel = OptLevel;
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000266 Builder.SizeLevel = SizeLevel;
Devang Patel9966ccf2008-09-16 22:25:14 +0000267
Eli Friedmaneb0c52f2010-01-18 22:38:31 +0000268 if (DisableInline) {
269 // No inlining pass
Eli Friedmanb68fe252011-06-06 22:13:27 +0000270 } else if (OptLevel > 1) {
Jakob Stoklund Olesen1d73c0e2010-11-02 23:40:28 +0000271 unsigned Threshold = 225;
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000272 if (SizeLevel == 1) // -Os
273 Threshold = 75;
274 else if (SizeLevel == 2) // -Oz
275 Threshold = 25;
Eli Friedmaneb0c52f2010-01-18 22:38:31 +0000276 if (OptLevel > 2)
Jakob Stoklund Olesen1d73c0e2010-11-02 23:40:28 +0000277 Threshold = 275;
Chris Lattner3d70add2011-05-22 00:21:33 +0000278 Builder.Inliner = createFunctionInliningPass(Threshold);
Eli Friedmaneb0c52f2010-01-18 22:38:31 +0000279 } else {
Chris Lattner3d70add2011-05-22 00:21:33 +0000280 Builder.Inliner = createAlwaysInlinerPass();
Eli Friedmaneb0c52f2010-01-18 22:38:31 +0000281 }
Chris Lattner3d70add2011-05-22 00:21:33 +0000282 Builder.DisableUnitAtATime = !UnitAtATime;
Hal Finkel6d099042013-08-28 18:33:10 +0000283 Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ?
284 DisableLoopUnrolling : OptLevel == 0;
Greg Bedwell1411aeb2013-10-09 08:55:27 +0000285
Renato Golin729a3ae2013-12-05 21:20:02 +0000286 // This is final, unless there is a #pragma vectorize enable
287 if (DisableLoopVectorization)
288 Builder.LoopVectorize = false;
289 // If option wasn't forced via cmd line (-vectorize-loops, -loop-vectorize)
290 else if (!Builder.LoopVectorize)
291 Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2;
292
293 // When #pragma vectorize is on for SLP, do the same as above
Arnold Schwaighofer46db7252013-12-03 16:33:06 +0000294 Builder.SLPVectorize =
295 DisableSLPVectorization ? false : OptLevel > 1 && SizeLevel < 2;
Hal Finkel6d099042013-08-28 18:33:10 +0000296
Chris Lattner3d70add2011-05-22 00:21:33 +0000297 Builder.populateFunctionPassManager(FPM);
298 Builder.populateModulePassManager(MPM);
Devang Patel9966ccf2008-09-16 22:25:14 +0000299}
300
Chris Lattner3d70add2011-05-22 00:21:33 +0000301static void AddStandardCompilePasses(PassManagerBase &PM) {
Reid Spencer22dbfb62007-02-02 14:46:29 +0000302 PM.add(createVerifierPass()); // Verify that input is correct
303
Reid Spencer22dbfb62007-02-02 14:46:29 +0000304 // If the -strip-debug command line option was specified, do it.
305 if (StripDebug)
306 addPass(PM, createStripSymbolsPass(true));
307
308 if (DisableOptimizations) return;
309
Daniel Dunbar94c7b792009-06-03 18:22:15 +0000310 // -std-compile-opts adds the same module passes as -O3.
Chris Lattner3d70add2011-05-22 00:21:33 +0000311 PassManagerBuilder Builder;
312 if (!DisableInline)
313 Builder.Inliner = createFunctionInliningPass();
314 Builder.OptLevel = 3;
Chris Lattner3d70add2011-05-22 00:21:33 +0000315 Builder.populateModulePassManager(PM);
Reid Spencer22dbfb62007-02-02 14:46:29 +0000316}
317
Chris Lattner3d70add2011-05-22 00:21:33 +0000318static void AddStandardLinkPasses(PassManagerBase &PM) {
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000319 PM.add(createVerifierPass()); // Verify that input is correct
320
321 // If the -strip-debug command line option was specified, do it.
322 if (StripDebug)
323 addPass(PM, createStripSymbolsPass(true));
324
325 if (DisableOptimizations) return;
326
Chris Lattner3d70add2011-05-22 00:21:33 +0000327 PassManagerBuilder Builder;
328 Builder.populateLTOPassManager(PM, /*Internalize=*/ !DisableInternalize,
329 /*RunInliner=*/ !DisableInline);
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000330}
331
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000332//===----------------------------------------------------------------------===//
333// CodeGen-related helper functions.
334//
335static TargetOptions GetTargetOptions() {
336 TargetOptions Options;
337 Options.LessPreciseFPMADOption = EnableFPMAD;
338 Options.NoFramePointerElim = DisableFPElim;
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000339 Options.AllowFPOpFusion = FuseFPOps;
340 Options.UnsafeFPMath = EnableUnsafeFPMath;
341 Options.NoInfsFPMath = EnableNoInfsFPMath;
342 Options.NoNaNsFPMath = EnableNoNaNsFPMath;
343 Options.HonorSignDependentRoundingFPMathOption =
344 EnableHonorSignDependentRoundingFPMath;
345 Options.UseSoftFloat = GenerateSoftFloatCalls;
346 if (FloatABIForCalls != FloatABI::Default)
347 Options.FloatABIType = FloatABIForCalls;
348 Options.NoZerosInBSS = DontPlaceZerosInBSS;
349 Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt;
350 Options.DisableTailCalls = DisableTailCalls;
351 Options.StackAlignmentOverride = OverrideStackAlignment;
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000352 Options.TrapFuncName = TrapFuncName;
353 Options.PositionIndependentExecutable = EnablePIE;
354 Options.EnableSegmentedStacks = SegmentedStacks;
355 Options.UseInitArray = UseInitArray;
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000356 return Options;
357}
358
359CodeGenOpt::Level GetCodeGenOptLevel() {
360 if (OptLevelO1)
361 return CodeGenOpt::Less;
362 if (OptLevelO2)
363 return CodeGenOpt::Default;
364 if (OptLevelO3)
365 return CodeGenOpt::Aggressive;
366 return CodeGenOpt::None;
367}
368
369// Returns the TargetMachine instance or zero if no triple is provided.
Nadav Rotemb1615b12013-01-01 08:00:32 +0000370static TargetMachine* GetTargetMachine(Triple TheTriple) {
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000371 std::string Error;
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000372 const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple,
373 Error);
Nadav Rotemb1615b12013-01-01 08:00:32 +0000374 // Some modules don't specify a triple, and this is okay.
Eric Christopher13637e92013-04-15 07:31:37 +0000375 if (!TheTarget) {
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000376 return 0;
Eric Christopher13637e92013-04-15 07:31:37 +0000377 }
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000378
379 // Package up features to be passed to target/subtarget
380 std::string FeaturesStr;
381 if (MAttrs.size()) {
382 SubtargetFeatures Features;
383 for (unsigned i = 0; i != MAttrs.size(); ++i)
384 Features.AddFeature(MAttrs[i]);
385 FeaturesStr = Features.getString();
386 }
387
388 return TheTarget->createTargetMachine(TheTriple.getTriple(),
389 MCPU, FeaturesStr, GetTargetOptions(),
390 RelocModel, CMModel,
391 GetCodeGenOptLevel());
392}
Chris Lattner4db2f2c2002-02-01 04:54:11 +0000393
Chris Lattner5a48a242002-07-23 18:12:22 +0000394//===----------------------------------------------------------------------===//
395// main for opt
396//
Chris Lattner2f7c9632001-06-06 20:29:01 +0000397int main(int argc, char **argv) {
Chris Lattner4b2a6e22009-12-09 00:41:28 +0000398 sys::PrintStackTraceOnErrorSignal();
399 llvm::PrettyStackTraceProgram X(argc, argv);
Dan Gohmana2233f22010-09-01 14:20:41 +0000400
David Greeneed8a1de2010-01-05 01:30:32 +0000401 // Enable debug stream buffering.
402 EnableDebugBuffering = true;
403
Chris Lattner4b2a6e22009-12-09 00:41:28 +0000404 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
Owen Anderson19251ec2009-07-15 22:16:10 +0000405 LLVMContext &Context = getGlobalContext();
Andrew Trickb826ae82011-04-05 18:41:31 +0000406
Nadav Rotemac9a3442012-10-24 17:23:50 +0000407 InitializeAllTargets();
408 InitializeAllTargetMCs();
Nadav Rotemac9a3442012-10-24 17:23:50 +0000409
Owen Anderson6c18d1a2010-10-19 17:21:58 +0000410 // Initialize passes
411 PassRegistry &Registry = *PassRegistry::getPassRegistry();
412 initializeCore(Registry);
Daniel Malea3c5bed12013-05-08 20:44:14 +0000413 initializeDebugIRPass(Registry);
Owen Anderson6c18d1a2010-10-19 17:21:58 +0000414 initializeScalarOpts(Registry);
Michael Gottesman79d8d812013-01-28 01:35:51 +0000415 initializeObjCARCOpts(Registry);
Hal Finkelc34e5112012-02-01 03:51:43 +0000416 initializeVectorization(Registry);
Owen Anderson6c18d1a2010-10-19 17:21:58 +0000417 initializeIPO(Registry);
418 initializeAnalysis(Registry);
419 initializeIPA(Registry);
420 initializeTransformUtils(Registry);
421 initializeInstCombine(Registry);
422 initializeInstrumentation(Registry);
423 initializeTarget(Registry);
Andrew Trickb826ae82011-04-05 18:41:31 +0000424
Chris Lattnercc815262009-10-22 00:46:41 +0000425 cl::ParseCommandLineOptions(argc, argv,
426 "llvm .bc -> .bc modular optimizer and analysis printer\n");
Chris Lattnerc90d6ba2002-01-31 00:47:12 +0000427
Tobias Grosser083379f2010-12-02 20:35:16 +0000428 if (AnalyzeOnly && NoOutput) {
429 errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
430 return 1;
431 }
432
Chris Lattnercc815262009-10-22 00:46:41 +0000433 SMDiagnostic Err;
Vikram S. Adve82491b72002-09-16 16:09:43 +0000434
Chris Lattnercc815262009-10-22 00:46:41 +0000435 // Load the input module...
Andy Gibbs95777552013-04-12 10:56:28 +0000436 OwningPtr<Module> M;
Chris Lattnercc815262009-10-22 00:46:41 +0000437 M.reset(ParseIRFile(InputFilename, Err, Context));
Eric Christophere64061f2009-08-21 23:29:40 +0000438
Chris Lattnercc815262009-10-22 00:46:41 +0000439 if (M.get() == 0) {
Chris Lattnera3a06812011-10-16 04:47:35 +0000440 Err.print(argv[0], errs());
Chris Lattnercc815262009-10-22 00:46:41 +0000441 return 1;
442 }
443
Joe Groff1b738692012-04-17 23:05:48 +0000444 // If we are supposed to override the target triple, do so now.
Eric Christopher13637e92013-04-15 07:31:37 +0000445 if (!TargetTriple.empty())
Joe Groff1b738692012-04-17 23:05:48 +0000446 M->setTargetTriple(Triple::normalize(TargetTriple));
Eric Christopher1f140312013-04-14 23:35:36 +0000447
Chris Lattnercc815262009-10-22 00:46:41 +0000448 // Figure out what stream we are supposed to write to...
Dan Gohman268b0f42010-08-20 01:07:01 +0000449 OwningPtr<tool_output_file> Out;
Dan Gohman083330a2010-08-18 17:42:59 +0000450 if (NoOutput) {
Dan Gohmanb01aed12010-08-18 17:40:10 +0000451 if (!OutputFilename.empty())
452 errs() << "WARNING: The -o (output filename) option is ignored when\n"
Dan Gohman083330a2010-08-18 17:42:59 +0000453 "the --disable-output option is used.\n";
Dan Gohmanb01aed12010-08-18 17:40:10 +0000454 } else {
455 // Default to standard output.
456 if (OutputFilename.empty())
457 OutputFilename = "-";
Chris Lattnercc815262009-10-22 00:46:41 +0000458
Dan Gohmanb01aed12010-08-18 17:40:10 +0000459 std::string ErrorInfo;
Dan Gohman268b0f42010-08-20 01:07:01 +0000460 Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
Rafael Espindola6d354812013-07-16 19:44:17 +0000461 sys::fs::F_Binary));
Dan Gohmanb01aed12010-08-18 17:40:10 +0000462 if (!ErrorInfo.empty()) {
463 errs() << ErrorInfo << '\n';
Dan Gohmanb01aed12010-08-18 17:40:10 +0000464 return 1;
Chris Lattner2f7c9632001-06-06 20:29:01 +0000465 }
Chris Lattnercc815262009-10-22 00:46:41 +0000466 }
Chris Lattnerc065ad82002-04-18 19:55:25 +0000467
Chris Lattnercc815262009-10-22 00:46:41 +0000468 // If the output is set to be emitted to standard out, and standard out is a
469 // console, print out a warning message and refuse to do it. We don't
470 // impress anyone by spewing tons of binary goo to a terminal.
Dan Gohman915ad962010-01-17 17:47:24 +0000471 if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
Dan Gohmana2233f22010-09-01 14:20:41 +0000472 if (CheckBitcodeOutputToConsole(Out->os(), !Quiet))
Chris Lattnercc815262009-10-22 00:46:41 +0000473 NoOutput = true;
Dan Gohmane5929232009-09-11 20:46:33 +0000474
Chandler Carruth949282e2014-01-13 03:08:40 +0000475 if (PassPipeline.getNumOccurrences() > 0) {
476 OutputKind OK = OK_NoOutput;
477 if (!NoOutput)
478 OK = OutputAssembly ? OK_OutputAssembly : OK_OutputBitcode;
479
Chandler Carruth4d356312014-01-20 11:34:08 +0000480 VerifierKind VK = VK_VerifyInAndOut;
481 if (NoVerify)
482 VK = VK_NoVerifier;
483 else if (VerifyEach)
484 VK = VK_VerifyEachPass;
485
Chandler Carruth66445382014-01-11 08:16:35 +0000486 // The user has asked to use the new pass manager and provided a pipeline
487 // string. Hand off the rest of the functionality to the new code for that
488 // layer.
489 return runPassPipeline(argv[0], Context, *M.get(), Out.get(), PassPipeline,
Chandler Carruth4d356312014-01-20 11:34:08 +0000490 OK, VK)
Chandler Carruth66445382014-01-11 08:16:35 +0000491 ? 0
492 : 1;
Chandler Carruth949282e2014-01-13 03:08:40 +0000493 }
Chandler Carruth66445382014-01-11 08:16:35 +0000494
Chris Lattnercc815262009-10-22 00:46:41 +0000495 // Create a PassManager to hold and optimize the collection of passes we are
Chris Lattner15c8b5e2011-02-18 22:13:01 +0000496 // about to build.
Chris Lattnercc815262009-10-22 00:46:41 +0000497 //
498 PassManager Passes;
Chris Lattner2f7c9632001-06-06 20:29:01 +0000499
Chris Lattner15c8b5e2011-02-18 22:13:01 +0000500 // Add an appropriate TargetLibraryInfo pass for the module's triple.
Chris Lattner1341df92011-02-18 22:34:03 +0000501 TargetLibraryInfo *TLI = new TargetLibraryInfo(Triple(M->getTargetTriple()));
Andrew Trickb826ae82011-04-05 18:41:31 +0000502
Chris Lattner1341df92011-02-18 22:34:03 +0000503 // The -disable-simplify-libcalls flag actually disables all builtin optzns.
504 if (DisableSimplifyLibCalls)
505 TLI->disableAllFunctions();
506 Passes.add(TLI);
Andrew Trickb826ae82011-04-05 18:41:31 +0000507
Eric Christopher13637e92013-04-15 07:31:37 +0000508 // Add an appropriate DataLayout instance for this module.
509 DataLayout *TD = 0;
510 const std::string &ModuleDataLayout = M.get()->getDataLayout();
511 if (!ModuleDataLayout.empty())
512 TD = new DataLayout(ModuleDataLayout);
513 else if (!DefaultDataLayout.empty())
514 TD = new DataLayout(DefaultDataLayout);
515
Chris Lattnercc815262009-10-22 00:46:41 +0000516 if (TD)
Eric Christopher13637e92013-04-15 07:31:37 +0000517 Passes.add(TD);
Reid Spencer996ec722004-12-30 05:36:08 +0000518
Nadav Rotemb1615b12013-01-01 08:00:32 +0000519 Triple ModuleTriple(M->getTargetTriple());
520 TargetMachine *Machine = 0;
521 if (ModuleTriple.getArch())
522 Machine = GetTargetMachine(Triple(ModuleTriple));
Andy Gibbs95777552013-04-12 10:56:28 +0000523 OwningPtr<TargetMachine> TM(Machine);
Nadav Rotemb1615b12013-01-01 08:00:32 +0000524
Chandler Carruth664e3542013-01-07 01:37:14 +0000525 // Add internal analysis passes from the target machine.
526 if (TM.get())
527 TM->addAnalysisPasses(Passes);
Nadav Rotem5dc203e2012-10-18 23:22:48 +0000528
Chris Lattner3d70add2011-05-22 00:21:33 +0000529 OwningPtr<FunctionPassManager> FPasses;
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000530 if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
Chris Lattner3d70add2011-05-22 00:21:33 +0000531 FPasses.reset(new FunctionPassManager(M.get()));
Chris Lattnercfa19112009-10-22 00:44:10 +0000532 if (TD)
Micah Villmow9cfc13d2012-10-08 16:39:34 +0000533 FPasses->add(new DataLayout(*TD));
Tom Stellard8b1e0212013-07-27 00:01:07 +0000534 if (TM.get())
535 TM->addAnalysisPasses(*FPasses);
536
Chris Lattnercc815262009-10-22 00:46:41 +0000537 }
Reid Spencer996ec722004-12-30 05:36:08 +0000538
Devang Patel786a05e2010-12-07 00:33:43 +0000539 if (PrintBreakpoints) {
540 // Default to standard output.
541 if (!Out) {
542 if (OutputFilename.empty())
543 OutputFilename = "-";
Andrew Trickb826ae82011-04-05 18:41:31 +0000544
Devang Patel786a05e2010-12-07 00:33:43 +0000545 std::string ErrorInfo;
546 Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
Rafael Espindola6d354812013-07-16 19:44:17 +0000547 sys::fs::F_Binary));
Devang Patel786a05e2010-12-07 00:33:43 +0000548 if (!ErrorInfo.empty()) {
549 errs() << ErrorInfo << '\n';
550 return 1;
551 }
552 }
553 Passes.add(new BreakpointPrinter(Out->os()));
554 NoOutput = true;
555 }
556
Chris Lattnercc815262009-10-22 00:46:41 +0000557 // If the -strip-debug command line option was specified, add it. If
558 // -std-compile-opts was also specified, it will handle StripDebug.
559 if (StripDebug && !StandardCompileOpts)
560 addPass(Passes, createStripSymbolsPass(true));
Eric Christophere64061f2009-08-21 23:29:40 +0000561
Chris Lattnercc815262009-10-22 00:46:41 +0000562 // Create a new optimization pass for each one specified on the command line
563 for (unsigned i = 0; i < PassList.size(); ++i) {
564 // Check to see if -std-compile-opts was specified before this option. If
565 // so, handle it.
566 if (StandardCompileOpts &&
567 StandardCompileOpts.getPosition() < PassList.getPosition(i)) {
Chris Lattner501c3b62008-07-13 19:35:21 +0000568 AddStandardCompilePasses(Passes);
569 StandardCompileOpts = false;
Eric Christophere64061f2009-08-21 23:29:40 +0000570 }
Reid Spencer996ec722004-12-30 05:36:08 +0000571
Chris Lattnercc815262009-10-22 00:46:41 +0000572 if (StandardLinkOpts &&
573 StandardLinkOpts.getPosition() < PassList.getPosition(i)) {
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000574 AddStandardLinkPasses(Passes);
575 StandardLinkOpts = false;
Eric Christophere64061f2009-08-21 23:29:40 +0000576 }
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000577
Chris Lattnercc815262009-10-22 00:46:41 +0000578 if (OptLevelO1 && OptLevelO1.getPosition() < PassList.getPosition(i)) {
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000579 AddOptimizationPasses(Passes, *FPasses, 1, 0);
Chris Lattnercc815262009-10-22 00:46:41 +0000580 OptLevelO1 = false;
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000581 }
Devang Patel9966ccf2008-09-16 22:25:14 +0000582
Chris Lattnercc815262009-10-22 00:46:41 +0000583 if (OptLevelO2 && OptLevelO2.getPosition() < PassList.getPosition(i)) {
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000584 AddOptimizationPasses(Passes, *FPasses, 2, 0);
Chris Lattnercc815262009-10-22 00:46:41 +0000585 OptLevelO2 = false;
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000586 }
Devang Patel9966ccf2008-09-16 22:25:14 +0000587
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000588 if (OptLevelOs && OptLevelOs.getPosition() < PassList.getPosition(i)) {
589 AddOptimizationPasses(Passes, *FPasses, 2, 1);
590 OptLevelOs = false;
591 }
592
593 if (OptLevelOz && OptLevelOz.getPosition() < PassList.getPosition(i)) {
594 AddOptimizationPasses(Passes, *FPasses, 2, 2);
595 OptLevelOz = false;
596 }
597
Chris Lattnercc815262009-10-22 00:46:41 +0000598 if (OptLevelO3 && OptLevelO3.getPosition() < PassList.getPosition(i)) {
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000599 AddOptimizationPasses(Passes, *FPasses, 3, 0);
Chris Lattnercc815262009-10-22 00:46:41 +0000600 OptLevelO3 = false;
Daniel Dunbar41f9a3a2009-07-17 18:09:39 +0000601 }
Devang Patel9966ccf2008-09-16 22:25:14 +0000602
Chris Lattnercc815262009-10-22 00:46:41 +0000603 const PassInfo *PassInf = PassList[i];
604 Pass *P = 0;
Quentin Colombetdc0b2ea2014-01-16 21:44:34 +0000605 if (PassInf->getTargetMachineCtor())
606 P = PassInf->getTargetMachineCtor()(TM.get());
607 else if (PassInf->getNormalCtor())
Chris Lattnercc815262009-10-22 00:46:41 +0000608 P = PassInf->getNormalCtor()();
609 else
610 errs() << argv[0] << ": cannot create pass: "
611 << PassInf->getPassName() << "\n";
612 if (P) {
Benjamin Kramer32c3d302010-02-18 12:57:05 +0000613 PassKind Kind = P->getPassKind();
Chris Lattnercc815262009-10-22 00:46:41 +0000614 addPass(Passes, P);
615
616 if (AnalyzeOnly) {
Benjamin Kramer32c3d302010-02-18 12:57:05 +0000617 switch (Kind) {
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000618 case PT_BasicBlock:
Eli Benderskyb60f8382014-02-10 23:34:23 +0000619 Passes.add(createBasicBlockPassPrinter(PassInf, Out->os(), Quiet));
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000620 break;
Tobias Grosser23c83412010-10-20 01:54:44 +0000621 case PT_Region:
Eli Benderskyb60f8382014-02-10 23:34:23 +0000622 Passes.add(createRegionPassPrinter(PassInf, Out->os(), Quiet));
Tobias Grosser23c83412010-10-20 01:54:44 +0000623 break;
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000624 case PT_Loop:
Eli Benderskyb60f8382014-02-10 23:34:23 +0000625 Passes.add(createLoopPassPrinter(PassInf, Out->os(), Quiet));
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000626 break;
627 case PT_Function:
Eli Benderskyb60f8382014-02-10 23:34:23 +0000628 Passes.add(createFunctionPassPrinter(PassInf, Out->os(), Quiet));
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000629 break;
630 case PT_CallGraphSCC:
Eli Benderskyb60f8382014-02-10 23:34:23 +0000631 Passes.add(createCallGraphPassPrinter(PassInf, Out->os(), Quiet));
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000632 break;
633 default:
Eli Benderskyb60f8382014-02-10 23:34:23 +0000634 Passes.add(createModulePassPrinter(PassInf, Out->os(), Quiet));
Chris Lattnerc7a8eaf2010-01-22 06:03:06 +0000635 break;
636 }
Chris Lattnercc815262009-10-22 00:46:41 +0000637 }
Devang Patel9966ccf2008-09-16 22:25:14 +0000638 }
639
Chris Lattnercc815262009-10-22 00:46:41 +0000640 if (PrintEachXForm)
Chandler Carruth9d805132014-01-12 11:30:46 +0000641 Passes.add(createPrintModulePass(errs()));
Chris Lattnerc90d6ba2002-01-31 00:47:12 +0000642 }
Chris Lattnercc815262009-10-22 00:46:41 +0000643
644 // If -std-compile-opts was specified at the end of the pass list, add them.
645 if (StandardCompileOpts) {
646 AddStandardCompilePasses(Passes);
647 StandardCompileOpts = false;
648 }
649
650 if (StandardLinkOpts) {
651 AddStandardLinkPasses(Passes);
652 StandardLinkOpts = false;
653 }
654
655 if (OptLevelO1)
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000656 AddOptimizationPasses(Passes, *FPasses, 1, 0);
Chris Lattnercc815262009-10-22 00:46:41 +0000657
658 if (OptLevelO2)
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000659 AddOptimizationPasses(Passes, *FPasses, 2, 0);
660
661 if (OptLevelOs)
662 AddOptimizationPasses(Passes, *FPasses, 2, 1);
663
664 if (OptLevelOz)
665 AddOptimizationPasses(Passes, *FPasses, 2, 2);
Chris Lattnercc815262009-10-22 00:46:41 +0000666
667 if (OptLevelO3)
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000668 AddOptimizationPasses(Passes, *FPasses, 3, 0);
Chris Lattnercc815262009-10-22 00:46:41 +0000669
Chandler Carruthd8c08c22012-05-16 08:32:49 +0000670 if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
Chris Lattneref8cf6d2011-05-22 06:44:19 +0000671 FPasses->doInitialization();
Chris Lattner3d70add2011-05-22 00:21:33 +0000672 for (Module::iterator F = M->begin(), E = M->end(); F != E; ++F)
673 FPasses->run(*F);
Chris Lattneref8cf6d2011-05-22 06:44:19 +0000674 FPasses->doFinalization();
675 }
Chris Lattnercc815262009-10-22 00:46:41 +0000676
677 // Check that the module is well formed on completion of optimization
678 if (!NoVerify && !VerifyEach)
679 Passes.add(createVerifierPass());
680
Dan Gohman083330a2010-08-18 17:42:59 +0000681 // Write bitcode or assembly to the output as the last step...
Chris Lattnercc815262009-10-22 00:46:41 +0000682 if (!NoOutput && !AnalyzeOnly) {
683 if (OutputAssembly)
Chandler Carruth9d805132014-01-12 11:30:46 +0000684 Passes.add(createPrintModulePass(Out->os()));
Chris Lattnercc815262009-10-22 00:46:41 +0000685 else
Dan Gohmana2233f22010-09-01 14:20:41 +0000686 Passes.add(createBitcodeWriterPass(Out->os()));
Chris Lattnercc815262009-10-22 00:46:41 +0000687 }
688
Andrew Trick12004012011-04-05 18:54:36 +0000689 // Before executing passes, print the final values of the LLVM options.
690 cl::PrintOptionValues();
691
Chris Lattnercc815262009-10-22 00:46:41 +0000692 // Now that we have all of the passes ready, run them.
693 Passes.run(*M.get());
694
Dan Gohman268b0f42010-08-20 01:07:01 +0000695 // Declare success.
Devang Patel786a05e2010-12-07 00:33:43 +0000696 if (!NoOutput || PrintBreakpoints)
Dan Gohman268b0f42010-08-20 01:07:01 +0000697 Out->keep();
698
Chris Lattnercc815262009-10-22 00:46:41 +0000699 return 0;
Chris Lattner2f7c9632001-06-06 20:29:01 +0000700}