diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-04-24 16:12:30 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-04-24 16:12:30 +0000 |
commit | 58eee8f10649b8ac51dec7f91e5e3a7f68056637 (patch) | |
tree | e0cca1c18bc655c41b7a887b0edf4e1ff1139699 | |
parent | c8d223e41e3e80f29c23978aeb3839cda6d13086 (diff) | |
download | bcm5719-llvm-58eee8f10649b8ac51dec7f91e5e3a7f68056637.tar.gz bcm5719-llvm-58eee8f10649b8ac51dec7f91e5e3a7f68056637.zip |
Unify the optimizer selection.
We now support -polly-optimizer=isl, -polly-optimizer=pocc and
-polly-optimizer=none. The option -polly-no-optimizer is gone.
llvm-svn: 155445
-rw-r--r-- | polly/include/polly/RegisterPasses.h | 1 | ||||
-rw-r--r-- | polly/lib/RegisterPasses.cpp | 66 | ||||
-rw-r--r-- | polly/www/example_load_Polly_into_clang.html | 22 |
3 files changed, 44 insertions, 45 deletions
diff --git a/polly/include/polly/RegisterPasses.h b/polly/include/polly/RegisterPasses.h index a0ce12bb72f..8f76242ab6b 100644 --- a/polly/include/polly/RegisterPasses.h +++ b/polly/include/polly/RegisterPasses.h @@ -23,5 +23,4 @@ void registerPollyPreoptPasses(llvm::PassManagerBase &PM); // Register the Polly optimizer (including its preoptimizations). void registerPollyPasses(llvm::PassManagerBase &PM, - bool DisableScheduler = false, bool DisableCodegen = false); diff --git a/polly/lib/RegisterPasses.cpp b/polly/lib/RegisterPasses.cpp index eb27138ec69..6161768be39 100644 --- a/polly/lib/RegisterPasses.cpp +++ b/polly/lib/RegisterPasses.cpp @@ -37,18 +37,30 @@ PollyEnabled("polly", cl::desc("Enable the default passes of Polly in -O3"), cl::init(false), cl::ZeroOrMore); static cl::opt<bool> -DisableScheduler("polly-no-optimizer", - cl::desc("Disable Polly Scheduling Optimizer"), cl::Hidden, - cl::init(false), cl::ZeroOrMore); -static cl::opt<bool> DisableCodegen("polly-no-codegen", cl::desc("Disable Polly Code Generation"), cl::Hidden, cl::init(false), cl::ZeroOrMore); -static cl::opt<std::string> + +enum OptimizerChoice { + OPTIMIZER_NONE, +#ifdef SCOPLIB_FOUND + OPTIMIZER_POCC, +#endif + OPTIMIZER_ISL +}; + +static cl::opt<OptimizerChoice> Optimizer("polly-optimizer", - cl::desc("Select the scheduling optimizer. " - "Either isl (default) or pocc."), - cl::Hidden, cl::init("isl")); + cl::desc("Select the scheduling optimizer"), + cl::values( + clEnumValN(OPTIMIZER_NONE, "none", "No optimizer"), +#ifdef SCOPLIB_FOUND + clEnumValN(OPTIMIZER_POCC, "pocc", "The PoCC scheduling optimizer"), +#endif + clEnumValN(OPTIMIZER_ISL, "isl", "The isl scheduling optimizer"), + clEnumValEnd), + cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore); + static cl::opt<bool> ImportJScop("polly-run-import-jscop", cl::desc("Export the JScop description of the detected Scops"), @@ -161,9 +173,7 @@ void registerPollyPreoptPasses(llvm::PassManagerBase &PM) { PM.add(polly::createRegionSimplifyPass()); } -void registerPollyPasses(llvm::PassManagerBase &PM, bool DisableScheduler, - bool DisableCodegen) { - bool RunScheduler = !DisableScheduler; +void registerPollyPasses(llvm::PassManagerBase &PM, bool DisableCodegen) { bool RunCodegen = !DisableCodegen; registerPollyPreoptPasses(PM); @@ -185,23 +195,19 @@ void registerPollyPasses(llvm::PassManagerBase &PM, bool DisableScheduler, if (DeadCodeElim) PM.add(polly::createDeadCodeElimPass()); - if (RunScheduler) { - if (Optimizer == "pocc") { + switch (Optimizer) { + case OPTIMIZER_NONE: + break; /* Do nothing */ + #ifdef SCOPLIB_FOUND - PM.add(polly::createPoccPass()); -#else - errs() << "Polly is compiled without scoplib support. As scoplib is " - "required to run PoCC, PoCC is also not available. Falling " - "back to the isl optimizer.\n"; - PM.add(polly::createIslScheduleOptimizerPass()); + case OPTIMIZER_POCC + PM.add(polly::createPoccPass()); + break; #endif - } else if (Optimizer == "isl") { - PM.add(polly::createIslScheduleOptimizerPass()); - } else { - errs() << "Invalid optimizer. Only 'isl' and 'pocc' allowed. " - "Falling back to 'isl'.\n"; - PM.add(polly::createIslScheduleOptimizerPass()); - } + + case OPTIMIZER_ISL: + PM.add(polly::createIslScheduleOptimizerPass()); + break; } if (ExportJScop) @@ -219,7 +225,7 @@ void registerPollyPasses(llvm::PassManagerBase &PM, bool DisableScheduler, static void registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder, - llvm::PassManagerBase &PM) { + llvm::PassManagerBase &PM) { if (Builder.OptLevel == 0) return; @@ -233,10 +239,6 @@ void registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder, errs() << "The option -polly-no-codegen has no effect. " "Polly was not enabled\n"; - if (DisableScheduler) - errs() << "The option -polly-no-optimizer has no effect. " - "Polly was not enabled\n"; - return; } @@ -246,7 +248,7 @@ void registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder, return; } - registerPollyPasses(PM, DisableScheduler, DisableCodegen); + registerPollyPasses(PM, DisableCodegen); } static void registerPollyOptLevel0Passes(const llvm::PassManagerBuilder &, diff --git a/polly/www/example_load_Polly_into_clang.html b/polly/www/example_load_Polly_into_clang.html index a148fafcbed..6e9bc50f502 100644 --- a/polly/www/example_load_Polly_into_clang.html +++ b/polly/www/example_load_Polly_into_clang.html @@ -96,18 +96,16 @@ function a dot file that highlights the detected SCoPs. If 'only' is appended at the end of the option, the basic blocks are shown without the statements the contain. -<h3>Disable the polyhedral optimizer</h3> - -Polly automatically runs by default a polyhedral optimizer to optimize the -schedules. <b>-polly-no-optimizer</b> disables this optimizer. - -<h3>Change the Polly optimizer</h3> -Polly uses by default the isl scheduling optimizer, a new implementation of the -well known Pluto algorithm. The main reason for the isl scheduler being the -default is that it does not require any additional libraries or tools to be -installed. As the new scheduler may still have some bugs and because being -able to compare is good in general, it is possible to switch the used optimizer -back to PoCC. For this add the option <b>-polly-optimizer=pocc</b>. +<h3>Change/Disable the Optimizer</h3> +Polly uses by default the isl scheduling optimizer. The isl optimizer optimizes +for data-locality and parallelism using the <a +href=http://pluto-compiler.sf.net">Pluto</a> algorithm. For research it is also +possible to run <a +href="http://www-rocq.inria.fr/~pouchet/software/pocc/">PoCC</a> as external +optimizer. PoCC provides access to the original Pluto implementation. To use +PoCC add <b>-polly-optimizer=pocc</b> to the command line (only available if +Polly was compiled with scoplib support). To disable the +optimizer entirely use the option <b>-polly-optimizer=none</b>. <h3>Disable tiling in the optimizer</h3> By default both optimizers perform tiling, if possible. In case this is not |