[llvm-commits] [polly] r141455 - in /polly/trunk: include/polly/Cloog.h include/polly/Dependences.h include/polly/LinkAllPasses.h include/polly/ScopDetection.h include/polly/ScopInfo.h include/polly/TempScopInfo.h lib/Analysis/Dependences.cpp lib/Analysis/ScopDetection.cpp lib/Analysis/ScopInfo.cpp lib/Analysis/TempScopInfo.cpp lib/Cloog.cpp lib/CodeGeneration.cpp lib/CodePreparation.cpp lib/IndependentBlocks.cpp lib/Pocc.cpp lib/RegionSimplify.cpp lib/RegisterPasses.cpp lib/ScheduleOptimizer.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Fri Oct 7 17:30:41 PDT 2011
Author: grosser
Date: Fri Oct 7 19:30:40 2011
New Revision: 141455
URL: http://llvm.org/viewvc/llvm-project?rev=141455&view=rev
Log:
Initialize the passes early and properly.
Modified:
polly/trunk/include/polly/Cloog.h
polly/trunk/include/polly/Dependences.h
polly/trunk/include/polly/LinkAllPasses.h
polly/trunk/include/polly/ScopDetection.h
polly/trunk/include/polly/ScopInfo.h
polly/trunk/include/polly/TempScopInfo.h
polly/trunk/lib/Analysis/Dependences.cpp
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Analysis/TempScopInfo.cpp
polly/trunk/lib/Cloog.cpp
polly/trunk/lib/CodeGeneration.cpp
polly/trunk/lib/CodePreparation.cpp
polly/trunk/lib/IndependentBlocks.cpp
polly/trunk/lib/Pocc.cpp
polly/trunk/lib/RegionSimplify.cpp
polly/trunk/lib/RegisterPasses.cpp
polly/trunk/lib/ScheduleOptimizer.cpp
Modified: polly/trunk/include/polly/Cloog.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Cloog.h?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/include/polly/Cloog.h (original)
+++ polly/trunk/include/polly/Cloog.h Fri Oct 7 19:30:40 2011
@@ -61,4 +61,9 @@
virtual void releaseMemory();
};
}
+
+namespace llvm {
+ class PassRegistry;
+ void initializeCloogInfoPass(llvm::PassRegistry&);
+}
#endif /* POLLY_CLOOG_H */
Modified: polly/trunk/include/polly/Dependences.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Dependences.h?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/include/polly/Dependences.h (original)
+++ polly/trunk/include/polly/Dependences.h Fri Oct 7 19:30:40 2011
@@ -108,4 +108,9 @@
};
} // End polly namespace.
+namespace llvm {
+ class PassRegistry;
+ void initializeDependencesPass(llvm::PassRegistry&);
+}
+
#endif
Modified: polly/trunk/include/polly/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/LinkAllPasses.h?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/include/polly/LinkAllPasses.h (original)
+++ polly/trunk/include/polly/LinkAllPasses.h Fri Oct 7 19:30:40 2011
@@ -21,6 +21,7 @@
namespace llvm {
class Pass;
class PassInfo;
+ class PassRegistry;
class RegionPass;
}
@@ -31,7 +32,7 @@
Pass *createCloogExporterPass();
Pass *createCloogInfoPass();
Pass *createCodeGenerationPass();
- Pass *createCodePreperationPass();
+ Pass *createCodePreparationPass();
Pass *createDependencesPass();
Pass *createDOTOnlyPrinterPass();
Pass *createDOTOnlyViewerPass();
@@ -43,7 +44,7 @@
Pass *createRegionSimplifyPass();
Pass *createScopDetectionPass();
Pass *createScopInfoPass();
- Pass *createScheduleOptimizerPass();
+ Pass *createIslScheduleOptimizerPass();
Pass *createTempScopInfoPass();
#ifdef OPENSCOP_FOUND
@@ -58,7 +59,7 @@
#endif
extern char &IndependentBlocksID;
- extern char &CodePreperationID;
+ extern char &CodePreparationID;
}
using namespace polly;
@@ -77,7 +78,7 @@
createCloogExporterPass();
createCloogInfoPass();
createCodeGenerationPass();
- createCodePreperationPass();
+ createCodePreparationPass();
createDependencesPass();
createDOTOnlyPrinterPass();
createDOTOnlyViewerPass();
@@ -89,7 +90,7 @@
createRegionSimplifyPass();
createScopDetectionPass();
createScopInfoPass();
- createScheduleOptimizerPass();
+ createIslScheduleOptimizerPass();
createTempScopInfoPass();
#ifdef OPENSCOP_FOUND
@@ -106,4 +107,16 @@
} PollyForcePassLinking; // Force link by creating a global definition.
}
+namespace llvm {
+ class PassRegistry;
+ void initializeCodeGenerationPass(llvm::PassRegistry&);
+ void initializeCodePreparationPass(llvm::PassRegistry&);
+ void initializeIndependentBlocksPass(llvm::PassRegistry&);
+ void initializeIslScheduleOptimizerPass(llvm::PassRegistry&);
+#ifdef SCOPLIB_FOUND
+ void initializePoccPass(llvm::PassRegistry&);
+#endif
+ void initializeRegionSimplifyPass(llvm::PassRegistry&);
+}
+
#endif
Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Fri Oct 7 19:30:40 2011
@@ -273,4 +273,9 @@
} //end namespace polly
+namespace llvm {
+ class PassRegistry;
+ void initializeScopDetectionPass(llvm::PassRegistry&);
+}
+
#endif
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Oct 7 19:30:40 2011
@@ -29,13 +29,13 @@
using namespace llvm;
namespace llvm {
- class SCEV;
- class ScalarEvolution;
- class SCEVAddRecExpr;
class Loop;
class LoopInfo;
- class Type;
class PHINode;
+ class ScalarEvolution;
+ class SCEV;
+ class SCEVAddRecExpr;
+ class Type;
}
struct isl_map;
@@ -596,4 +596,9 @@
} //end namespace polly
+namespace llvm {
+ class PassRegistry;
+ void initializeScopInfoPass(llvm::PassRegistry&);
+}
+
#endif
Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Fri Oct 7 19:30:40 2011
@@ -386,5 +386,9 @@
} // end namespace polly
+namespace llvm {
+ class PassRegistry;
+ void initializeTempScopInfoPass(llvm::PassRegistry&);
+}
#endif
Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Fri Oct 7 19:30:40 2011
@@ -448,8 +448,11 @@
char Dependences::ID = 0;
-static RegisterPass<Dependences>
-X("polly-dependences", "Polly - Calculate dependences for Scop");
+INITIALIZE_PASS_BEGIN(Dependences, "polly-dependences",
+ "Polly - Calculate dependences", false, false)
+INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+INITIALIZE_PASS_END(Dependences, "polly-dependences",
+ "Polly - Calculate dependences", false, false)
Pass* polly::createDependencesPass() {
return new Dependences();
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Fri Oct 7 19:30:40 2011
@@ -650,8 +650,17 @@
char ScopDetection::ID = 0;
-static RegisterPass<ScopDetection>
-X("polly-detect", "Polly - Detect Scops in functions");
+INITIALIZE_PASS_BEGIN(ScopDetection, "polly-detect",
+ "Polly - Detect static control parts (SCoPs)", false,
+ false)
+INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
+INITIALIZE_PASS_DEPENDENCY(DominatorTree)
+INITIALIZE_PASS_DEPENDENCY(LoopInfo)
+INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
+INITIALIZE_PASS_DEPENDENCY(RegionInfo)
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+INITIALIZE_PASS_END(ScopDetection, "polly-detect",
+ "Polly - Detect static control parts (SCoPs)", false, false)
Pass *polly::createScopDetectionPass() {
return new ScopDetection();
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Oct 7 19:30:40 2011
@@ -1064,9 +1064,16 @@
char ScopInfo::ID = 0;
-
-static RegisterPass<ScopInfo>
-X("polly-scops", "Polly - Create polyhedral description of Scops");
+INITIALIZE_PASS_BEGIN(ScopInfo, "polly-scops",
+ "Polly - Create polyhedral description of Scops", false,
+ false)
+INITIALIZE_PASS_DEPENDENCY(LoopInfo)
+INITIALIZE_PASS_DEPENDENCY(RegionInfo)
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+INITIALIZE_PASS_DEPENDENCY(TempScopInfo)
+INITIALIZE_PASS_END(ScopInfo, "polly-scops",
+ "Polly - Create polyhedral description of Scops", false,
+ false)
Pass *polly::createScopInfoPass() {
return new ScopInfo();
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Fri Oct 7 19:30:40 2011
@@ -457,8 +457,19 @@
// TempScop information extraction pass implement
char TempScopInfo::ID = 0;
-static RegisterPass<TempScopInfo>
-X("polly-analyze-ir", "Polly - Analyse the LLVM-IR in the detected regions");
+INITIALIZE_PASS_BEGIN(TempScopInfo, "polly-analyze-ir",
+ "Polly - Analyse the LLVM-IR in the detected regions",
+ false, false)
+INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
+INITIALIZE_PASS_DEPENDENCY(DominatorTree)
+INITIALIZE_PASS_DEPENDENCY(LoopInfo)
+INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
+INITIALIZE_PASS_DEPENDENCY(RegionInfo)
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+INITIALIZE_PASS_DEPENDENCY(TargetData)
+INITIALIZE_PASS_END(TempScopInfo, "polly-analyze-ir",
+ "Polly - Analyse the LLVM-IR in the detected regions",
+ false, false)
Pass *polly::createTempScopInfoPass() {
return new TempScopInfo();
Modified: polly/trunk/lib/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Cloog.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/Cloog.cpp (original)
+++ polly/trunk/lib/Cloog.cpp Fri Oct 7 19:30:40 2011
@@ -297,9 +297,11 @@
}
char CloogInfo::ID = 0;
-
-static RegisterPass<CloogInfo> B("polly-cloog",
- "Execute Cloog code generation");
+INITIALIZE_PASS_BEGIN(CloogInfo, "polly-cloog",
+ "Execute Cloog code generation", false, false)
+INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+INITIALIZE_PASS_END(CloogInfo, "polly-cloog",
+ "Execute Cloog code generation", false, false)
Pass* polly::createCloogInfoPass() {
return new CloogInfo();
Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Fri Oct 7 19:30:40 2011
@@ -1567,8 +1567,8 @@
AU.addRequired<CloogInfo>();
AU.addRequired<Dependences>();
AU.addRequired<DominatorTree>();
- AU.addRequired<ScalarEvolution>();
AU.addRequired<RegionInfo>();
+ AU.addRequired<ScalarEvolution>();
AU.addRequired<ScopDetection>();
AU.addRequired<ScopInfo>();
AU.addRequired<TargetData>();
@@ -1594,8 +1594,17 @@
char CodeGeneration::ID = 1;
-static RegisterPass<CodeGeneration>
-Z("polly-codegen", "Polly - Create LLVM-IR from the polyhedral information");
+INITIALIZE_PASS_BEGIN(CodeGeneration, "polly-codegen",
+ "Polly - Create LLVM-IR form SCoPs", false, false)
+INITIALIZE_PASS_DEPENDENCY(CloogInfo)
+INITIALIZE_PASS_DEPENDENCY(Dependences)
+INITIALIZE_PASS_DEPENDENCY(DominatorTree)
+INITIALIZE_PASS_DEPENDENCY(RegionInfo)
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+INITIALIZE_PASS_DEPENDENCY(ScopDetection)
+INITIALIZE_PASS_DEPENDENCY(TargetData)
+INITIALIZE_PASS_END(CodeGeneration, "polly-codegen",
+ "Polly - Create LLVM-IR form SCoPs", false, false)
Pass* polly::createCodeGenerationPass() {
return new CodeGeneration();
Modified: polly/trunk/lib/CodePreparation.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodePreparation.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/CodePreparation.cpp (original)
+++ polly/trunk/lib/CodePreparation.cpp Fri Oct 7 19:30:40 2011
@@ -39,11 +39,11 @@
/// @brief Scop Code Preparation - Perform some transforms to make scop detect
/// easier.
///
-class CodePreperation : public FunctionPass {
+class CodePreparation : public FunctionPass {
// DO NOT IMPLEMENT.
- CodePreperation(const CodePreperation &);
+ CodePreparation(const CodePreparation &);
// DO NOT IMPLEMENT.
- const CodePreperation &operator=(const CodePreperation &);
+ const CodePreparation &operator=(const CodePreparation &);
// LoopInfo to compute canonical induction variable.
LoopInfo *LI;
@@ -56,8 +56,8 @@
public:
static char ID;
- explicit CodePreperation() : FunctionPass(ID) {}
- ~CodePreperation();
+ explicit CodePreparation() : FunctionPass(ID) {}
+ ~CodePreparation();
/// @name FunctionPass interface.
//@{
@@ -71,16 +71,16 @@
}
//===----------------------------------------------------------------------===//
-/// CodePreperation implement.
+/// CodePreparation implement.
-void CodePreperation::clear() {
+void CodePreparation::clear() {
}
-CodePreperation::~CodePreperation() {
+CodePreparation::~CodePreparation() {
clear();
}
-bool CodePreperation::eliminatePHINodes(Function &F) {
+bool CodePreparation::eliminatePHINodes(Function &F) {
// The PHINodes that will be deleted.
std::vector<PHINode*> PNtoDel;
// The PHINodes that will be preserved.
@@ -134,7 +134,7 @@
return true;
}
-void CodePreperation::getAnalysisUsage(AnalysisUsage &AU) const {
+void CodePreparation::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LoopInfo>();
AU.addPreserved<LoopInfo>();
@@ -143,7 +143,7 @@
AU.addPreserved<DominanceFrontier>();
}
-bool CodePreperation::runOnFunction(Function &F) {
+bool CodePreparation::runOnFunction(Function &F) {
LI = &getAnalysis<LoopInfo>();
splitEntryBlockForAlloca(&F.getEntryBlock(), this);
@@ -153,21 +153,22 @@
return false;
}
-void CodePreperation::releaseMemory() {
+void CodePreparation::releaseMemory() {
clear();
}
-void CodePreperation::print(raw_ostream &OS, const Module *) const {
+void CodePreparation::print(raw_ostream &OS, const Module *) const {
}
-char CodePreperation::ID = 0;
+char CodePreparation::ID = 0;
+char &polly::CodePreparationID = CodePreparation::ID;
-RegisterPass<CodePreperation> X("polly-prepare",
- "Polly - Prepare code for polly.",
- false, true);
+INITIALIZE_PASS_BEGIN(CodePreparation, "polly-prepare",
+ "Polly - Prepare code for polly", false, false)
+INITIALIZE_PASS_DEPENDENCY(LoopInfo)
+INITIALIZE_PASS_END(CodePreparation, "polly-prepare",
+ "Polly - Prepare code for polly", false, false)
-char &polly::CodePreperationID = CodePreperation::ID;
-
-Pass *polly::createCodePreperationPass() {
- return new CodePreperation();
+Pass *polly::createCodePreparationPass() {
+ return new CodePreparation();
}
Modified: polly/trunk/lib/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/IndependentBlocks.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/IndependentBlocks.cpp Fri Oct 7 19:30:40 2011
@@ -539,12 +539,17 @@
}
char IndependentBlocks::ID = 0;
-
-static RegisterPass<IndependentBlocks>
-Z("polly-independent", "Polly - Create independent blocks");
-
char &polly::IndependentBlocksID = IndependentBlocks::ID;
+INITIALIZE_PASS_BEGIN(IndependentBlocks, "polly-independent",
+ "Polly - Create independent blocks", false, false)
+INITIALIZE_PASS_DEPENDENCY(LoopInfo)
+INITIALIZE_PASS_DEPENDENCY(RegionInfo)
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+INITIALIZE_PASS_DEPENDENCY(ScopDetection)
+INITIALIZE_PASS_END(IndependentBlocks, "polly-independent",
+ "Polly - Create independent blocks", false, false)
+
Pass* polly::createIndependentBlocksPass() {
return new IndependentBlocks();
}
Modified: polly/trunk/lib/Pocc.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Pocc.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/Pocc.cpp (original)
+++ polly/trunk/lib/Pocc.cpp Fri Oct 7 19:30:40 2011
@@ -280,8 +280,12 @@
AU.addRequired<Dependences>();
}
-static RegisterPass<Pocc> A("polly-optimize",
- "Polly - Optimize the scop using pocc");
+INITIALIZE_PASS_BEGIN(Pocc, "polly-optimize",
+ "Polly - Optimize the scop using pocc", false, false)
+INITIALIZE_PASS_DEPENDENCY(Dependences)
+INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+INITIALIZE_PASS_END(Pocc, "polly-optimize",
+ "Polly - Optimize the scop using pocc", false, false)
Pass* polly::createPoccPass() {
return new Pocc();
Modified: polly/trunk/lib/RegionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegionSimplify.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/RegionSimplify.cpp (original)
+++ polly/trunk/lib/RegionSimplify.cpp Fri Oct 7 19:30:40 2011
@@ -49,10 +49,15 @@
};
}
-static RegisterPass<RegionSimplify>
-X("polly-region-simplify", "Transform refined regions into simple regions");
-
char RegionSimplify::ID = 0;
+
+INITIALIZE_PASS_BEGIN(RegionSimplify, "polly-region-simplify",
+ "Transform refined regions into simple regions", false,
+ false)
+INITIALIZE_PASS_DEPENDENCY(RegionInfo)
+INITIALIZE_PASS_END(RegionSimplify, "polly-region-simplify",
+ "Transform refined regions into simple regions", false,
+ false)
namespace polly {
Pass *createRegionSimplifyPass() {
return new RegionSimplify();
Modified: polly/trunk/lib/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegisterPasses.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/RegisterPasses.cpp (original)
+++ polly/trunk/lib/RegisterPasses.cpp Fri Oct 7 19:30:40 2011
@@ -19,25 +19,49 @@
#include "polly/LinkAllPasses.h"
+#include "polly/Cloog.h"
+#include "polly/Dependences.h"
+#include "polly/ScopDetection.h"
+#include "polly/ScopInfo.h"
+#include "polly/TempScopInfo.h"
+
+using namespace llvm;
+
+void initializePollyPasses(PassRegistry &Registry) {
+ initializeCloogInfoPass(Registry);
+ initializeCodeGenerationPass(Registry);
+ initializeCodePreparationPass(Registry);
+ initializeDependencesPass(Registry);
+ initializeIndependentBlocksPass(Registry);
+ initializeIslScheduleOptimizerPass(Registry);
+#ifdef SCOPLIB_FOUND
+ initializePoccPass(Registry);
+#endif
+ initializeRegionSimplifyPass(Registry);
+ initializeScopDetectionPass(Registry);
+ initializeScopInfoPass(Registry);
+ initializeTempScopInfoPass(Registry);
+}
+
+// Statically register all Polly passes such that they are available after
+// loading Polly.
+class StaticInitializer {
+
+public:
+ StaticInitializer() {
+ PassRegistry &Registry = *PassRegistry::getPassRegistry();
+ initializePollyPasses(Registry);
+ }
+};
+
+static StaticInitializer InitializeEverything;
+
static void registerPollyPasses(const llvm::PassManagerBuilder &Builder,
llvm::PassManagerBase &PM) {
// Polly is only enabled at -O3
if (Builder.OptLevel != 3)
return;
- // We need to initialize the passes before we use them.
- //
- // This is not necessary for the opt tool, however clang crashes if passes
- // are not initialized. (FIXME?)
- PassRegistry &Registry = *PassRegistry::getPassRegistry();
- initializeDominatorTreePass(Registry);
- initializePostDominatorTreePass(Registry);
- initializeLoopInfoPass(Registry);
- initializeScalarEvolutionPass(Registry);
- initializeRegionInfoPass(Registry);
- initializeDominanceFrontierPass(Registry);
- initializeAliasAnalysisAnalysisGroup(Registry);
-
// A standard set of optimization passes partially taken/copied from the
// set of default optimization passes. It is used to bring the code into
// a canonical form that can than be analyzed by Polly. This set of passes is
@@ -51,26 +75,15 @@
PM.add(llvm::createLoopRotatePass()); // Rotate Loop
PM.add(llvm::createInstructionCombiningPass());
PM.add(llvm::createIndVarSimplifyPass()); // Canonicalize indvars
- PM.add(llvm::createRegionInfoPass());
- PM.add(polly::createCodePreperationPass());
+ PM.add(polly::createCodePreparationPass());
PM.add(polly::createRegionSimplifyPass());
// FIXME: Needed as RegionSimplifyPass destroys the canonical form of
// induction variables (It changes the order of the operands in the
// PHI nodes).
PM.add(llvm::createIndVarSimplifyPass());
- PM.add(polly::createScopDetectionPass());
- PM.add(polly::createIndependentBlocksPass());
-
- // FIXME: We should not need to schedule passes like the TempScopInfoPass
- // explicitally, as it is alread required by the ScopInfo pass.
- // However, without this clang crashes because of unitialized passes.
- PM.add(polly::createTempScopInfoPass());
- PM.add(polly::createScopInfoPass());
- PM.add(polly::createDependencesPass());
- PM.add(polly::createScheduleOptimizerPass());
- PM.add(polly::createCloogInfoPass());
+ PM.add(polly::createIslScheduleOptimizerPass());
PM.add(polly::createCodeGenerationPass());
}
@@ -79,6 +92,7 @@
// We run Polly that early to run before loop optimizer passes like LICM or
// the LoopIdomPass. Both transform the code in a way that Polly will recognize
// less scops.
+
static llvm::RegisterStandardPasses
PassRegister(llvm::PassManagerBuilder::EP_EarlyAsPossible,
registerPollyPasses);
Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=141455&r1=141454&r2=141455&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Fri Oct 7 19:30:40 2011
@@ -45,11 +45,11 @@
namespace {
- class ScheduleOptimizer : public ScopPass {
+ class IslScheduleOptimizer : public ScopPass {
public:
static char ID;
- explicit ScheduleOptimizer() : ScopPass(ID) {}
+ explicit IslScheduleOptimizer() : ScopPass(ID) {}
virtual bool runOnScop(Scop &S);
void printScop(llvm::raw_ostream &OS) const;
@@ -58,7 +58,7 @@
}
-char ScheduleOptimizer::ID = 0;
+char IslScheduleOptimizer::ID = 0;
static int getSingleMap(__isl_take isl_map *map, void *user) {
isl_map **singleMap = (isl_map **) user;
@@ -341,7 +341,7 @@
return tiledSchedule;
}
-bool ScheduleOptimizer::runOnScop(Scop &S) {
+bool IslScheduleOptimizer::runOnScop(Scop &S) {
Dependences *D = &getAnalysis<Dependences>();
// Build input data.
@@ -410,19 +410,21 @@
return false;
}
-void ScheduleOptimizer::printScop(raw_ostream &OS) const {
+void IslScheduleOptimizer::printScop(raw_ostream &OS) const {
}
-void ScheduleOptimizer::getAnalysisUsage(AnalysisUsage &AU) const {
+void IslScheduleOptimizer::getAnalysisUsage(AnalysisUsage &AU) const {
ScopPass::getAnalysisUsage(AU);
AU.addRequired<Dependences>();
}
-static RegisterPass<ScheduleOptimizer> A("polly-optimize-isl",
- "Polly - Calculate optimized "
- "schedules using the isl schedule "
- "calculator");
+INITIALIZE_PASS_BEGIN(IslScheduleOptimizer, "polly-optimize-isl",
+ "Polly - Optimize schedule of SCoP", false, false)
+INITIALIZE_PASS_DEPENDENCY(Dependences)
+INITIALIZE_PASS_DEPENDENCY(ScopInfo)
+INITIALIZE_PASS_END(IslScheduleOptimizer, "polly-optimize-isl",
+ "Polly - Optimize schedule of SCoP", false, false)
-Pass* polly::createScheduleOptimizerPass() {
- return new ScheduleOptimizer();
+Pass* polly::createIslScheduleOptimizerPass() {
+ return new IslScheduleOptimizer();
}
More information about the llvm-commits
mailing list