[llvm-commits] [polly] r155445 - in /polly/trunk: include/polly/RegisterPasses.h lib/RegisterPasses.cpp www/example_load_Polly_into_clang.html

Tobias Grosser grosser at fim.uni-passau.de
Tue Apr 24 09:12:30 PDT 2012


Author: grosser
Date: Tue Apr 24 11:12:30 2012
New Revision: 155445

URL: http://llvm.org/viewvc/llvm-project?rev=155445&view=rev
Log:
Unify the optimizer selection.

We now support -polly-optimizer=isl, -polly-optimizer=pocc and
-polly-optimizer=none. The option -polly-no-optimizer is gone.

Modified:
    polly/trunk/include/polly/RegisterPasses.h
    polly/trunk/lib/RegisterPasses.cpp
    polly/trunk/www/example_load_Polly_into_clang.html

Modified: polly/trunk/include/polly/RegisterPasses.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/RegisterPasses.h?rev=155445&r1=155444&r2=155445&view=diff
==============================================================================
--- polly/trunk/include/polly/RegisterPasses.h (original)
+++ polly/trunk/include/polly/RegisterPasses.h Tue Apr 24 11:12:30 2012
@@ -23,5 +23,4 @@
 
 // Register the Polly optimizer (including its preoptimizations).
 void registerPollyPasses(llvm::PassManagerBase &PM,
-                         bool DisableScheduler = false,
                          bool DisableCodegen = false);

Modified: polly/trunk/lib/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegisterPasses.cpp?rev=155445&r1=155444&r2=155445&view=diff
==============================================================================
--- polly/trunk/lib/RegisterPasses.cpp (original)
+++ polly/trunk/lib/RegisterPasses.cpp Tue Apr 24 11:12:30 2012
@@ -37,18 +37,30 @@
              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 @@
   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 @@
   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 @@
 
 static
 void registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
-                                               llvm::PassManagerBase &PM) {
+                                        llvm::PassManagerBase &PM) {
 
   if (Builder.OptLevel == 0)
     return;
@@ -233,10 +239,6 @@
       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 @@
     return;
   }
 
-  registerPollyPasses(PM, DisableScheduler, DisableCodegen);
+  registerPollyPasses(PM, DisableCodegen);
 }
 
 static void registerPollyOptLevel0Passes(const llvm::PassManagerBuilder &,

Modified: polly/trunk/www/example_load_Polly_into_clang.html
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/example_load_Polly_into_clang.html?rev=155445&r1=155444&r2=155445&view=diff
==============================================================================
--- polly/trunk/www/example_load_Polly_into_clang.html (original)
+++ polly/trunk/www/example_load_Polly_into_clang.html Tue Apr 24 11:12:30 2012
@@ -96,18 +96,16 @@
 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





More information about the llvm-commits mailing list