Lines Matching +full:opt +full:- +full:out
1 //===- opt.cpp - The LLVM Modular Optimizer -------------------------------===//
8 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
67 // to run over the module. This flag switches opt to use the new pass manager
70 static cl::opt<std::string> PassPipeline(
77 static cl::opt<std::string>
79 cl::init("-"), cl::value_desc("filename"));
81 static cl::opt<std::string>
85 static cl::opt<bool>
88 static cl::opt<bool>
91 static cl::opt<bool>
92 NoOutput("disable-output",
95 static cl::opt<bool>
98 static cl::opt<bool>
99 NoVerify("disable-verify", cl::desc("Do not run the verifier"), cl::Hidden);
101 static cl::opt<bool>
102 VerifyEach("verify-each", cl::desc("Verify after each transform"));
104 static cl::opt<bool>
105 DisableDITypeMap("disable-debug-info-type-map",
108 static cl::opt<bool>
109 StripDebug("strip-debug",
112 static cl::opt<bool>
113 DisableInline("disable-inlining", cl::desc("Do not run the inliner pass"));
115 static cl::opt<bool>
116 DisableOptimizations("disable-opt",
119 static cl::opt<bool>
120 StandardLinkOpts("std-link-opts",
123 static cl::opt<bool>
125 cl::desc("Optimization level 1. Similar to clang -O1"));
127 static cl::opt<bool>
129 cl::desc("Optimization level 2. Similar to clang -O2"));
131 static cl::opt<bool>
133 cl::desc("Like -O2 with extra optimizations for size. Similar to clang -Os"));
135 static cl::opt<bool>
137 cl::desc("Like -Os but reduces code size further. Similar to clang -Oz"));
139 static cl::opt<bool>
141 cl::desc("Optimization level 3. Similar to clang -O3"));
143 static cl::opt<unsigned>
144 CodeGenOptLevel("codegen-opt-level",
147 static cl::opt<std::string>
150 static cl::opt<bool>
151 UnitAtATime("funit-at-a-time",
152 cl::desc("Enable IPO. This corresponds to gcc's -funit-at-a-time"),
155 static cl::opt<bool>
156 DisableLoopUnrolling("disable-loop-unrolling",
159 static cl::opt<bool>
160 DisableLoopVectorization("disable-loop-vectorization",
164 static cl::opt<bool>
165 DisableSLPVectorization("disable-slp-vectorization",
169 static cl::opt<bool> EmitSummaryIndex("module-summary",
173 static cl::opt<bool> EmitModuleHash("module-hash", cl::desc("Emit module hash"),
176 static cl::opt<bool>
177 DisableSimplifyLibCalls("disable-simplify-libcalls",
178 cl::desc("Disable simplify-libcalls"));
180 static cl::opt<bool>
184 QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet));
186 static cl::opt<bool>
189 static cl::opt<bool>
190 PrintBreakpoints("print-breakpoints-for-testing",
193 static cl::opt<std::string>
194 DefaultDataLayout("default-data-layout",
196 cl::value_desc("layout-string"), cl::init(""));
198 static cl::opt<bool> PreserveBitcodeUseListOrder(
199 "preserve-bc-uselistorder",
200 cl::desc("Preserve use-list order when writing LLVM bitcode."),
203 static cl::opt<bool> PreserveAssemblyUseListOrder(
204 "preserve-ll-uselistorder",
205 cl::desc("Preserve use-list order when writing LLVM assembly."),
208 static cl::opt<bool>
209 RunTwice("run-twice",
210 cl::desc("Run all passes twice, re-using the same pass manager."),
213 static cl::opt<bool> DiscardValueNames(
214 "discard-value-names",
230 /// OptLevel - Optimization Level
256 // If option wasn't forced via cmd line (-vectorize-loops, -loop-vectorize) in AddOptimizationPasses()
264 // Add target-specific passes that need to run as early as possible. in AddOptimizationPasses()
269 TM->addEarlyAsPossiblePasses(PM); in AddOptimizationPasses()
287 //===----------------------------------------------------------------------===//
288 // CodeGen-related helper functions.
315 return TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, in GetTargetMachine()
326 //===----------------------------------------------------------------------===//
327 // main for opt
374 "llvm .bc -> .bc modular optimizer and analysis printer\n"); in main()
377 errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n"; in main()
410 M->setTargetTriple(Triple::normalize(TargetTriple)); in main()
412 // Figure out what stream we are supposed to write to... in main()
413 std::unique_ptr<tool_output_file> Out; in main() local
416 errs() << "WARNING: The -o (output filename) option is ignored when\n" in main()
417 "the --disable-output option is used.\n"; in main()
421 OutputFilename = "-"; in main()
424 Out.reset(new tool_output_file(OutputFilename, EC, sys::fs::F_None)); in main()
431 Triple ModuleTriple(M->getTargetTriple()); in main()
448 // If the output is set to be emitted to standard out, and standard out is a in main()
449 // console, print out a warning message and refuse to do it. We don't in main()
452 if (CheckBitcodeOutputToConsole(Out->os(), !Quiet)) in main()
469 return runPassPipeline(argv[0], Context, *M, TM.get(), Out.get(), in main()
484 // The -disable-simplify-libcalls flag actually disables all builtin optzns. in main()
490 const DataLayout &DL = M->getDataLayout(); in main()
492 M->setDataLayout(DefaultDataLayout); in main()
496 Passes.add(createTargetTransformInfoWrapperPass(TM ? TM->getTargetIRAnalysis() in main()
502 FPasses->add(createTargetTransformInfoWrapperPass( in main()
503 TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())); in main()
508 if (!Out) { in main()
510 OutputFilename = "-"; in main()
513 Out = llvm::make_unique<tool_output_file>(OutputFilename, EC, in main()
520 Passes.add(createBreakpointPrinter(Out->os())); in main()
559 if (PassInf->getTargetMachineCtor()) in main()
560 P = PassInf->getTargetMachineCtor()(TM.get()); in main()
561 else if (PassInf->getNormalCtor()) in main()
562 P = PassInf->getNormalCtor()(); in main()
565 << PassInf->getPassName() << "\n"; in main()
567 PassKind Kind = P->getPassKind(); in main()
573 Passes.add(createBasicBlockPassPrinter(PassInf, Out->os(), Quiet)); in main()
576 Passes.add(createRegionPassPrinter(PassInf, Out->os(), Quiet)); in main()
579 Passes.add(createLoopPassPrinter(PassInf, Out->os(), Quiet)); in main()
582 Passes.add(createFunctionPassPrinter(PassInf, Out->os(), Quiet)); in main()
585 Passes.add(createCallGraphPassPrinter(PassInf, Out->os(), Quiet)); in main()
588 Passes.add(createModulePassPrinter(PassInf, Out->os(), Quiet)); in main()
620 FPasses->doInitialization(); in main()
622 FPasses->run(F); in main()
623 FPasses->doFinalization(); in main()
630 // In run twice mode, we want to make sure the output is bit-by-bit in main()
633 // may be worth to abstract this out in the future. in main()
641 assert(Out); in main()
642 OS = &Out->os(); in main()
649 report_fatal_error("Text output is incompatible with -module-summary"); in main()
651 report_fatal_error("Text output is incompatible with -module-hash"); in main()
675 assert(Out); in main()
681 "To generate the one-run comparison binary, just run without\n" in main()
682 "the compile-twice option\n"; in main()
683 Out->os() << BOS->str(); in main()
684 Out->keep(); in main()
687 Out->os() << BOS->str(); in main()
692 Out->keep(); in main()