Polly  15.0.0git
RegisterPasses.cpp
Go to the documentation of this file.
1 //===------ RegisterPasses.cpp - Add the Polly Passes to default passes --===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file composes the individual LLVM-IR passes provided by Polly to a
10 // functional polyhedral optimizer. The polyhedral optimizer is automatically
11 // made available to LLVM based compilers by loading the Polly shared library
12 // into such a compiler.
13 //
14 // The Polly optimizer is made available by executing a static constructor that
15 // registers the individual Polly passes in the LLVM pass manager builder. The
16 // passes are registered such that the default behaviour of the compiler is not
17 // changed, but that the flag '-polly' provided at optimization level '-O3'
18 // enables additional polyhedral optimizations.
19 //===----------------------------------------------------------------------===//
20 
21 #include "polly/RegisterPasses.h"
22 #include "polly/Canonicalization.h"
25 #include "polly/CodeGen/IslAst.h"
26 #include "polly/CodePreparation.h"
27 #include "polly/DeLICM.h"
29 #include "polly/DependenceInfo.h"
30 #include "polly/ForwardOpTree.h"
31 #include "polly/JSONExporter.h"
32 #include "polly/LinkAllPasses.h"
33 #include "polly/PolyhedralInfo.h"
36 #include "polly/ScopDetection.h"
37 #include "polly/ScopGraphPrinter.h"
38 #include "polly/ScopInfo.h"
39 #include "polly/Simplify.h"
42 #include "llvm/Analysis/CFGPrinter.h"
43 #include "llvm/IR/LegacyPassManager.h"
44 #include "llvm/IR/PassManager.h"
45 #include "llvm/IR/Verifier.h"
46 #include "llvm/Passes/PassBuilder.h"
47 #include "llvm/Passes/PassPlugin.h"
48 #include "llvm/Support/CommandLine.h"
49 #include "llvm/Support/TargetSelect.h"
50 #include "llvm/Transforms/IPO.h"
51 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
52 
53 namespace cl = llvm::cl;
54 
55 using llvm::FunctionPassManager;
56 using llvm::OptimizationLevel;
57 using llvm::PassBuilder;
58 using llvm::PassInstrumentationCallbacks;
59 
60 cl::OptionCategory PollyCategory("Polly Options",
61  "Configure the polly loop optimizer");
62 
63 namespace polly {
64 static cl::opt<bool>
65  PollyEnabled("polly",
66  cl::desc("Enable the polly optimizer (with -O1, -O2 or -O3)"),
67  cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
68 
69 static cl::opt<bool> PollyDetectOnly(
70  "polly-only-scop-detection",
71  cl::desc("Only run scop detection, but no other optimizations"),
72  cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
73 
78 };
79 
81 
82 static cl::opt<PassPositionChoice> PassPosition(
83  "polly-position", cl::desc("Where to run polly in the pass pipeline"),
84  cl::values(
85  clEnumValN(POSITION_EARLY, "early", "Before everything"),
86  clEnumValN(POSITION_AFTER_LOOPOPT, "after-loopopt",
87  "After the loop optimizer (but within the inline cycle)"),
88  clEnumValN(POSITION_BEFORE_VECTORIZER, "before-vectorizer",
89  "Right before the vectorizer")),
90  cl::Hidden, cl::init(POSITION_BEFORE_VECTORIZER), cl::ZeroOrMore,
91  cl::cat(PollyCategory));
92 
93 static cl::opt<OptimizerChoice>
94  Optimizer("polly-optimizer", cl::desc("Select the scheduling optimizer"),
95  cl::values(clEnumValN(OPTIMIZER_NONE, "none", "No optimizer"),
96  clEnumValN(OPTIMIZER_ISL, "isl",
97  "The isl scheduling optimizer")),
98  cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore,
99  cl::cat(PollyCategory));
100 
102 static cl::opt<CodeGenChoice> CodeGeneration(
103  "polly-code-generation", cl::desc("How much code-generation to perform"),
104  cl::values(clEnumValN(CODEGEN_FULL, "full", "AST and IR generation"),
105  clEnumValN(CODEGEN_AST, "ast", "Only AST generation"),
106  clEnumValN(CODEGEN_NONE, "none", "No code generation")),
107  cl::Hidden, cl::init(CODEGEN_FULL), cl::ZeroOrMore, cl::cat(PollyCategory));
108 
110 static cl::opt<TargetChoice>
111  Target("polly-target", cl::desc("The hardware to target"),
112  cl::values(clEnumValN(TARGET_CPU, "cpu", "generate CPU code")
113 #ifdef GPU_CODEGEN
114  ,
115  clEnumValN(TARGET_GPU, "gpu", "generate GPU code"),
116  clEnumValN(TARGET_HYBRID, "hybrid",
117  "generate GPU code (preferably) or CPU code")
118 #endif
119  ),
120  cl::init(TARGET_CPU), cl::ZeroOrMore, cl::cat(PollyCategory));
121 
123 
124 static cl::opt<VectorizerChoice, true> Vectorizer(
125  "polly-vectorizer", cl::desc("Select the vectorization strategy"),
126  cl::values(
127  clEnumValN(VECTORIZER_NONE, "none", "No Vectorization"),
128  clEnumValN(VECTORIZER_POLLY, "polly", "Polly internal vectorizer"),
129  clEnumValN(
130  VECTORIZER_STRIPMINE, "stripmine",
131  "Strip-mine outer loops for the loop-vectorizer to trigger")),
133  cl::ZeroOrMore, cl::cat(PollyCategory));
134 
135 static cl::opt<bool> ImportJScop(
136  "polly-import",
137  cl::desc("Import the polyhedral description of the detected Scops"),
138  cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
139 
140 static cl::opt<bool> FullyIndexedStaticExpansion(
141  "polly-enable-mse",
142  cl::desc("Fully expand the memory accesses of the detected Scops"),
143  cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
144 
145 static cl::opt<bool> ExportJScop(
146  "polly-export",
147  cl::desc("Export the polyhedral description of the detected Scops"),
148  cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
149 
150 static cl::opt<bool> DeadCodeElim("polly-run-dce",
151  cl::desc("Run the dead code elimination"),
152  cl::Hidden, cl::init(false), cl::ZeroOrMore,
153  cl::cat(PollyCategory));
154 
155 static cl::opt<bool> PollyViewer(
156  "polly-show",
157  cl::desc("Highlight the code regions that will be optimized in a "
158  "(CFG BBs and LLVM-IR instructions)"),
159  cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
160 
161 static cl::opt<bool> PollyOnlyViewer(
162  "polly-show-only",
163  cl::desc("Highlight the code regions that will be optimized in "
164  "a (CFG only BBs)"),
165  cl::init(false), cl::cat(PollyCategory));
166 
167 static cl::opt<bool>
168  PollyPrinter("polly-dot", cl::desc("Enable the Polly DOT printer in -O3"),
169  cl::Hidden, cl::value_desc("Run the Polly DOT printer at -O3"),
170  cl::init(false), cl::cat(PollyCategory));
171 
172 static cl::opt<bool> PollyOnlyPrinter(
173  "polly-dot-only",
174  cl::desc("Enable the Polly DOT printer in -O3 (no BB content)"), cl::Hidden,
175  cl::value_desc("Run the Polly DOT printer at -O3 (no BB content"),
176  cl::init(false), cl::cat(PollyCategory));
177 
178 static cl::opt<bool>
179  CFGPrinter("polly-view-cfg",
180  cl::desc("Show the Polly CFG right after code generation"),
181  cl::Hidden, cl::init(false), cl::cat(PollyCategory));
182 
183 static cl::opt<bool>
184  EnablePolyhedralInfo("polly-enable-polyhedralinfo",
185  cl::desc("Enable polyhedral interface of Polly"),
186  cl::Hidden, cl::init(false), cl::cat(PollyCategory));
187 
188 static cl::opt<bool>
189  EnableForwardOpTree("polly-enable-optree",
190  cl::desc("Enable operand tree forwarding"), cl::Hidden,
191  cl::init(true), cl::cat(PollyCategory));
192 
193 static cl::opt<bool>
194  DumpBefore("polly-dump-before",
195  cl::desc("Dump module before Polly transformations into a file "
196  "suffixed with \"-before\""),
197  cl::init(false), cl::cat(PollyCategory));
198 
199 static cl::list<std::string> DumpBeforeFile(
200  "polly-dump-before-file",
201  cl::desc("Dump module before Polly transformations to the given file"),
202  cl::cat(PollyCategory));
203 
204 static cl::opt<bool>
205  DumpAfter("polly-dump-after",
206  cl::desc("Dump module after Polly transformations into a file "
207  "suffixed with \"-after\""),
208  cl::init(false), cl::cat(PollyCategory));
209 
210 static cl::list<std::string> DumpAfterFile(
211  "polly-dump-after-file",
212  cl::desc("Dump module after Polly transformations to the given file"),
213  cl::ZeroOrMore, cl::cat(PollyCategory));
214 
215 static cl::opt<bool>
216  EnableDeLICM("polly-enable-delicm",
217  cl::desc("Eliminate scalar loop carried dependences"),
218  cl::Hidden, cl::init(true), cl::cat(PollyCategory));
219 
220 static cl::opt<bool>
221  EnableSimplify("polly-enable-simplify",
222  cl::desc("Simplify SCoP after optimizations"),
223  cl::init(true), cl::cat(PollyCategory));
224 
225 static cl::opt<bool> EnablePruneUnprofitable(
226  "polly-enable-prune-unprofitable",
227  cl::desc("Bail out on unprofitable SCoPs before rescheduling"), cl::Hidden,
228  cl::init(true), cl::cat(PollyCategory));
229 
230 namespace {
231 
232 /// Initialize Polly passes when library is loaded.
233 ///
234 /// We use the constructor of a statically declared object to initialize the
235 /// different Polly passes right after the Polly library is loaded. This ensures
236 /// that the Polly passes are available e.g. in the 'opt' tool.
237 struct StaticInitializer {
238  StaticInitializer() {
239  llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry();
241  }
242 };
243 static StaticInitializer InitializeEverything;
244 } // end of anonymous namespace.
245 
246 void initializePollyPasses(llvm::PassRegistry &Registry) {
248 
249 #ifdef GPU_CODEGEN
250  initializePPCGCodeGenerationPass(Registry);
251  initializeManagedMemoryRewritePassPass(Registry);
252  LLVMInitializeNVPTXTarget();
253  LLVMInitializeNVPTXTargetInfo();
254  LLVMInitializeNVPTXTargetMC();
255  LLVMInitializeNVPTXAsmPrinter();
256 #endif
263  initializeJSONExporterPass(Registry);
264  initializeJSONImporterPass(Registry);
276  initializeScopInlinerPass(Registry);
292 }
293 
294 /// Register Polly passes such that they form a polyhedral optimizer.
295 ///
296 /// The individual Polly passes are registered in the pass manager such that
297 /// they form a full polyhedral optimizer. The flow of the optimizer starts with
298 /// a set of preparing transformations that canonicalize the LLVM-IR such that
299 /// the LLVM-IR is easier for us to understand and to optimizes. On the
300 /// canonicalized LLVM-IR we first run the ScopDetection pass, which detects
301 /// static control flow regions. Those regions are then translated by the
302 /// ScopInfo pass into a polyhedral representation. As a next step, a scheduling
303 /// optimizer is run on the polyhedral representation and finally the optimized
304 /// polyhedral representation is code generated back to LLVM-IR.
305 ///
306 /// Besides this core functionality, we optionally schedule passes that provide
307 /// a graphical view of the scops (Polly[Only]Viewer, Polly[Only]Printer), that
308 /// allow the export/import of the polyhedral representation
309 /// (JSCON[Exporter|Importer]) or that show the cfg after code generation.
310 ///
311 /// For certain parts of the Polly optimizer, several alternatives are provided:
312 ///
313 /// As scheduling optimizer we support the isl scheduling optimizer
314 /// (http://freecode.com/projects/isl).
315 /// It is also possible to run Polly with no optimizer. This mode is mainly
316 /// provided to analyze the run and compile time changes caused by the
317 /// scheduling optimizer.
318 ///
319 /// Polly supports the isl internal code generator.
320 static void registerPollyPasses(llvm::legacy::PassManagerBase &PM,
321  bool EnableForOpt) {
322  if (DumpBefore)
323  PM.add(polly::createDumpModuleWrapperPass("-before", true));
324  for (auto &Filename : DumpBeforeFile)
325  PM.add(polly::createDumpModuleWrapperPass(Filename, false));
326 
329 
330  if (PollyDetectOnly)
331  return;
332 
333  if (PollyViewer)
335  if (PollyOnlyViewer)
337  if (PollyPrinter)
339  if (PollyOnlyPrinter)
344 
345  if (EnableSimplify)
349  if (EnableDeLICM)
351  if (EnableSimplify)
353 
354  if (ImportJScop)
356 
357  if (DeadCodeElim)
359 
362 
365 
366 #ifdef GPU_CODEGEN
367  if (Target == TARGET_HYBRID)
368  PM.add(
369  polly::createPPCGCodeGenerationPass(GPUArchChoice, GPURuntimeChoice));
370 #endif
371  if (Target == TARGET_CPU || Target == TARGET_HYBRID)
372  switch (Optimizer) {
373  case OPTIMIZER_NONE:
374  break; /* Do nothing */
375 
376  case OPTIMIZER_ISL:
378  break;
379  }
380 
381  if (ExportJScop)
383 
384  if (!EnableForOpt)
385  return;
386 
387  if (Target == TARGET_CPU || Target == TARGET_HYBRID)
388  switch (CodeGeneration) {
389  case CODEGEN_AST:
391  break;
392  case CODEGEN_FULL:
394  break;
395  case CODEGEN_NONE:
396  break;
397  }
398 #ifdef GPU_CODEGEN
399  else {
400  PM.add(
401  polly::createPPCGCodeGenerationPass(GPUArchChoice, GPURuntimeChoice));
402  PM.add(polly::createManagedMemoryRewritePassPass());
403  }
404 #endif
405 
406 #ifdef GPU_CODEGEN
407  if (Target == TARGET_HYBRID)
408  PM.add(polly::createManagedMemoryRewritePassPass(GPUArchChoice,
410 #endif
411 
412  // FIXME: This dummy ModulePass keeps some programs from miscompiling,
413  // probably some not correctly preserved analyses. It acts as a barrier to
414  // force all analysis results to be recomputed.
415  PM.add(llvm::createBarrierNoopPass());
416 
417  if (DumpAfter)
418  PM.add(polly::createDumpModuleWrapperPass("-after", true));
419  for (auto &Filename : DumpAfterFile)
420  PM.add(polly::createDumpModuleWrapperPass(Filename, false));
421 
422  if (CFGPrinter)
423  PM.add(llvm::createCFGPrinterLegacyPassPass());
424 }
425 
427 
429  // FIXME: PollyTrackFailures is user-controlled, should not be set
430  // programmatically.
432  PollyTrackFailures = true;
433 
435  ExportJScop;
436 }
437 
438 static void
439 registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
440  llvm::legacy::PassManagerBase &PM) {
442  return;
443 
444  bool EnableForOpt = shouldEnablePollyForOptimization() &&
445  Builder.OptLevel >= 1 && Builder.SizeLevel == 0;
446  if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
447  return;
448 
450  registerPollyPasses(PM, EnableForOpt);
451 }
452 
453 static void
454 registerPollyLoopOptimizerEndPasses(const llvm::PassManagerBuilder &Builder,
455  llvm::legacy::PassManagerBase &PM) {
457  return;
458 
459  bool EnableForOpt = shouldEnablePollyForOptimization() &&
460  Builder.OptLevel >= 1 && Builder.SizeLevel == 0;
461  if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
462  return;
463 
464  registerPollyPasses(PM, EnableForOpt);
465  if (EnableForOpt)
466  PM.add(createCodegenCleanupPass());
467 }
468 
469 static void
470 registerPollyScalarOptimizerLatePasses(const llvm::PassManagerBuilder &Builder,
471  llvm::legacy::PassManagerBase &PM) {
473  return;
474 
475  bool EnableForOpt = shouldEnablePollyForOptimization() &&
476  Builder.OptLevel >= 1 && Builder.SizeLevel == 0;
477  if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
478  return;
479 
480  polly::registerPollyPasses(PM, EnableForOpt);
481  if (EnableForOpt)
482  PM.add(createCodegenCleanupPass());
483 }
484 
485 /// Add the pass sequence required for Polly to the New Pass Manager.
486 ///
487 /// @param PM The pass manager itself.
488 /// @param Level The optimization level. Used for the cleanup of Polly's
489 /// output.
490 /// @param EnableForOpt Whether to add Polly IR transformations. If False, only
491 /// the analysis passes are added, skipping Polly itself.
492 /// The IR may still be modified.
493 static void buildCommonPollyPipeline(FunctionPassManager &PM,
494  OptimizationLevel Level,
495  bool EnableForOpt) {
496  PassBuilder PB;
497  ScopPassManager SPM;
498 
499  PM.addPass(CodePreparationPass());
500 
501  // TODO add utility passes for the various command line options, once they're
502  // ported
503 
504  if (PollyDetectOnly) {
505  // Don't add more passes other than the ScopPassManager's detection passes.
506  PM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
507  return;
508  }
509 
510  if (PollyViewer)
511  PM.addPass(ScopViewer());
512  if (PollyOnlyViewer)
513  PM.addPass(ScopOnlyViewer());
514  if (PollyPrinter)
515  PM.addPass(ScopPrinter());
516  if (PollyOnlyPrinter)
517  PM.addPass(ScopOnlyPrinter());
519  llvm::report_fatal_error(
520  "Option -polly-enable-polyhedralinfo not supported with NPM", false);
521 
522  if (EnableSimplify)
523  SPM.addPass(SimplifyPass(0));
525  SPM.addPass(ForwardOpTreePass());
526  if (EnableDeLICM)
527  SPM.addPass(DeLICMPass());
528  if (EnableSimplify)
529  SPM.addPass(SimplifyPass(1));
530 
531  if (ImportJScop)
532  SPM.addPass(JSONImportPass());
533 
534  if (DeadCodeElim)
535  SPM.addPass(DeadCodeElimPass());
536 
538  llvm::report_fatal_error("Option -polly-enable-mse not supported with NPM",
539  false);
540 
542  SPM.addPass(PruneUnprofitablePass());
543 
544  if (Target == TARGET_CPU || Target == TARGET_HYBRID) {
545  switch (Optimizer) {
546  case OPTIMIZER_NONE:
547  break; /* Do nothing */
548  case OPTIMIZER_ISL:
549  SPM.addPass(IslScheduleOptimizerPass());
550  break;
551  }
552  }
553 
554  if (ExportJScop)
555  llvm::report_fatal_error("Option -polly-export not supported with NPM",
556  false);
557 
558  if (!EnableForOpt)
559  return;
560 
561  if (Target == TARGET_CPU || Target == TARGET_HYBRID) {
562  switch (CodeGeneration) {
563  case CODEGEN_AST:
564  SPM.addPass(
565  llvm::RequireAnalysisPass<IslAstAnalysis, Scop, ScopAnalysisManager,
567  SPMUpdater &>());
568  break;
569  case CODEGEN_FULL:
570  SPM.addPass(CodeGenerationPass());
571  break;
572  case CODEGEN_NONE:
573  break;
574  }
575  }
576 #ifdef GPU_CODEGEN
577  else
578  llvm::report_fatal_error("Option -polly-target=gpu not supported for NPM",
579  false);
580 #endif
581 
582 #ifdef GPU_CODEGEN
583  if (Target == TARGET_HYBRID)
584  llvm::report_fatal_error(
585  "Option -polly-target=hybrid not supported for NPM", false);
586 #endif
587 
588  PM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
589  PM.addPass(PB.buildFunctionSimplificationPipeline(
590  Level, llvm::ThinOrFullLTOPhase::None)); // Cleanup
591 
592  if (CFGPrinter)
593  PM.addPass(llvm::CFGPrinterPass());
594 }
595 
596 static void buildEarlyPollyPipeline(llvm::ModulePassManager &MPM,
597  llvm::OptimizationLevel Level) {
598  bool EnableForOpt =
599  shouldEnablePollyForOptimization() && Level.isOptimizingForSpeed();
600  if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
601  return;
602 
603  FunctionPassManager FPM = buildCanonicalicationPassesForNPM(MPM, Level);
604 
605  if (DumpBefore || !DumpBeforeFile.empty()) {
606  MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
607 
608  if (DumpBefore)
609  MPM.addPass(DumpModulePass("-before", true));
610  for (auto &Filename : DumpBeforeFile)
611  MPM.addPass(DumpModulePass(Filename, false));
612 
613  FPM = FunctionPassManager();
614  }
615 
616  buildCommonPollyPipeline(FPM, Level, EnableForOpt);
617  MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
618 
619  if (DumpAfter)
620  MPM.addPass(DumpModulePass("-after", true));
621  for (auto &Filename : DumpAfterFile)
622  MPM.addPass(DumpModulePass(Filename, false));
623 }
624 
625 static void buildLatePollyPipeline(FunctionPassManager &PM,
626  llvm::OptimizationLevel Level) {
627  bool EnableForOpt =
628  shouldEnablePollyForOptimization() && Level.isOptimizingForSpeed();
629  if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
630  return;
631 
632  if (DumpBefore)
633  PM.addPass(DumpFunctionPass("-before"));
634  if (!DumpBeforeFile.empty())
635  llvm::report_fatal_error(
636  "Option -polly-dump-before-file at -polly-position=late "
637  "not supported with NPM",
638  false);
639 
640  buildCommonPollyPipeline(PM, Level, EnableForOpt);
641 
642  if (DumpAfter)
643  PM.addPass(DumpFunctionPass("-after"));
644  if (!DumpAfterFile.empty())
645  llvm::report_fatal_error(
646  "Option -polly-dump-after-file at -polly-position=late "
647  "not supported with NPM",
648  false);
649 }
650 
651 /// Register Polly to be available as an optimizer
652 ///
653 ///
654 /// We can currently run Polly at three different points int the pass manager.
655 /// a) very early, b) after the canonicalizing loop transformations and c) right
656 /// before the vectorizer.
657 ///
658 /// The default is currently a), to register Polly such that it runs as early as
659 /// possible. This has several implications:
660 ///
661 /// 1) We need to schedule more canonicalization passes
662 ///
663 /// As nothing is run before Polly, it is necessary to run a set of preparing
664 /// transformations before Polly to canonicalize the LLVM-IR and to allow
665 /// Polly to detect and understand the code.
666 ///
667 /// 2) LICM and LoopIdiom pass have not yet been run
668 ///
669 /// Loop invariant code motion as well as the loop idiom recognition pass make
670 /// it more difficult for Polly to transform code. LICM may introduce
671 /// additional data dependences that are hard to eliminate and the loop idiom
672 /// recognition pass may introduce calls to memset that we currently do not
673 /// understand. By running Polly early enough (meaning before these passes) we
674 /// avoid difficulties that may be introduced by these passes.
675 ///
676 /// 3) We get the full -O3 optimization sequence after Polly
677 ///
678 /// The LLVM-IR that is generated by Polly has been optimized on a high level,
679 /// but it may be rather inefficient on the lower/scalar level. By scheduling
680 /// Polly before all other passes, we have the full sequence of -O3
681 /// optimizations behind us, such that inefficiencies on the low level can
682 /// be optimized away.
683 ///
684 /// We are currently evaluating the benefit or running Polly at position b) or
685 /// c). b) is likely too early as it interacts with the inliner. c) is nice
686 /// as everything is fully inlined and canonicalized, but we need to be able
687 /// to handle LICMed code to make it useful.
688 static llvm::RegisterStandardPasses RegisterPollyOptimizerEarly(
689  llvm::PassManagerBuilder::EP_ModuleOptimizerEarly,
691 
692 static llvm::RegisterStandardPasses
693  RegisterPollyOptimizerLoopEnd(llvm::PassManagerBuilder::EP_LoopOptimizerEnd,
695 
696 static llvm::RegisterStandardPasses RegisterPollyOptimizerScalarLate(
697  llvm::PassManagerBuilder::EP_VectorizerStart,
699 
701 createScopAnalyses(FunctionAnalysisManager &FAM,
702  PassInstrumentationCallbacks *PIC) {
704 #define SCOP_ANALYSIS(NAME, CREATE_PASS) \
705  Proxy.getManager().registerPass([PIC] { \
706  (void)PIC; \
707  return CREATE_PASS; \
708  });
709 #include "PollyPasses.def"
710 
711  Proxy.getManager().registerPass(
712  [&FAM] { return FunctionAnalysisManagerScopProxy(FAM); });
713  return Proxy;
714 }
715 
716 static void registerFunctionAnalyses(FunctionAnalysisManager &FAM,
717  PassInstrumentationCallbacks *PIC) {
718 
719 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
720  FAM.registerPass([] { return CREATE_PASS; });
721 
722 #include "PollyPasses.def"
723 
724  FAM.registerPass([&FAM, PIC] { return createScopAnalyses(FAM, PIC); });
725 }
726 
727 static bool
728 parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
729  ArrayRef<PassBuilder::PipelineElement> Pipeline) {
730  if (llvm::parseAnalysisUtilityPasses<OwningScopAnalysisManagerFunctionProxy>(
731  "polly-scop-analyses", Name, FPM))
732  return true;
733 
734 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
735  if (llvm::parseAnalysisUtilityPasses< \
736  std::remove_reference<decltype(CREATE_PASS)>::type>(NAME, Name, \
737  FPM)) \
738  return true;
739 
740 #define FUNCTION_PASS(NAME, CREATE_PASS) \
741  if (Name == NAME) { \
742  FPM.addPass(CREATE_PASS); \
743  return true; \
744  }
745 
746 #include "PollyPasses.def"
747  return false;
748 }
749 
750 static bool parseScopPass(StringRef Name, ScopPassManager &SPM,
751  PassInstrumentationCallbacks *PIC) {
752 #define SCOP_ANALYSIS(NAME, CREATE_PASS) \
753  if (llvm::parseAnalysisUtilityPasses< \
754  std::remove_reference<decltype(CREATE_PASS)>::type>(NAME, Name, \
755  SPM)) \
756  return true;
757 
758 #define SCOP_PASS(NAME, CREATE_PASS) \
759  if (Name == NAME) { \
760  SPM.addPass(CREATE_PASS); \
761  return true; \
762  }
763 
764 #include "PollyPasses.def"
765 
766  return false;
767 }
768 
769 static bool parseScopPipeline(StringRef Name, FunctionPassManager &FPM,
770  PassInstrumentationCallbacks *PIC,
771  ArrayRef<PassBuilder::PipelineElement> Pipeline) {
772  if (Name != "scop")
773  return false;
774  if (!Pipeline.empty()) {
775  ScopPassManager SPM;
776  for (const auto &E : Pipeline)
777  if (!parseScopPass(E.Name, SPM, PIC))
778  return false;
779  FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
780  }
781  return true;
782 }
783 
784 static bool isScopPassName(StringRef Name) {
785 #define SCOP_ANALYSIS(NAME, CREATE_PASS) \
786  if (Name == "require<" NAME ">") \
787  return true; \
788  if (Name == "invalidate<" NAME ">") \
789  return true;
790 
791 #define SCOP_PASS(NAME, CREATE_PASS) \
792  if (Name == NAME) \
793  return true;
794 
795 #include "PollyPasses.def"
796 
797  return false;
798 }
799 
800 static bool
801 parseTopLevelPipeline(llvm::ModulePassManager &MPM,
802  PassInstrumentationCallbacks *PIC,
803  ArrayRef<PassBuilder::PipelineElement> Pipeline) {
804  std::vector<PassBuilder::PipelineElement> FullPipeline;
805  StringRef FirstName = Pipeline.front().Name;
806 
807  if (!isScopPassName(FirstName))
808  return false;
809 
810  FunctionPassManager FPM;
811  ScopPassManager SPM;
812 
813  for (auto &Element : Pipeline) {
814  auto &Name = Element.Name;
815  auto &InnerPipeline = Element.InnerPipeline;
816  if (!InnerPipeline.empty()) // Scop passes don't have inner pipelines
817  return false;
818  if (!parseScopPass(Name, SPM, PIC))
819  return false;
820  }
821 
822  FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
823  MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
824 
825  return true;
826 }
827 
828 void registerPollyPasses(PassBuilder &PB) {
829  PassInstrumentationCallbacks *PIC = PB.getPassInstrumentationCallbacks();
830  PB.registerAnalysisRegistrationCallback([PIC](FunctionAnalysisManager &FAM) {
831  registerFunctionAnalyses(FAM, PIC);
832  });
833  PB.registerPipelineParsingCallback(parseFunctionPipeline);
834  PB.registerPipelineParsingCallback(
835  [PIC](StringRef Name, FunctionPassManager &FPM,
836  ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
837  return parseScopPipeline(Name, FPM, PIC, Pipeline);
838  });
839  PB.registerParseTopLevelPipelineCallback(
840  [PIC](llvm::ModulePassManager &MPM,
841  ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
842  return parseTopLevelPipeline(MPM, PIC, Pipeline);
843  });
844 
845  switch (PassPosition) {
846  case POSITION_EARLY:
847  PB.registerPipelineStartEPCallback(buildEarlyPollyPipeline);
848  break;
850  llvm::report_fatal_error(
851  "Option -polly-position=after-loopopt not supported with NPM", false);
852  break;
854  PB.registerVectorizerStartEPCallback(buildLatePollyPipeline);
855  break;
856  }
857 }
858 } // namespace polly
859 
860 llvm::PassPluginLibraryInfo getPollyPluginInfo() {
861  return {LLVM_PLUGIN_API_VERSION, "Polly", LLVM_VERSION_STRING,
863 }
polly::createDeLICMWrapperPass
llvm::Pass * createDeLICMWrapperPass()
Create a new DeLICM pass instance.
Definition: DeLICM.cpp:1494
llvm::initializeDeLICMWrapperPassPass
void initializeDeLICMWrapperPassPass(llvm::PassRegistry &)
polly::isScopPassName
static bool isScopPassName(StringRef Name)
Definition: RegisterPasses.cpp:784
DumpModulePass.h
ForwardOpTree.h
llvm::initializeIslAstInfoWrapperPassPass
void initializeIslAstInfoWrapperPassPass(llvm::PassRegistry &)
polly::OPTIMIZER_ISL
@ OPTIMIZER_ISL
Definition: RegisterPasses.cpp:80
polly::shouldEnablePollyForDiagnostic
static bool shouldEnablePollyForDiagnostic()
Definition: RegisterPasses.cpp:428
polly::CodePreparationPass
Definition: CodePreparation.h:19
polly::PollyOnlyPrinter
static cl::opt< bool > PollyOnlyPrinter("polly-dot-only", cl::desc("Enable the Polly DOT printer in -O3 (no BB content)"), cl::Hidden, cl::value_desc("Run the Polly DOT printer at -O3 (no BB content"), cl::init(false), cl::cat(PollyCategory))
DependenceInfo.h
polly::VECTORIZER_NONE
@ VECTORIZER_NONE
Definition: CodeGeneration.h:19
polly::PollyEnabled
static cl::opt< bool > PollyEnabled("polly", cl::desc("Enable the polly optimizer (with -O1, -O2 or -O3)"), cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::PassPositionChoice
PassPositionChoice
Definition: RegisterPasses.cpp:74
llvm::initializeFlattenSchedulePrinterLegacyPassPass
void initializeFlattenSchedulePrinterLegacyPassPass(llvm::PassRegistry &)
polly::parseFunctionPipeline
static bool parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM, ArrayRef< PassBuilder::PipelineElement > Pipeline)
Definition: RegisterPasses.cpp:728
polly::createJSONImporterPass
llvm::Pass * createJSONImporterPass()
Definition: JSONExporter.cpp:798
DeadCodeElimination.h
polly::CodeGenerationPass
Definition: CodeGeneration.h:31
llvm::initializeDumpModuleWrapperPassPass
void initializeDumpModuleWrapperPassPass(llvm::PassRegistry &)
polly::Target
static cl::opt< TargetChoice > Target("polly-target", cl::desc("The hardware to target"), cl::values(clEnumValN(TARGET_CPU, "cpu", "generate CPU code")), cl::init(TARGET_CPU), cl::ZeroOrMore, cl::cat(PollyCategory))
llvm::initializeScopDetectionPrinterLegacyPassPass
void initializeScopDetectionPrinterLegacyPassPass(llvm::PassRegistry &)
llvm::initializeDependenceInfoPrinterLegacyFunctionPassPass
void initializeDependenceInfoPrinterLegacyFunctionPassPass(llvm::PassRegistry &)
llvm::initializeDeLICMPrinterLegacyPassPass
void initializeDeLICMPrinterLegacyPassPass(llvm::PassRegistry &)
polly::VECTORIZER_STRIPMINE
@ VECTORIZER_STRIPMINE
Definition: CodeGeneration.h:20
polly::buildCommonPollyPipeline
static void buildCommonPollyPipeline(FunctionPassManager &PM, OptimizationLevel Level, bool EnableForOpt)
Add the pass sequence required for Polly to the New Pass Manager.
Definition: RegisterPasses.cpp:493
polly::buildCanonicalicationPassesForNPM
llvm::FunctionPassManager buildCanonicalicationPassesForNPM(llvm::ModulePassManager &MPM, llvm::OptimizationLevel Level)
Definition: Canonicalization.cpp:94
polly::DeadCodeElimPass
Definition: DeadCodeElimination.h:27
CodePreparation.h
polly::createIslAstInfoWrapperPassPass
llvm::Pass * createIslAstInfoWrapperPassPass()
Definition: IslAst.cpp:815
llvm::initializeCodePreparationPass
void initializeCodePreparationPass(llvm::PassRegistry &)
polly::createDOTOnlyViewerWrapperPass
llvm::Pass * createDOTOnlyViewerWrapperPass()
Definition: ScopGraphPrinter.cpp:223
llvm::initializeIslAstInfoPrinterLegacyPassPass
void initializeIslAstInfoPrinterLegacyPassPass(llvm::PassRegistry &)
llvm::initializeDependenceInfoPass
void initializeDependenceInfoPass(llvm::PassRegistry &)
llvm::initializeDeadCodeElimWrapperPassPass
void initializeDeadCodeElimWrapperPassPass(llvm::PassRegistry &)
PollyCategory
cl::OptionCategory PollyCategory("Polly Options", "Configure the polly loop optimizer")
polly::CODEGEN_FULL
@ CODEGEN_FULL
Definition: RegisterPasses.cpp:101
polly::registerFunctionAnalyses
static void registerFunctionAnalyses(FunctionAnalysisManager &FAM, PassInstrumentationCallbacks *PIC)
Definition: RegisterPasses.cpp:716
polly::CODEGEN_AST
@ CODEGEN_AST
Definition: RegisterPasses.cpp:101
polly::PruneUnprofitablePass
Definition: PruneUnprofitable.h:26
llvm::initializeDependenceInfoWrapperPassPass
void initializeDependenceInfoWrapperPassPass(llvm::PassRegistry &)
polly::ScopViewer
Definition: ScopGraphPrinter.h:73
llvm::initializeScopInfoPrinterLegacyRegionPassPass
void initializeScopInfoPrinterLegacyRegionPassPass(llvm::PassRegistry &)
polly::CodeGenChoice
CodeGenChoice
Definition: RegisterPasses.cpp:101
polly::ScopAnalysisManager
AnalysisManager< Scop, ScopStandardAnalysisResults & > ScopAnalysisManager
Definition: ScopPass.h:46
polly::EnableDeLICM
static cl::opt< bool > EnableDeLICM("polly-enable-delicm", cl::desc("Eliminate scalar loop carried dependences"), cl::Hidden, cl::init(true), cl::cat(PollyCategory))
polly::parseScopPass
static bool parseScopPass(StringRef Name, ScopPassManager &SPM, PassInstrumentationCallbacks *PIC)
Definition: RegisterPasses.cpp:750
CodegenCleanup.h
llvm::initializePollyCanonicalizePass
void initializePollyCanonicalizePass(llvm::PassRegistry &)
init
void GMPQAPI() init(mp_rat x)
Definition: gmp_compat.c:64
polly::EnablePolyhedralInfo
static cl::opt< bool > EnablePolyhedralInfo("polly-enable-polyhedralinfo", cl::desc("Enable polyhedral interface of Polly"), cl::Hidden, cl::init(false), cl::cat(PollyCategory))
llvm::initializeScopInfoPrinterLegacyFunctionPassPass
void initializeScopInfoPrinterLegacyFunctionPassPass(PassRegistry &)
llvm::initializeJSONImporterPrinterLegacyPassPass
void initializeJSONImporterPrinterLegacyPassPass(llvm::PassRegistry &)
llvm::initializeDependenceInfoPrinterLegacyPassPass
void initializeDependenceInfoPrinterLegacyPassPass(llvm::PassRegistry &)
polly::FullyIndexedStaticExpansion
static cl::opt< bool > FullyIndexedStaticExpansion("polly-enable-mse", cl::desc("Fully expand the memory accesses of the detected Scops"), cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
LinkAllPasses.h
polly::PollyPrinter
static cl::opt< bool > PollyPrinter("polly-dot", cl::desc("Enable the Polly DOT printer in -O3"), cl::Hidden, cl::value_desc("Run the Polly DOT printer at -O3"), cl::init(false), cl::cat(PollyCategory))
llvm::initializeFlattenSchedulePass
void initializeFlattenSchedulePass(llvm::PassRegistry &)
PruneUnprofitable.h
llvm::initializeScopInfoWrapperPassPass
void initializeScopInfoWrapperPassPass(PassRegistry &)
polly::EnablePruneUnprofitable
static cl::opt< bool > EnablePruneUnprofitable("polly-enable-prune-unprofitable", cl::desc("Bail out on unprofitable SCoPs before rescheduling"), cl::Hidden, cl::init(true), cl::cat(PollyCategory))
llvm::initializeJSONExporterPass
void initializeJSONExporterPass(llvm::PassRegistry &)
polly::parseScopPipeline
static bool parseScopPipeline(StringRef Name, FunctionPassManager &FPM, PassInstrumentationCallbacks *PIC, ArrayRef< PassBuilder::PipelineElement > Pipeline)
Definition: RegisterPasses.cpp:769
getPollyPluginInfo
llvm::PassPluginLibraryInfo getPollyPluginInfo()
Definition: RegisterPasses.cpp:860
polly::ScopStandardAnalysisResults
Definition: ScopPass.h:185
polly::registerPollyLoopOptimizerEndPasses
static void registerPollyLoopOptimizerEndPasses(const llvm::PassManagerBuilder &Builder, llvm::legacy::PassManagerBase &PM)
Definition: RegisterPasses.cpp:454
IslAst.h
polly::registerCanonicalicationPasses
void registerCanonicalicationPasses(llvm::legacy::PassManagerBase &PM)
Schedule a set of canonicalization passes to prepare for Polly.
Definition: Canonicalization.cpp:42
polly::SPMUpdater
Definition: ScopPass.h:194
polly::OptimizerChoice
OptimizerChoice
Definition: RegisterPasses.cpp:80
polly::TARGET_CPU
@ TARGET_CPU
Definition: RegisterPasses.cpp:109
polly::OwningInnerAnalysisManagerProxy
Definition: ScopPass.h:127
polly::EnableSimplify
static cl::opt< bool > EnableSimplify("polly-enable-simplify", cl::desc("Simplify SCoP after optimizations"), cl::init(true), cl::cat(PollyCategory))
polly::OwningInnerAnalysisManagerProxy::getManager
AnalysisManagerT & getManager()
Definition: ScopPass.h:139
ScopInfo.h
llvm::initializeForwardOpTreePrinterLegacyPassPass
void initializeForwardOpTreePrinterLegacyPassPass(PassRegistry &)
polly::CODEGEN_NONE
@ CODEGEN_NONE
Definition: RegisterPasses.cpp:101
polly::buildLatePollyPipeline
static void buildLatePollyPipeline(FunctionPassManager &PM, llvm::OptimizationLevel Level)
Definition: RegisterPasses.cpp:625
llvm::initializeScopInlinerPass
void initializeScopInlinerPass(llvm::PassRegistry &)
polly::VectorizerChoice
VectorizerChoice
Definition: CodeGeneration.h:18
polly::OwningScopAnalysisManagerFunctionProxy
OwningInnerAnalysisManagerProxy< ScopAnalysisManager, Function > OwningScopAnalysisManagerFunctionProxy
Definition: ScopPass.h:153
llvm::initializeJSONImporterPass
void initializeJSONImporterPass(llvm::PassRegistry &)
polly::shouldEnablePollyForOptimization
static bool shouldEnablePollyForOptimization()
Definition: RegisterPasses.cpp:426
llvm::initializeCodeGenerationPass
void initializeCodeGenerationPass(llvm::PassRegistry &)
polly::CFGPrinter
static cl::opt< bool > CFGPrinter("polly-view-cfg", cl::desc("Show the Polly CFG right after code generation"), cl::Hidden, cl::init(false), cl::cat(PollyCategory))
llvm::initializeIslScheduleOptimizerWrapperPassPass
void initializeIslScheduleOptimizerWrapperPassPass(llvm::PassRegistry &)
polly::createForwardOpTreeWrapperPass
llvm::Pass * createForwardOpTreeWrapperPass()
Definition: ForwardOpTree.cpp:1180
polly::createPruneUnprofitableWrapperPass
llvm::Pass * createPruneUnprofitableWrapperPass()
Definition: PruneUnprofitable.cpp:101
polly::DumpAfterFile
static cl::list< std::string > DumpAfterFile("polly-dump-after-file", cl::desc("Dump module after Polly transformations to the given file"), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::CodeGeneration
static cl::opt< CodeGenChoice > CodeGeneration("polly-code-generation", cl::desc("How much code-generation to perform"), cl::values(clEnumValN(CODEGEN_FULL, "full", "AST and IR generation"), clEnumValN(CODEGEN_AST, "ast", "Only AST generation"), clEnumValN(CODEGEN_NONE, "none", "No code generation")), cl::Hidden, cl::init(CODEGEN_FULL), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::createCodeGenerationPass
llvm::Pass * createCodeGenerationPass()
Definition: CodeGeneration.cpp:375
polly::RegisterPollyOptimizerEarly
static llvm::RegisterStandardPasses RegisterPollyOptimizerEarly(llvm::PassManagerBuilder::EP_ModuleOptimizerEarly, registerPollyEarlyAsPossiblePasses)
Register Polly to be available as an optimizer.
polly::createDeadCodeElimWrapperPass
llvm::Pass * createDeadCodeElimWrapperPass()
Definition: DeadCodeElimination.cpp:168
llvm::initializeScopDetectionWrapperPassPass
void initializeScopDetectionWrapperPassPass(llvm::PassRegistry &)
polly::PollyTrackFailures
bool PollyTrackFailures
Definition: ScopDetection.cpp:239
polly::IslScheduleOptimizerPass
Definition: ScheduleOptimizer.h:23
polly::DeLICMPass
Definition: DeLICM.h:34
polly::TargetChoice
TargetChoice
Definition: RegisterPasses.cpp:109
polly::OPTIMIZER_NONE
@ OPTIMIZER_NONE
Definition: RegisterPasses.cpp:80
polly::IslAstAnalysis
Definition: IslAst.h:166
llvm::initializeMaximalStaticExpanderPass
void initializeMaximalStaticExpanderPass(llvm::PassRegistry &)
PolyhedralInfo.h
polly::DumpModulePass
A pass that prints the module into a file.
Definition: DumpModulePass.h:37
polly::DumpFunctionPass
A pass that isolates a function into a new Module and writes it into a file.
Definition: DumpFunctionPass.h:28
polly::createScopDetectionWrapperPassPass
llvm::Pass * createScopDetectionWrapperPassPass()
Definition: ScopDetection.cpp:2031
polly::registerPollyEarlyAsPossiblePasses
static void registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder, llvm::legacy::PassManagerBase &PM)
Definition: RegisterPasses.cpp:439
llvm::initializePruneUnprofitableWrapperPassPass
void initializePruneUnprofitableWrapperPassPass(llvm::PassRegistry &)
polly::createPolyhedralInfoPass
llvm::Pass * createPolyhedralInfoPass()
Definition: PolyhedralInfo.cpp:157
llvm::initializeSimplifyPrinterLegacyPassPass
void initializeSimplifyPrinterLegacyPassPass(llvm::PassRegistry &)
polly::parseTopLevelPipeline
static bool parseTopLevelPipeline(llvm::ModulePassManager &MPM, PassInstrumentationCallbacks *PIC, ArrayRef< PassBuilder::PipelineElement > Pipeline)
Definition: RegisterPasses.cpp:801
polly::RegisterPollyOptimizerLoopEnd
static llvm::RegisterStandardPasses RegisterPollyOptimizerLoopEnd(llvm::PassManagerBuilder::EP_LoopOptimizerEnd, registerPollyLoopOptimizerEndPasses)
polly::RegisterPollyOptimizerScalarLate
static llvm::RegisterStandardPasses RegisterPollyOptimizerScalarLate(llvm::PassManagerBuilder::EP_VectorizerStart, registerPollyScalarOptimizerLatePasses)
llvm::initializeIslScheduleOptimizerPrinterLegacyPassPass
void initializeIslScheduleOptimizerPrinterLegacyPassPass(llvm::PassRegistry &)
ScopDetection.h
polly::Vectorizer
static cl::opt< VectorizerChoice, true > Vectorizer("polly-vectorizer", cl::desc("Select the vectorization strategy"), cl::values(clEnumValN(VECTORIZER_NONE, "none", "No Vectorization"), clEnumValN(VECTORIZER_POLLY, "polly", "Polly internal vectorizer"), clEnumValN(VECTORIZER_STRIPMINE, "stripmine", "Strip-mine outer loops for the loop-vectorizer to trigger")), cl::location(PollyVectorizerChoice), cl::init(VECTORIZER_NONE), cl::ZeroOrMore, cl::cat(PollyCategory))
llvm::initializeForwardOpTreeWrapperPassPass
void initializeForwardOpTreeWrapperPassPass(PassRegistry &)
polly::createDOTOnlyPrinterWrapperPass
llvm::Pass * createDOTOnlyPrinterWrapperPass()
Definition: ScopGraphPrinter.cpp:231
llvm::initializeSimplifyWrapperPassPass
void initializeSimplifyWrapperPassPass(llvm::PassRegistry &)
polly::createScopInfoRegionPassPass
llvm::Pass * createScopInfoRegionPassPass()
polly::ScopPrinter
Definition: ScopGraphPrinter.h:84
Canonicalization.h
polly::POSITION_BEFORE_VECTORIZER
@ POSITION_BEFORE_VECTORIZER
Definition: RegisterPasses.cpp:77
polly::ScopOnlyPrinter
Definition: ScopGraphPrinter.h:88
polly
Definition: Canonicalization.h:20
polly::JSONImportPass
This pass imports a scop from a jscop file.
Definition: JSONExporter.h:29
polly::ScopPassManager
PassManager< Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater & > ScopPassManager
Definition: ScopPass.h:156
polly::TARGET_GPU
@ TARGET_GPU
Definition: RegisterPasses.cpp:109
polly::PollyVectorizerChoice
VectorizerChoice PollyVectorizerChoice
Definition: RegisterPasses.cpp:122
JSONExporter.h
ScopGraphPrinter.h
polly::GPURuntimeChoice
GPURuntime GPURuntimeChoice
Use for pass instantiation defaults.
Definition: PPCGCodeGeneration.cpp:121
polly::createCodegenCleanupPass
llvm::FunctionPass * createCodegenCleanupPass()
Definition: CodegenCleanup.cpp:135
polly::createScopAnalyses
static OwningScopAnalysisManagerFunctionProxy createScopAnalyses(FunctionAnalysisManager &FAM, PassInstrumentationCallbacks *PIC)
Definition: RegisterPasses.cpp:701
llvm::initializePolyhedralInfoPrinterLegacyPassPass
void initializePolyhedralInfoPrinterLegacyPassPass(llvm::PassRegistry &)
polly::FunctionAnalysisManagerScopProxy
OuterAnalysisManagerProxy< FunctionAnalysisManager, Scop, ScopStandardAnalysisResults & > FunctionAnalysisManagerScopProxy
Definition: ScopPass.h:51
polly::initializePollyPasses
void initializePollyPasses(llvm::PassRegistry &Registry)
Definition: RegisterPasses.cpp:246
polly::DumpBeforeFile
static cl::list< std::string > DumpBeforeFile("polly-dump-before-file", cl::desc("Dump module before Polly transformations to the given file"), cl::cat(PollyCategory))
polly::createFunctionToScopPassAdaptor
FunctionToScopPassAdaptor< ScopPassT > createFunctionToScopPassAdaptor(ScopPassT Pass)
Definition: ScopPass.h:287
Simplify.h
polly::createSimplifyWrapperPass
llvm::Pass * createSimplifyWrapperPass(int)
Create a Simplify pass.
Definition: Simplify.cpp:844
polly::ScopOnlyViewer
Definition: ScopGraphPrinter.h:79
polly::registerPollyPasses
void registerPollyPasses(llvm::PassBuilder &PB)
polly::EnableForwardOpTree
static cl::opt< bool > EnableForwardOpTree("polly-enable-optree", cl::desc("Enable operand tree forwarding"), cl::Hidden, cl::init(true), cl::cat(PollyCategory))
polly::createMaximalStaticExpansionPass
llvm::Pass * createMaximalStaticExpansionPass()
Definition: MaximalStaticExpansion.cpp:478
polly::SimplifyPass
Definition: Simplify.h:55
polly::DumpBefore
static cl::opt< bool > DumpBefore("polly-dump-before", cl::desc("Dump module before Polly transformations into a file " "suffixed with \"-before\""), cl::init(false), cl::cat(PollyCategory))
polly::createCodePreparationPass
llvm::Pass * createCodePreparationPass()
Definition: CodePreparation.cpp:114
polly::createIslScheduleOptimizerWrapperPass
llvm::Pass * createIslScheduleOptimizerWrapperPass()
Definition: ScheduleOptimizer.cpp:957
polly::PassPosition
static cl::opt< PassPositionChoice > PassPosition("polly-position", cl::desc("Where to run polly in the pass pipeline"), cl::values(clEnumValN(POSITION_EARLY, "early", "Before everything"), clEnumValN(POSITION_AFTER_LOOPOPT, "after-loopopt", "After the loop optimizer (but within the inline cycle)"), clEnumValN(POSITION_BEFORE_VECTORIZER, "before-vectorizer", "Right before the vectorizer")), cl::Hidden, cl::init(POSITION_BEFORE_VECTORIZER), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::createJSONExporterPass
llvm::Pass * createJSONExporterPass()
Definition: JSONExporter.cpp:760
polly::ForwardOpTreePass
Definition: ForwardOpTree.h:26
polly::POSITION_AFTER_LOOPOPT
@ POSITION_AFTER_LOOPOPT
Definition: RegisterPasses.cpp:76
polly::ExportJScop
static cl::opt< bool > ExportJScop("polly-export", cl::desc("Export the polyhedral description of the detected Scops"), cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::TARGET_HYBRID
@ TARGET_HYBRID
Definition: RegisterPasses.cpp:109
polly::createDumpModuleWrapperPass
llvm::ModulePass * createDumpModuleWrapperPass(std::string Filename, bool IsSuffix)
Create a pass that prints the module into a file.
Definition: DumpModulePass.cpp:88
llvm::initializeCodegenCleanupPass
void initializeCodegenCleanupPass(llvm::PassRegistry &)
polly::PollyViewer
static cl::opt< bool > PollyViewer("polly-show", cl::desc("Highlight the code regions that will be optimized in a " "(CFG BBs and LLVM-IR instructions)"), cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::PollyDetectOnly
static cl::opt< bool > PollyDetectOnly("polly-only-scop-detection", cl::desc("Only run scop detection, but no other optimizations"), cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
polly::Scop
Static Control Part.
Definition: ScopInfo.h:1629
polly::DeadCodeElim
static cl::opt< bool > DeadCodeElim("polly-run-dce", cl::desc("Run the dead code elimination"), cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
llvm::initializeScopInfoRegionPassPass
void initializeScopInfoRegionPassPass(PassRegistry &)
CodeGeneration.h
polly::PollyOnlyViewer
static cl::opt< bool > PollyOnlyViewer("polly-show-only", cl::desc("Highlight the code regions that will be optimized in " "a (CFG only BBs)"), cl::init(false), cl::cat(PollyCategory))
polly::DumpAfter
static cl::opt< bool > DumpAfter("polly-dump-after", cl::desc("Dump module after Polly transformations into a file " "suffixed with \"-after\""), cl::init(false), cl::cat(PollyCategory))
polly::POSITION_EARLY
@ POSITION_EARLY
Definition: RegisterPasses.cpp:75
polly::createDOTViewerWrapperPass
llvm::Pass * createDOTViewerWrapperPass()
Definition: ScopGraphPrinter.cpp:219
polly::GPUArchChoice
GPUArch GPUArchChoice
Definition: PPCGCodeGeneration.cpp:131
polly::Optimizer
static cl::opt< OptimizerChoice > Optimizer("polly-optimizer", cl::desc("Select the scheduling optimizer"), cl::values(clEnumValN(OPTIMIZER_NONE, "none", "No optimizer"), clEnumValN(OPTIMIZER_ISL, "isl", "The isl scheduling optimizer")), cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore, cl::cat(PollyCategory))
ScheduleOptimizer.h
DeLICM.h
polly::registerPollyScalarOptimizerLatePasses
static void registerPollyScalarOptimizerLatePasses(const llvm::PassManagerBuilder &Builder, llvm::legacy::PassManagerBase &PM)
Definition: RegisterPasses.cpp:470
polly::createDOTPrinterWrapperPass
llvm::Pass * createDOTPrinterWrapperPass()
Definition: ScopGraphPrinter.cpp:227
polly::ImportJScop
static cl::opt< bool > ImportJScop("polly-import", cl::desc("Import the polyhedral description of the detected Scops"), cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory))
RegisterPasses.h
llvm::initializePolyhedralInfoPass
void initializePolyhedralInfoPass(llvm::PassRegistry &)
DumpFunctionPass.h
polly::buildEarlyPollyPipeline
static void buildEarlyPollyPipeline(llvm::ModulePassManager &MPM, llvm::OptimizationLevel Level)
Definition: RegisterPasses.cpp:596
polly::VECTORIZER_POLLY
@ VECTORIZER_POLLY
Definition: CodeGeneration.h:21