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

Tobias Grosser grosser at fim.uni-passau.de
Thu Nov 17 11:10:48 PST 2011


Author: grosser
Date: Thu Nov 17 13:10:48 2011
New Revision: 144917

URL: http://llvm.org/viewvc/llvm-project?rev=144917&view=rev
Log:
RegisterPass: Disable Polly by default

We disable Polly by default and add a new option '-polly' that enables Polly.
This allows us to create an the alias

$ alias clang clang -Xclang -load -Xclang LLVMPolly.so

which loads Polly always into clang. It can now be enabled by running:

$ clang -O3 -mllvm -polly file.c

To enable it by default an alias pollycc can be create

$ alias pollycc clang -O3 -mllvm -polly

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

Modified: polly/trunk/lib/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegisterPasses.cpp?rev=144917&r1=144916&r2=144917&view=diff
==============================================================================
--- polly/trunk/lib/RegisterPasses.cpp (original)
+++ polly/trunk/lib/RegisterPasses.cpp Thu Nov 17 13:10:48 2011
@@ -29,6 +29,10 @@
 using namespace llvm;
 
 static cl::opt<bool>
+PollyEnabled("polly", cl::desc("Enable the default passes of Polly in -O3"),
+             cl::init(false));
+
+static cl::opt<bool>
 DisableScheduler("polly-no-optimizer",
                  cl::desc("Disable Polly Scheduling Optimizer"), cl::Hidden,
                  cl::init(false));
@@ -104,12 +108,37 @@
 
 static void registerPollyPasses(const llvm::PassManagerBuilder &Builder,
                                 llvm::PassManagerBase &PM) {
-  bool RunScheduler = !DisableScheduler;
-  bool RunCodegen = !DisableCodegen;
+  if (PollyOnlyPrinter || PollyPrinter || PollyOnlyViewer || PollyViewer ||
+      ExportJScop || ImportJScop)
+    PollyEnabled = true;
+
+  if (!PollyEnabled) {
+    if (UsePocc)
+      errs() << "The option -polly-use-pocc has no effect. "
+                "Polly was not enabled\n";
+
+    if (DisableCodegen)
+      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;
+  }
 
   // Polly is only enabled at -O3
-  if (Builder.OptLevel != 3)
+  if (Builder.OptLevel != 3) {
+    errs() << "Polly should only be run with -O3. Disabling Polly.\n";
     return;
+  }
+
+  bool RunScheduler = !DisableScheduler;
+  bool RunCodegen = !DisableCodegen;
+
+
+
 
   // A standard set of optimization passes partially taken/copied from the
   // set of default optimization passes. It is used to bring the code into

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=144917&r1=144916&r2=144917&view=diff
==============================================================================
--- polly/trunk/www/example_load_Polly_into_clang.html (original)
+++ polly/trunk/www/example_load_Polly_into_clang.html Thu Nov 17 13:10:48 2011
@@ -15,37 +15,49 @@
 <h1>Load Polly into clang and automatically run it at -O3</h1>
 <!--=====================================================================-->
 
-<p>Warning: This example makes it very easy to use Polly. Still, please be aware
-that Polly is a young research project. It is expected to crash, produce
-invalid code or to hang in complex calculations even for simple examples. In
-case you see such a problem, please check the <a href="bugs.html">Bug
-database</a> and consider reporting the bug.
-<h2>Compiling code with Polly</h2>
-
-To compile code with Polly you only need to add <b>-Xclang -load -Xclang
-${POLLY_BUILD_DIR}/lib/LLVMPolly.so</b> to your command line or your CFLAGS and
-Polly is automatically executed at -O3.
-
+<p><b>Warning:</b> Even though this example makes it very easy to use Polly,
+you should be aware that Polly is a young research project. It is expected
+to crash, produce invalid code or to hang in complex calculations even for
+simple examples. In case you see such a problem, please check the <a
+href="bugs.html">Bug database</a> and consider reporting a bug.
 <p>
-<b>WARNING: clang/LLVM/Polly need to be in sync. This means
+<b>Warning II:</b> clang/LLVM/Polly need to be in sync. This means
             you need to compile them yourself from a recent svn/git checkout</b>
-            </p>
+<h2>Load Polly into clang</h2>
+
+By loading Polly into clang (or opt) the Polly options become automatically
+available. You can load Polly either by adding the relevant commands to
+the CPPFLAGS or by creating an alias.
+
+<pre class="code">
+$ export CPPFLAGS="-Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so"
+</pre>
+
+or
+<pre class="code">
+$ alias pollycc clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so
+</pre>
+
+<h2>Optimizing with Polly</h2>
+
+Optimizing with Polly is as easy as ading <b>-O3 -polly</b> to your compiler
+flags (Polly is only available at -O3).
 
-<pre class="code">clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so -O3 file.c</pre>
+<pre class="code">pollycc -O3 -polly file.c</pre>
 
 <h2>Automatic OpenMP code generation</h2>
 
 To automatically detect parallel loops and generate OpenMP code for them you
 also need to add <b>-mllvm -enable-polly-openmp -lgomp</b> to your CFLAGS.
 
-<pre class="code">clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so -O3 -mllvm -enable-polly-openmp -lgomp file.c</pre>
+<pre class="code">pollycc -O3 -mllvm -enable-polly-openmp -lgomp file.c</pre>
 
 <h2>Automatic Vector code generation</h2>
 
 Automatic vector code generation can be enabled by adding <b>-mllvm
 -enable-polly-vector</b> to your CFLAGS.
 
-<pre class="code">clang -Xclang -load -Xclang ${POLLY_BUILD_DIR}/lib/LLVMPolly.so -O3 -mllvm -enable-polly-vector file.c</pre>
+<pre class="code">pollycc -O3 -mllvm -enable-polly-vector file.c</pre>
 
 <h2>Further options</h2>
 





More information about the llvm-commits mailing list