Lines Matching +full:docs +full:- +full:polly +full:- +full:html
1 //===- optdriver.cpp - The LLVM Modular Optimizer -------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // line, They are run in the order specified. Common driver library for re-use
11 // by potential downstream opt-variants.
13 //===----------------------------------------------------------------------===//
25 #include "llvm/Config/llvm-config.h"
71 "Optimizations available (use \"-passes=\" for the new pass manager)"));
74 "bugpoint-enable-legacy-pm",
88 "available before a certain pass, add \"require<foo-analysis>\"."));
90 cl::desc("Alias for -passes"));
92 static cl::opt<bool> PrintPasses("print-passes",
94 "specified in -passes=foo and exit"));
98 cl::init("-"),
107 static cl::opt<bool> NoOutput("disable-output",
115 OutputThinLTOBC("thinlto-bc",
116 cl::desc("Write output as ThinLTO-ready bitcode"));
119 SplitLTOUnit("thinlto-split-lto-unit",
123 UnifiedLTO("unified-lto",
124 cl::desc("Use unified LTO piplines. Ignored unless -thinlto-bc "
129 "thin-link-bitcode-file", cl::value_desc("filename"),
133 static cl::opt<bool> NoVerify("disable-verify",
136 static cl::opt<bool> NoUpgradeDebugInfo("disable-upgrade-debug-info",
140 static cl::opt<bool> VerifyEach("verify-each",
144 DisableDITypeMap("disable-debug-info-type-map",
148 StripDebug("strip-debug",
152 StripNamedMetadata("strip-named-metadata",
153 cl::desc("Strip module-level named metadata"));
156 OptLevelO0("O0", cl::desc("Optimization level 0. Similar to clang -O0. "
157 "Same as -passes=\"default<O0>\""));
160 OptLevelO1("O1", cl::desc("Optimization level 1. Similar to clang -O1. "
161 "Same as -passes=\"default<O1>\""));
164 OptLevelO2("O2", cl::desc("Optimization level 2. Similar to clang -O2. "
165 "Same as -passes=\"default<O2>\""));
168 OptLevelOs("Os", cl::desc("Like -O2 but size-conscious. Similar to clang "
169 "-Os. Same as -passes=\"default<Os>\""));
173 cl::desc("Like -O2 but optimize for code size above all else. Similar to "
174 "clang -Oz. Same as -passes=\"default<Oz>\""));
177 OptLevelO3("O3", cl::desc("Optimization level 3. Similar to clang -O3. "
178 "Same as -passes=\"default<O3>\""));
181 "codegen-opt-level",
187 static cl::opt<bool> EmitSummaryIndex("module-summary",
191 static cl::opt<bool> EmitModuleHash("module-hash", cl::desc("Emit module hash"),
195 DisableSimplifyLibCalls("disable-simplify-libcalls",
196 cl::desc("Disable simplify-libcalls"));
199 "disable-builtin",
203 "enable-debugify",
205 "Start the pipeline with debugify and end it with check-debugify"));
208 "verify-debuginfo-preserve",
212 static cl::opt<std::string> ClDataLayout("data-layout",
214 cl::value_desc("layout-string"),
218 "preserve-bc-uselistorder",
219 cl::desc("Preserve use-list order when writing LLVM bitcode."),
223 "preserve-ll-uselistorder",
224 cl::desc("Preserve use-list order when writing LLVM assembly."),
227 static cl::opt<bool> RunTwice("run-twice",
228 cl::desc("Run all passes twice, re-using the "
233 "discard-value-names",
237 static cl::opt<bool> TimeTrace("time-trace", cl::desc("Record time trace"));
240 "time-trace-granularity",
246 TimeTraceFile("time-trace-file",
251 "pass-remarks-with-hotness",
257 "pass-remarks-hotness-threshold",
264 RemarksFilename("pass-remarks-output",
269 RemarksPasses("pass-remarks-filter",
275 "pass-remarks-format",
280 PassPlugins("load-pass-plugin",
284 "try-experimental-debuginfo-iterators",
290 //===----------------------------------------------------------------------===//
291 // CodeGen-related helper functions.
316 // For use in NPM transition. Currently this contains most codegen-specific
322 "nvvm-reflect",
323 "nvvm-intr-range",
324 "amdgpu-simplifylib",
325 "amdgpu-image-intrinsic-opt",
326 "amdgpu-usenative",
327 "amdgpu-promote-alloca",
328 "amdgpu-promote-alloca-to-vector",
329 "amdgpu-lower-kernel-attributes",
330 "amdgpu-propagate-attributes-early",
331 "amdgpu-propagate-attributes-late",
332 "amdgpu-unify-metadata",
333 "amdgpu-printf-runtime-binding",
334 "amdgpu-always-inline"};
339 "x86-", "xcore-", "wasm-", "systemz-", "ppc-", "nvvm-",
340 "nvptx-", "mips-", "lanai-", "hexagon-", "bpf-", "avr-",
341 "thumb2-", "arm-", "si-", "gcn-", "amdgpu-", "aarch64-",
342 "amdgcn-", "polly-", "riscv-", "dxil-"};
343 static constexpr StringLiteral PassNameContain[] = {"-eh-prepare"};
345 "safe-stack",
346 "cost-model",
348 "interleaved-load-combine",
350 "verify-safepoint-ir",
351 "atomic-expand",
353 "mve-tail-predication",
354 "interleaved-access",
355 "global-merge",
356 "pre-isel-intrinsic-lowering",
357 "expand-reductions",
358 "indirectbr-expand",
359 "generic-to-nvvm",
360 "expand-memcmp",
361 "loop-reduce",
362 "lower-amx-type",
363 "lower-amx-intrinsics",
364 "polyhedral-info",
365 "print-polyhedral-info",
366 "replace-with-veclib",
367 "jmc-instrumenter",
368 "dot-regions",
369 "dot-regions-only",
370 "view-regions",
371 "view-regions-only",
372 "select-optimize",
373 "expand-large-div-rem",
375 "fix-irreducible",
376 "expand-large-fp-convert",
392 StringRef Arg = P->getPassArgument();
399 //===----------------------------------------------------------------------===//
460 // Register the Target and CPU printer for --version.
464 argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n");
466 // RemoveDIs debug-info transition: tests may request that we /try/ to use the
467 // new debug-info format.
469 // Turn the new debug-info format on.
480 errs() << "The `opt -passname` syntax for the new pass manager is "
481 "not supported, please use `opt -passes=<pipeline>` (or the `-p` "
483 errs() << "See https://llvm.org/docs/NewPassManager.html#invoking-opt "
522 StringRef IRLayout) -> std::optional<std::string> {
538 // user did not pass -mtriple or define an explicit triple/datalayout in
550 return (*ExpectedTM)->createDataLayout().getStringRepresentation();
570 // Erase module-level named metadata, if requested.
572 while (!M->named_metadata_empty()) {
573 NamedMDNode *NMD = &*M->named_metadata_begin();
574 M->eraseNamedMetadata(NMD);
580 M->setTargetTriple(Triple::normalize(TargetTriple));
609 errs() << "WARNING: The -o (output filename) option is ignored when\n"
610 "the --disable-output option is used.\n";
614 OutputFilename = "-";
635 Triple ModuleTriple(M->getTargetTriple());
665 if (CheckBitcodeOutputToConsole(Out->os()))
669 M->addModuleFlag(Module::Error, "EnableSplitLTOUnit", SplitLTOUnit);
671 M->addModuleFlag(Module::Error, "UnifiedLTO", 1);
677 // The -disable-simplify-libcalls flag actually disables all builtin optzns.
695 errs() << "-debug-pass does not work with the new PM, either use "
696 "-debug-pass-manager, or use the legacy PM\n";
702 errs() << "Cannot specify multiple -O#\n";
706 errs() << "Cannot specify -O# and --passes=/--foo-pass, use "
707 "-passes='default<O#>,other-pass'\n";
751 errs() << "Cannot use -O# with legacy PM.\n";
755 errs() << "Cannot use -module-summary with legacy PM.\n";
759 errs() << "Cannot use -module-hash with legacy PM.\n";
763 errs() << "Cannot use -thinlto-bc with legacy PM.\n";
767 // about to build. If the -debugify-each option is set, wrap each pass with
768 // the (-check)-debugify passes.
789 Passes.add(createTargetTransformInfoWrapperPass(TM ? TM->getTargetIRAnalysis()
804 Pass *TPC = TM->createPassConfig(Passes);
815 if (PassInf->getNormalCtor()) {
816 Pass *P = PassInf->getNormalCtor()();
825 errs() << argv[0] << ": cannot create pass: " << PassInf->getPassName()
845 // In run twice mode, we want to make sure the output is bit-by-bit
859 OS = &Out->os();
895 "To generate the one-run comparison binary, just run without\n"
896 "the compile-twice option\n";
898 Out->os() << BOS->str();
899 Out->keep();
902 RemarksFile->keep();
906 Out->os() << BOS->str();
914 Out->keep();
917 RemarksFile->keep();
920 ThinLinkOut->keep();