Polly 22.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
26#include "polly/DeLICM.h"
29#include "polly/ForwardOpTree.h"
30#include "polly/JSONExporter.h"
31#include "polly/LinkAllPasses.h"
35#include "polly/ScopDetection.h"
37#include "polly/ScopInfo.h"
38#include "polly/ScopInliner.h"
39#include "polly/Simplify.h"
42#include "llvm/Analysis/CFGPrinter.h"
43#include "llvm/Config/llvm-config.h" // for LLVM_VERSION_STRING
44#include "llvm/IR/LegacyPassManager.h"
45#include "llvm/IR/PassManager.h"
46#include "llvm/IR/Verifier.h"
47#include "llvm/Passes/PassBuilder.h"
48#include "llvm/Passes/PassPlugin.h"
49#include "llvm/Support/CommandLine.h"
50#include "llvm/Support/Error.h"
51#include "llvm/Support/TargetSelect.h"
52#include "llvm/Transforms/IPO.h"
53
54using namespace llvm;
55namespace cl = llvm::cl;
56using namespace polly;
57
58using llvm::FunctionPassManager;
59using llvm::OptimizationLevel;
60using llvm::PassBuilder;
61using llvm::PassInstrumentationCallbacks;
62
63cl::OptionCategory PollyCategory("Polly Options",
64 "Configure the polly loop optimizer");
65
66namespace polly {
67static cl::opt<bool>
68 PollyEnabled("polly",
69 cl::desc("Enable the polly optimizer (with -O1, -O2 or -O3)"),
70 cl::cat(PollyCategory));
71
72static cl::opt<bool> PollyDetectOnly(
73 "polly-only-scop-detection",
74 cl::desc("Only run scop detection, but no other optimizations"),
75 cl::cat(PollyCategory));
76
78
80
81static cl::opt<PassPositionChoice> PassPosition(
82 "polly-position", cl::desc("Where to run polly in the pass pipeline"),
83 cl::values(clEnumValN(POSITION_EARLY, "early", "Before everything"),
84 clEnumValN(POSITION_BEFORE_VECTORIZER, "before-vectorizer",
85 "Right before the vectorizer")),
86 cl::Hidden, cl::init(POSITION_BEFORE_VECTORIZER), cl::cat(PollyCategory));
87
88static cl::opt<OptimizerChoice>
89 Optimizer("polly-optimizer", cl::desc("Select the scheduling optimizer"),
90 cl::values(clEnumValN(OPTIMIZER_NONE, "none", "No optimizer"),
91 clEnumValN(OPTIMIZER_ISL, "isl",
92 "The isl scheduling optimizer")),
93 cl::Hidden, cl::init(OPTIMIZER_ISL), cl::cat(PollyCategory));
94
96static cl::opt<CodeGenChoice> CodeGeneration(
97 "polly-code-generation", cl::desc("How much code-generation to perform"),
98 cl::values(clEnumValN(CODEGEN_FULL, "full", "AST and IR generation"),
99 clEnumValN(CODEGEN_AST, "ast", "Only AST generation"),
100 clEnumValN(CODEGEN_NONE, "none", "No code generation")),
101 cl::Hidden, cl::init(CODEGEN_FULL), cl::cat(PollyCategory));
102
104
105static cl::opt<VectorizerChoice, true> Vectorizer(
106 "polly-vectorizer", cl::desc("Select the vectorization strategy"),
107 cl::values(
108 clEnumValN(VECTORIZER_NONE, "none", "No Vectorization"),
109 clEnumValN(
110 VECTORIZER_STRIPMINE, "stripmine",
111 "Strip-mine outer loops for the loop-vectorizer to trigger")),
112 cl::location(PollyVectorizerChoice), cl::init(VECTORIZER_NONE),
113 cl::cat(PollyCategory));
114
115static cl::opt<bool> ImportJScop(
116 "polly-import",
117 cl::desc("Import the polyhedral description of the detected Scops"),
118 cl::Hidden, cl::cat(PollyCategory));
119
120static cl::opt<bool> FullyIndexedStaticExpansion(
121 "polly-enable-mse",
122 cl::desc("Fully expand the memory accesses of the detected Scops"),
123 cl::Hidden, cl::cat(PollyCategory));
124
125static cl::opt<bool> ExportJScop(
126 "polly-export",
127 cl::desc("Export the polyhedral description of the detected Scops"),
128 cl::Hidden, cl::cat(PollyCategory));
129
130static cl::opt<bool> DeadCodeElim("polly-run-dce",
131 cl::desc("Run the dead code elimination"),
132 cl::Hidden, cl::cat(PollyCategory));
133
134static cl::opt<bool> PollyViewer(
135 "polly-show",
136 cl::desc("Highlight the code regions that will be optimized in a "
137 "(CFG BBs and LLVM-IR instructions)"),
138 cl::cat(PollyCategory));
139
140static cl::opt<bool> PollyOnlyViewer(
141 "polly-show-only",
142 cl::desc("Highlight the code regions that will be optimized in "
143 "a (CFG only BBs)"),
144 cl::init(false), cl::cat(PollyCategory));
145
146static cl::opt<bool>
147 PollyPrinter("polly-dot", cl::desc("Enable the Polly DOT printer in -O3"),
148 cl::Hidden, cl::value_desc("Run the Polly DOT printer at -O3"),
149 cl::init(false), cl::cat(PollyCategory));
150
151static cl::opt<bool> PollyOnlyPrinter(
152 "polly-dot-only",
153 cl::desc("Enable the Polly DOT printer in -O3 (no BB content)"), cl::Hidden,
154 cl::value_desc("Run the Polly DOT printer at -O3 (no BB content"),
155 cl::init(false), cl::cat(PollyCategory));
156
157static cl::opt<bool>
158 CFGPrinter("polly-view-cfg",
159 cl::desc("Show the Polly CFG right after code generation"),
160 cl::Hidden, cl::init(false), cl::cat(PollyCategory));
161
162static cl::opt<bool>
163 EnableForwardOpTree("polly-enable-optree",
164 cl::desc("Enable operand tree forwarding"), cl::Hidden,
165 cl::init(true), cl::cat(PollyCategory));
166
167static cl::opt<bool>
168 DumpBefore("polly-dump-before",
169 cl::desc("Dump module before Polly transformations into a file "
170 "suffixed with \"-before\""),
171 cl::init(false), cl::cat(PollyCategory));
172
173static cl::list<std::string> DumpBeforeFile(
174 "polly-dump-before-file",
175 cl::desc("Dump module before Polly transformations to the given file"),
176 cl::cat(PollyCategory));
177
178static cl::opt<bool>
179 DumpAfter("polly-dump-after",
180 cl::desc("Dump module after Polly transformations into a file "
181 "suffixed with \"-after\""),
182 cl::init(false), cl::cat(PollyCategory));
183
184static cl::list<std::string> DumpAfterFile(
185 "polly-dump-after-file",
186 cl::desc("Dump module after Polly transformations to the given file"),
187 cl::cat(PollyCategory));
188
189static cl::opt<bool>
190 EnableDeLICM("polly-enable-delicm",
191 cl::desc("Eliminate scalar loop carried dependences"),
192 cl::Hidden, cl::init(true), cl::cat(PollyCategory));
193
194static cl::opt<bool>
195 EnableSimplify("polly-enable-simplify",
196 cl::desc("Simplify SCoP after optimizations"),
197 cl::init(true), cl::cat(PollyCategory));
198
199static cl::opt<bool> EnablePruneUnprofitable(
200 "polly-enable-prune-unprofitable",
201 cl::desc("Bail out on unprofitable SCoPs before rescheduling"), cl::Hidden,
202 cl::init(true), cl::cat(PollyCategory));
203
204namespace {
205
206/// Initialize Polly passes when library is loaded.
207///
208/// We use the constructor of a statically declared object to initialize the
209/// different Polly passes right after the Polly library is loaded. This ensures
210/// that the Polly passes are available e.g. in the 'opt' tool.
211struct StaticInitializer {
212 StaticInitializer() {
213 llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry();
215 }
216};
217static StaticInitializer InitializeEverything;
218} // end of anonymous namespace.
219
220void initializePollyPasses(llvm::PassRegistry &Registry) {
222
255}
256
258
260 // FIXME: PollyTrackFailures is user-controlled, should not be set
261 // programmatically.
263 PollyTrackFailures = true;
264
267}
268
269/// Register Polly passes such that they form a polyhedral optimizer.
270///
271/// The individual Polly passes are registered in the pass manager such that
272/// they form a full polyhedral optimizer. The flow of the optimizer starts with
273/// a set of preparing transformations that canonicalize the LLVM-IR such that
274/// the LLVM-IR is easier for us to understand and to optimizes. On the
275/// canonicalized LLVM-IR we first run the ScopDetection pass, which detects
276/// static control flow regions. Those regions are then translated by the
277/// ScopInfo pass into a polyhedral representation. As a next step, a scheduling
278/// optimizer is run on the polyhedral representation and finally the optimized
279/// polyhedral representation is code generated back to LLVM-IR.
280///
281/// Besides this core functionality, we optionally schedule passes that provide
282/// a graphical view of the scops (Polly[Only]Viewer, Polly[Only]Printer), that
283/// allow the export/import of the polyhedral representation
284/// (JSCON[Exporter|Importer]) or that show the cfg after code generation.
285///
286/// For certain parts of the Polly optimizer, several alternatives are provided:
287///
288/// As scheduling optimizer we support the isl scheduling optimizer
289/// (http://freecode.com/projects/isl).
290/// It is also possible to run Polly with no optimizer. This mode is mainly
291/// provided to analyze the run and compile time changes caused by the
292/// scheduling optimizer.
293///
294/// Polly supports the isl internal code generator.
295
296/// Add the pass sequence required for Polly to the New Pass Manager.
297///
298/// @param PM The pass manager itself.
299/// @param Level The optimization level. Used for the cleanup of Polly's
300/// output.
301/// @param EnableForOpt Whether to add Polly IR transformations. If False, only
302/// the analysis passes are added, skipping Polly itself.
303/// The IR may still be modified.
304static void buildCommonPollyPipeline(FunctionPassManager &PM,
305 OptimizationLevel Level,
306 bool EnableForOpt) {
307 PassBuilder PB;
308 ScopPassManager SPM;
309
310 PM.addPass(CodePreparationPass());
311
312 // TODO add utility passes for the various command line options, once they're
313 // ported
314
315 if (PollyDetectOnly) {
316 // Don't add more passes other than the ScopPassManager's detection passes.
317 PM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
318 return;
319 }
320
321 if (PollyViewer)
322 PM.addPass(ScopViewer());
323 if (PollyOnlyViewer)
324 PM.addPass(ScopOnlyViewer());
325 if (PollyPrinter)
326 PM.addPass(ScopPrinter());
328 PM.addPass(ScopOnlyPrinter());
329 if (EnableSimplify)
330 SPM.addPass(SimplifyPass(0));
332 SPM.addPass(ForwardOpTreePass());
333 if (EnableDeLICM)
334 SPM.addPass(DeLICMPass());
335 if (EnableSimplify)
336 SPM.addPass(SimplifyPass(1));
337
338 if (ImportJScop)
339 SPM.addPass(JSONImportPass());
340
341 if (DeadCodeElim)
342 SPM.addPass(DeadCodeElimPass());
343
345 SPM.addPass(MaximalStaticExpansionPass());
346
348 SPM.addPass(PruneUnprofitablePass());
349
350 switch (Optimizer) {
351 case OPTIMIZER_NONE:
352 break; /* Do nothing */
353 case OPTIMIZER_ISL:
354 SPM.addPass(IslScheduleOptimizerPass());
355 break;
356 }
357
358 if (ExportJScop)
359 SPM.addPass(JSONExportPass());
360
361 if (!EnableForOpt)
362 return;
363
364 switch (CodeGeneration) {
365 case CODEGEN_AST:
366 SPM.addPass(
367 llvm::RequireAnalysisPass<IslAstAnalysis, Scop, ScopAnalysisManager,
369 SPMUpdater &>());
370 break;
371 case CODEGEN_FULL:
372 SPM.addPass(CodeGenerationPass());
373 break;
374 case CODEGEN_NONE:
375 break;
376 }
377
378 PM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
379 PM.addPass(PB.buildFunctionSimplificationPipeline(
380 Level, llvm::ThinOrFullLTOPhase::None)); // Cleanup
381
382 if (CFGPrinter)
383 PM.addPass(llvm::CFGPrinterPass());
384}
385
386static void buildEarlyPollyPipeline(llvm::ModulePassManager &MPM,
387 llvm::OptimizationLevel Level) {
388 bool EnableForOpt =
389 shouldEnablePollyForOptimization() && Level.isOptimizingForSpeed();
390 if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
391 return;
392
393 FunctionPassManager FPM = buildCanonicalicationPassesForNPM(MPM, Level);
394
395 if (DumpBefore || !DumpBeforeFile.empty()) {
396 MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
397
398 if (DumpBefore)
399 MPM.addPass(DumpModulePass("-before", true));
400 for (auto &Filename : DumpBeforeFile)
401 MPM.addPass(DumpModulePass(Filename, false));
402
403 FPM = FunctionPassManager();
404 }
405
406 buildCommonPollyPipeline(FPM, Level, EnableForOpt);
407 MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
408
409 if (DumpAfter)
410 MPM.addPass(DumpModulePass("-after", true));
411 for (auto &Filename : DumpAfterFile)
412 MPM.addPass(DumpModulePass(Filename, false));
413}
414
415static void buildLatePollyPipeline(FunctionPassManager &PM,
416 llvm::OptimizationLevel Level) {
417 bool EnableForOpt =
418 shouldEnablePollyForOptimization() && Level.isOptimizingForSpeed();
419 if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
420 return;
421
422 if (DumpBefore)
423 PM.addPass(DumpFunctionPass("-before"));
424 if (!DumpBeforeFile.empty())
425 llvm::report_fatal_error(
426 "Option -polly-dump-before-file at -polly-position=late "
427 "not supported with NPM",
428 false);
429
430 buildCommonPollyPipeline(PM, Level, EnableForOpt);
431
432 if (DumpAfter)
433 PM.addPass(DumpFunctionPass("-after"));
434 if (!DumpAfterFile.empty())
435 llvm::report_fatal_error(
436 "Option -polly-dump-after-file at -polly-position=late "
437 "not supported with NPM",
438 false);
439}
440
441static llvm::Expected<std::monostate> parseNoOptions(StringRef Params) {
442 if (!Params.empty())
443 return make_error<StringError>(
444 formatv("'{0}' passed to pass that does not take any options", Params)
445 .str(),
446 inconvertibleErrorCode());
447
448 return std::monostate{};
449}
450
452createScopAnalyses(FunctionAnalysisManager &FAM,
453 PassInstrumentationCallbacks *PIC) {
455#define SCOP_ANALYSIS(NAME, CREATE_PASS) \
456 Proxy.getManager().registerPass([PIC] { \
457 (void)PIC; \
458 return CREATE_PASS; \
459 });
460#include "PollyPasses.def"
461
462 Proxy.getManager().registerPass(
463 [&FAM] { return FunctionAnalysisManagerScopProxy(FAM); });
464 return Proxy;
465}
466
467static void registerFunctionAnalyses(FunctionAnalysisManager &FAM,
468 PassInstrumentationCallbacks *PIC) {
469
470#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
471 FAM.registerPass([] { return CREATE_PASS; });
472
473#include "PollyPasses.def"
474
475 FAM.registerPass([&FAM, PIC] { return createScopAnalyses(FAM, PIC); });
476}
477
478static llvm::Expected<bool>
479parseCGPipeline(StringRef Name, llvm::CGSCCPassManager &CGPM,
480 PassInstrumentationCallbacks *PIC,
481 ArrayRef<PassBuilder::PipelineElement> Pipeline) {
482#define CGSCC_PASS(NAME, CREATE_PASS, PARSER) \
483 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
484 auto Params = PassBuilder::parsePassParameters(PARSER, Name, NAME); \
485 if (!Params) \
486 return Params.takeError(); \
487 CGPM.addPass(CREATE_PASS); \
488 return true; \
489 }
490#include "PollyPasses.def"
491
492 return false;
493}
494
495static bool
496parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
497 ArrayRef<PassBuilder::PipelineElement> Pipeline) {
498 if (llvm::parseAnalysisUtilityPasses<OwningScopAnalysisManagerFunctionProxy>(
499 "polly-scop-analyses", Name, FPM))
500 return true;
501
502#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
503 if (llvm::parseAnalysisUtilityPasses< \
504 std::remove_reference<decltype(CREATE_PASS)>::type>(NAME, Name, \
505 FPM)) \
506 return true;
507
508#define FUNCTION_PASS(NAME, CREATE_PASS) \
509 if (Name == NAME) { \
510 FPM.addPass(CREATE_PASS); \
511 return true; \
512 }
513
514#include "PollyPasses.def"
515 return false;
516}
517
518static bool parseScopPass(StringRef Name, ScopPassManager &SPM,
519 PassInstrumentationCallbacks *PIC) {
520#define SCOP_ANALYSIS(NAME, CREATE_PASS) \
521 if (llvm::parseAnalysisUtilityPasses< \
522 std::remove_reference<decltype(CREATE_PASS)>::type>(NAME, Name, \
523 SPM)) \
524 return true;
525
526#define SCOP_PASS(NAME, CREATE_PASS) \
527 if (Name == NAME) { \
528 SPM.addPass(CREATE_PASS); \
529 return true; \
530 }
531
532#include "PollyPasses.def"
533
534 return false;
535}
536
537static bool parseScopPipeline(StringRef Name, FunctionPassManager &FPM,
538 PassInstrumentationCallbacks *PIC,
539 ArrayRef<PassBuilder::PipelineElement> Pipeline) {
540 if (Name != "scop")
541 return false;
542 if (!Pipeline.empty()) {
543 ScopPassManager SPM;
544 for (const auto &E : Pipeline)
545 if (!parseScopPass(E.Name, SPM, PIC))
546 return false;
547 FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
548 }
549 return true;
550}
551
552static bool isScopPassName(StringRef Name) {
553#define SCOP_ANALYSIS(NAME, CREATE_PASS) \
554 if (Name == "require<" NAME ">") \
555 return true; \
556 if (Name == "invalidate<" NAME ">") \
557 return true;
558
559#define SCOP_PASS(NAME, CREATE_PASS) \
560 if (Name == NAME) \
561 return true;
562
563#include "PollyPasses.def"
564
565 return false;
566}
567
568static bool
569parseTopLevelPipeline(llvm::ModulePassManager &MPM,
570 PassInstrumentationCallbacks *PIC,
571 ArrayRef<PassBuilder::PipelineElement> Pipeline) {
572 StringRef FirstName = Pipeline.front().Name;
573
574 if (!isScopPassName(FirstName))
575 return false;
576
577 FunctionPassManager FPM;
578 ScopPassManager SPM;
579
580 for (auto &Element : Pipeline) {
581 auto &Name = Element.Name;
582 auto &InnerPipeline = Element.InnerPipeline;
583 if (!InnerPipeline.empty()) // Scop passes don't have inner pipelines
584 return false;
585 if (!parseScopPass(Name, SPM, PIC))
586 return false;
587 }
588
589 FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
590 MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
591
592 return true;
593}
594
595/// Register Polly to be available as an optimizer
596///
597///
598/// We can currently run Polly at two different points int the pass manager.
599/// a) very early, b) right before the vectorizer.
600///
601/// The default is currently a), to register Polly such that it runs as early as
602/// possible. This has several implications:
603///
604/// 1) We need to schedule more canonicalization passes
605///
606/// As nothing is run before Polly, it is necessary to run a set of preparing
607/// transformations before Polly to canonicalize the LLVM-IR and to allow
608/// Polly to detect and understand the code.
609///
610/// 2) We get the full -O3 optimization sequence after Polly
611///
612/// The LLVM-IR that is generated by Polly has been optimized on a high level,
613/// but it may be rather inefficient on the lower/scalar level. By scheduling
614/// Polly before all other passes, we have the full sequence of -O3
615/// optimizations behind us, such that inefficiencies on the low level can
616/// be optimized away.
617///
618/// We are currently evaluating the benefit or running Polly at b). b) is nice
619/// as everything is fully inlined and canonicalized, but we need to be able to
620/// handle LICMed code to make it useful.
621void registerPollyPasses(PassBuilder &PB) {
622 PassInstrumentationCallbacks *PIC = PB.getPassInstrumentationCallbacks();
623 PB.registerAnalysisRegistrationCallback([PIC](FunctionAnalysisManager &FAM) {
624 registerFunctionAnalyses(FAM, PIC);
625 });
626 PB.registerPipelineParsingCallback(parseFunctionPipeline);
627 PB.registerPipelineParsingCallback(
628 [PIC](StringRef Name, FunctionPassManager &FPM,
629 ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
630 return parseScopPipeline(Name, FPM, PIC, Pipeline);
631 });
632 PB.registerPipelineParsingCallback(
633 [PIC](StringRef Name, CGSCCPassManager &CGPM,
634 ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
635 ExitOnError Err("Unable to parse Polly call graph pass: ");
636 return Err(parseCGPipeline(Name, CGPM, PIC, Pipeline));
637 });
638 PB.registerParseTopLevelPipelineCallback(
639 [PIC](llvm::ModulePassManager &MPM,
640 ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
641 return parseTopLevelPipeline(MPM, PIC, Pipeline);
642 });
643
644 switch (PassPosition) {
645 case POSITION_EARLY:
646 PB.registerPipelineStartEPCallback(buildEarlyPollyPipeline);
647 break;
649 PB.registerVectorizerStartEPCallback(buildLatePollyPipeline);
650 break;
651 }
652}
653} // namespace polly
654
655llvm::PassPluginLibraryInfo getPollyPluginInfo() {
656 return {LLVM_PLUGIN_API_VERSION, "Polly", LLVM_VERSION_STRING,
658}
llvm::cl::OptionCategory PollyCategory
llvm::PassPluginLibraryInfo getPollyPluginInfo()
Static Control Part.
Definition ScopInfo.h:1630
const char * str
Definition isl_test.c:2095
void initializeScopDetectionWrapperPassPass(llvm::PassRegistry &)
void initializeScopInfoPrinterLegacyRegionPassPass(llvm::PassRegistry &)
void initializeDependenceInfoWrapperPassPass(llvm::PassRegistry &)
void initializeScopInfoRegionPassPass(PassRegistry &)
void initializeScopInfoPrinterLegacyFunctionPassPass(PassRegistry &)
void initializeDependenceInfoPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeCodeGenerationPass(llvm::PassRegistry &)
void initializeIslAstInfoPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeMaximalStaticExpanderWrapperPassPass(llvm::PassRegistry &)
void initializeSimplifyWrapperPassPass(llvm::PassRegistry &)
void initializeScopDetectionPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeJSONImporterPass(llvm::PassRegistry &)
void initializePollyCanonicalizePass(llvm::PassRegistry &)
void initializeIslAstInfoWrapperPassPass(llvm::PassRegistry &)
void initializePruneUnprofitableWrapperPassPass(llvm::PassRegistry &)
void initializeFlattenSchedulePrinterLegacyPassPass(llvm::PassRegistry &)
void initializeForwardOpTreeWrapperPassPass(PassRegistry &)
void initializeJSONExporterPass(llvm::PassRegistry &)
void initializeScopInlinerWrapperPassPass(llvm::PassRegistry &)
void initializeDependenceInfoPass(llvm::PassRegistry &)
void initializeIslScheduleOptimizerWrapperPassPass(llvm::PassRegistry &)
void initializeDumpModuleWrapperPassPass(llvm::PassRegistry &)
void initializeDependenceInfoPrinterLegacyFunctionPassPass(llvm::PassRegistry &)
void initializeSimplifyPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeScopInfoWrapperPassPass(PassRegistry &)
void initializeCodePreparationPass(llvm::PassRegistry &)
void initializeFlattenSchedulePass(llvm::PassRegistry &)
void initializeIslScheduleOptimizerPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeDeLICMPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeDeLICMWrapperPassPass(llvm::PassRegistry &)
void initializeJSONImporterPrinterLegacyPassPass(llvm::PassRegistry &)
void initializeForwardOpTreePrinterLegacyPassPass(PassRegistry &)
void initializeDeadCodeElimWrapperPassPass(llvm::PassRegistry &)
static cl::opt< bool > ExportJScop("polly-export", cl::desc("Export the polyhedral description of the detected Scops"), cl::Hidden, cl::cat(PollyCategory))
static cl::opt< bool > FullyIndexedStaticExpansion("polly-enable-mse", cl::desc("Fully expand the memory accesses of the detected Scops"), cl::Hidden, cl::cat(PollyCategory))
@ POSITION_BEFORE_VECTORIZER
static bool parseTopLevelPipeline(llvm::ModulePassManager &MPM, PassInstrumentationCallbacks *PIC, ArrayRef< PassBuilder::PipelineElement > Pipeline)
static cl::list< std::string > DumpBeforeFile("polly-dump-before-file", cl::desc("Dump module before Polly transformations to the given file"), cl::cat(PollyCategory))
static bool shouldEnablePollyForDiagnostic()
FunctionToScopPassAdaptor< ScopPassT > createFunctionToScopPassAdaptor(ScopPassT Pass)
Definition ScopPass.h:287
static cl::opt< VectorizerChoice, true > Vectorizer("polly-vectorizer", cl::desc("Select the vectorization strategy"), cl::values(clEnumValN(VECTORIZER_NONE, "none", "No Vectorization"), clEnumValN(VECTORIZER_STRIPMINE, "stripmine", "Strip-mine outer loops for the loop-vectorizer to trigger")), cl::location(PollyVectorizerChoice), cl::init(VECTORIZER_NONE), cl::cat(PollyCategory))
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))
static void buildLatePollyPipeline(FunctionPassManager &PM, llvm::OptimizationLevel Level)
static cl::opt< bool > EnableSimplify("polly-enable-simplify", cl::desc("Simplify SCoP after optimizations"), cl::init(true), cl::cat(PollyCategory))
bool PollyTrackFailures
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::cat(PollyCategory))
void registerPollyPasses(llvm::PassBuilder &PB)
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::cat(PollyCategory))
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))
static cl::opt< bool > PollyEnabled("polly", cl::desc("Enable the polly optimizer (with -O1, -O2 or -O3)"), cl::cat(PollyCategory))
@ VECTORIZER_STRIPMINE
@ VECTORIZER_NONE
VectorizerChoice PollyVectorizerChoice
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))
void initializePollyPasses(llvm::PassRegistry &Registry)
static llvm::Expected< bool > parseCGPipeline(StringRef Name, llvm::CGSCCPassManager &CGPM, PassInstrumentationCallbacks *PIC, ArrayRef< PassBuilder::PipelineElement > Pipeline)
PassManager< Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater & > ScopPassManager
Definition ScopPass.h:154
static cl::opt< bool > EnableForwardOpTree("polly-enable-optree", cl::desc("Enable operand tree forwarding"), cl::Hidden, cl::init(true), cl::cat(PollyCategory))
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))
static bool parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM, ArrayRef< PassBuilder::PipelineElement > Pipeline)
static cl::opt< bool > PollyDetectOnly("polly-only-scop-detection", cl::desc("Only run scop detection, but no other optimizations"), cl::cat(PollyCategory))
OuterAnalysisManagerProxy< FunctionAnalysisManager, Scop, ScopStandardAnalysisResults & > FunctionAnalysisManagerScopProxy
Definition ScopPass.h:49
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))
static bool isScopPassName(StringRef Name)
static void registerFunctionAnalyses(FunctionAnalysisManager &FAM, PassInstrumentationCallbacks *PIC)
static cl::opt< bool > DeadCodeElim("polly-run-dce", cl::desc("Run the dead code elimination"), cl::Hidden, cl::cat(PollyCategory))
static void buildCommonPollyPipeline(FunctionPassManager &PM, OptimizationLevel Level, bool EnableForOpt)
Register Polly passes such that they form a polyhedral optimizer.
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))
static cl::opt< bool > EnableDeLICM("polly-enable-delicm", cl::desc("Eliminate scalar loop carried dependences"), cl::Hidden, cl::init(true), cl::cat(PollyCategory))
static OwningScopAnalysisManagerFunctionProxy createScopAnalyses(FunctionAnalysisManager &FAM, PassInstrumentationCallbacks *PIC)
static bool parseScopPipeline(StringRef Name, FunctionPassManager &FPM, PassInstrumentationCallbacks *PIC, ArrayRef< PassBuilder::PipelineElement > Pipeline)
static cl::opt< bool > ImportJScop("polly-import", cl::desc("Import the polyhedral description of the detected Scops"), cl::Hidden, cl::cat(PollyCategory))
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))
llvm::FunctionPassManager buildCanonicalicationPassesForNPM(llvm::ModulePassManager &MPM, llvm::OptimizationLevel Level)
OwningInnerAnalysisManagerProxy< ScopAnalysisManager, Function > OwningScopAnalysisManagerFunctionProxy
Definition ScopPass.h:152
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_BEFORE_VECTORIZER, "before-vectorizer", "Right before the vectorizer")), cl::Hidden, cl::init(POSITION_BEFORE_VECTORIZER), cl::cat(PollyCategory))
static cl::list< std::string > DumpAfterFile("polly-dump-after-file", cl::desc("Dump module after Polly transformations to the given file"), cl::cat(PollyCategory))
static bool shouldEnablePollyForOptimization()
static llvm::Expected< std::monostate > parseNoOptions(StringRef Params)
AnalysisManager< Scop, ScopStandardAnalysisResults & > ScopAnalysisManager
Definition ScopPass.h:45
static void buildEarlyPollyPipeline(llvm::ModulePassManager &MPM, llvm::OptimizationLevel Level)
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::cat(PollyCategory))
static bool parseScopPass(StringRef Name, ScopPassManager &SPM, PassInstrumentationCallbacks *PIC)
A pass that isolates a function into a new Module and writes it into a file.
A pass that prints the module into a file.
This pass exports a scop to a jscop file.
This pass imports a scop from a jscop file.