[polly] r204255 - Move Pass registration into polly library

Tobias Grosser tobias at grosser.es
Wed Mar 19 10:54:23 PDT 2014


Author: grosser
Date: Wed Mar 19 12:54:23 2014
New Revision: 204255

URL: http://llvm.org/viewvc/llvm-project?rev=204255&view=rev
Log:
Move Pass registration into polly library

This ensures that the polly passes get properly registered both, when using
polly as a loadable module and when directly linking it into clang/opt/bugpoint.

Modified:
    polly/trunk/include/polly/RegisterPasses.h
    polly/trunk/lib/Polly.cpp
    polly/trunk/lib/Support/RegisterPasses.cpp

Modified: polly/trunk/include/polly/RegisterPasses.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/RegisterPasses.h?rev=204255&r1=204254&r2=204255&view=diff
==============================================================================
--- polly/trunk/include/polly/RegisterPasses.h (original)
+++ polly/trunk/include/polly/RegisterPasses.h Wed Mar 19 12:54:23 2014
@@ -24,7 +24,5 @@ class PassManagerBase;
 
 namespace polly {
 void initializePollyPasses(llvm::PassRegistry &Registry);
-void registerPollyPasses(llvm::PassManagerBase &PM);
-bool shouldEnablePolly();
 }
 #endif

Modified: polly/trunk/lib/Polly.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Polly.cpp?rev=204255&r1=204254&r2=204255&view=diff
==============================================================================
--- polly/trunk/lib/Polly.cpp (original)
+++ polly/trunk/lib/Polly.cpp Wed Mar 19 12:54:23 2014
@@ -27,45 +27,4 @@ public:
   }
 };
 static StaticInitializer InitializeEverything;
-
-static void
-registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
-                                   llvm::PassManagerBase &PM) {
-
-  if (!polly::shouldEnablePolly())
-    return;
-
-  polly::registerPollyPasses(PM);
-}
-
-/// @brief Register Polly to be available as an optimizer
-///
-/// We currently register Polly such that it runs as early as possible. This has
-/// several implications:
-///
-///   1) We need to schedule more canonicalization passes
-///
-///   As nothing is run before Polly, it is necessary to run a set of preparing
-///   transformations before Polly to canonicalize the LLVM-IR and to allow
-///   Polly to detect and understand the code.
-///
-///   2) LICM and LoopIdiom pass have not yet been run
-///
-///   Loop invariant code motion as well as the loop idiom recognition pass make
-///   it more difficult for Polly to transform code. LICM may introduce
-///   additional data dependences that are hard to eliminate and the loop idiom
-///   recognition pass may introduce calls to memset that we currently do not
-///   understand. By running Polly early enough (meaning before these passes) we
-///   avoid difficulties that may be introduced by these passes.
-///
-///   3) We get the full -O3 optimization sequence after Polly
-///
-///   The LLVM-IR that is generated by Polly has been optimized on a high level,
-///   but it may be rather inefficient on the lower/scalar level. By scheduling
-///   Polly before all other passes, we have the full sequence of -O3
-///   optimizations behind us, such that inefficiencies on the low level can
-///   be optimized away.
-static llvm::RegisterStandardPasses
-RegisterPollyOptimizer(llvm::PassManagerBuilder::EP_EarlyAsPossible,
-                       registerPollyEarlyAsPossiblePasses);
 } // end of anonymous namespace.

Modified: polly/trunk/lib/Support/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/RegisterPasses.cpp?rev=204255&r1=204254&r2=204255&view=diff
==============================================================================
--- polly/trunk/lib/Support/RegisterPasses.cpp (original)
+++ polly/trunk/lib/Support/RegisterPasses.cpp Wed Mar 19 12:54:23 2014
@@ -210,7 +210,7 @@ void initializePollyPasses(PassRegistry
 /// Polly supports both CLooG (http://www.cloog.org) as well as the isl internal
 /// code generator. For the moment, the CLooG code generator is enabled by
 /// default.
-void registerPollyPasses(llvm::PassManagerBase &PM) {
+static void registerPollyPasses(llvm::PassManagerBase &PM) {
   registerCanonicalicationPasses(PM, SCEVCodegen);
 
   PM.add(polly::createScopInfoPass());
@@ -276,7 +276,7 @@ void registerPollyPasses(llvm::PassManag
     PM.add(llvm::createCFGPrinterPass());
 }
 
-bool shouldEnablePolly() {
+static bool shouldEnablePolly() {
   if (PollyOnlyPrinter || PollyPrinter || PollyOnlyViewer || PollyViewer)
     PollyTrackFailures = true;
 
@@ -286,4 +286,44 @@ bool shouldEnablePolly() {
 
   return PollyEnabled;
 }
+
+static void
+registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
+                                   llvm::PassManagerBase &PM) {
+  if (!polly::shouldEnablePolly())
+    return;
+
+  polly::registerPollyPasses(PM);
+}
+
+/// @brief Register Polly to be available as an optimizer
+///
+/// We currently register Polly such that it runs as early as possible. This has
+/// several implications:
+///
+///   1) We need to schedule more canonicalization passes
+///
+///   As nothing is run before Polly, it is necessary to run a set of preparing
+///   transformations before Polly to canonicalize the LLVM-IR and to allow
+///   Polly to detect and understand the code.
+///
+///   2) LICM and LoopIdiom pass have not yet been run
+///
+///   Loop invariant code motion as well as the loop idiom recognition pass make
+///   it more difficult for Polly to transform code. LICM may introduce
+///   additional data dependences that are hard to eliminate and the loop idiom
+///   recognition pass may introduce calls to memset that we currently do not
+///   understand. By running Polly early enough (meaning before these passes) we
+///   avoid difficulties that may be introduced by these passes.
+///
+///   3) We get the full -O3 optimization sequence after Polly
+///
+///   The LLVM-IR that is generated by Polly has been optimized on a high level,
+///   but it may be rather inefficient on the lower/scalar level. By scheduling
+///   Polly before all other passes, we have the full sequence of -O3
+///   optimizations behind us, such that inefficiencies on the low level can
+///   be optimized away.
+static llvm::RegisterStandardPasses
+RegisterPollyOptimizer(llvm::PassManagerBuilder::EP_EarlyAsPossible,
+                       registerPollyEarlyAsPossiblePasses);
 }





More information about the llvm-commits mailing list