diff --git a/polly/include/polly/LinkAllPasses.h b/polly/include/polly/LinkAllPasses.h index 1cb84a67d7273a24c474f13256a33e4c7f0cc06c..9ddb6b8bb5b6e208cf5c2117c92cd94d43c48450 100644 --- a/polly/include/polly/LinkAllPasses.h +++ b/polly/include/polly/LinkAllPasses.h @@ -112,6 +112,8 @@ namespace llvm { void initializeCodeGenerationPass(llvm::PassRegistry&); void initializeCodePreparationPass(llvm::PassRegistry&); void initializeIndependentBlocksPass(llvm::PassRegistry&); + void initializeJSONExporterPass(llvm::PassRegistry&); + void initializeJSONImporterPass(llvm::PassRegistry&); void initializeIslScheduleOptimizerPass(llvm::PassRegistry&); #ifdef SCOPLIB_FOUND void initializePoccPass(llvm::PassRegistry&); diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index 3a45cb1a8c7bc0ffa574e1987529b1f89ad0538e..00c9f88e2e58513aca077d882f7e8a81f155f683 100755 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -167,10 +167,13 @@ void JSONExporter::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); } -static RegisterPass A("polly-export-jscop", - "Polly - Export Scops as JSON" - " (Writes a .jscop file for each Scop)" - ); +INITIALIZE_PASS_BEGIN(JSONExporter, "polly-export-jscop", + "Polly - Export Scops as JSON" + " (Writes a .jscop file for each Scop)", false, false) +INITIALIZE_PASS_DEPENDENCY(Dependences) +INITIALIZE_PASS_END(JSONExporter, "polly-export-jscop", + "Polly - Export Scops as JSON" + " (Writes a .jscop file for each Scop)", false, false) Pass *polly::createJSONExporterPass() { return new JSONExporter(); @@ -304,10 +307,13 @@ void JSONImporter::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); } -static RegisterPass B("polly-import-jscop", - "Polly - Import Scops from JSON" - " (Reads a .jscop file for each Scop)" - ); +INITIALIZE_PASS_BEGIN(JSONImporter, "polly-import-jscop", + "Polly - Import Scops from JSON" + " (Reads a .jscop file for each Scop)", false, false) +INITIALIZE_PASS_DEPENDENCY(Dependences) +INITIALIZE_PASS_END(JSONImporter, "polly-import-jscop", + "Polly - Import Scops from JSON" + " (Reads a .jscop file for each Scop)", false, false) Pass *polly::createJSONImporterPass() { return new JSONImporter(); diff --git a/polly/lib/RegisterPasses.cpp b/polly/lib/RegisterPasses.cpp index 5fe9588601a508c672b4ff29a4bbbd70b9f65fe0..133b96339cef9032e3aebed7c52411d5c8df30cd 100644 --- a/polly/lib/RegisterPasses.cpp +++ b/polly/lib/RegisterPasses.cpp @@ -41,6 +41,14 @@ UsePocc("polly-use-pocc", cl::desc("Use the PoCC optimizer instead of the one in isl"), cl::Hidden, cl::init(false)); static cl::opt +ImportJScop("polly-run-import-jscop", + cl::desc("Export the JScop description of the detected Scops"), + cl::Hidden, cl::init(false)); +static cl::opt +ExportJScop("polly-run-export-jscop", + cl::desc("Export the JScop description of the detected Scops"), + cl::Hidden, cl::init(false)); +static cl::opt PollyViewer("polly-show", cl::desc("Enable the Polly DOT viewer in -O3"), cl::Hidden, cl::value_desc("Run the Polly DOT viewer at -O3"), @@ -69,6 +77,8 @@ void initializePollyPasses(PassRegistry &Registry) { initializeCodePreparationPass(Registry); initializeDependencesPass(Registry); initializeIndependentBlocksPass(Registry); + initializeJSONExporterPass(Registry); + initializeJSONImporterPass(Registry); initializeIslScheduleOptimizerPass(Registry); #ifdef SCOPLIB_FOUND initializePoccPass(Registry); @@ -137,6 +147,9 @@ static void registerPollyPasses(const llvm::PassManagerBuilder &Builder, if (PollyOnlyPrinter) PM.add(polly::createDOTOnlyPrinterPass()); + if (ImportJScop) + PM.add(polly::createJSONImporterPass()); + if (!DisableScheduler) { if (!UsePocc) PM.add(polly::createIslScheduleOptimizerPass()); @@ -150,9 +163,12 @@ static void registerPollyPasses(const llvm::PassManagerBuilder &Builder, PM.add(polly::createIslScheduleOptimizerPass()); #endif } - } + if (ExportJScop) + PM.add(polly::createJSONExporterPass()); + + if (!DisableCodegen) PM.add(polly::createCodeGenerationPass()); } diff --git a/polly/www/example_load_Polly_into_clang.html b/polly/www/example_load_Polly_into_clang.html index c14f47f153d847a76067d8a336a3bf0dac867a2c..02560c89f5c6f5993d107e51d488d891c8e9b503 100644 --- a/polly/www/example_load_Polly_into_clang.html +++ b/polly/www/example_load_Polly_into_clang.html @@ -99,6 +99,11 @@ without special user annotations like 'restrict' we can often not prove that no aliasing is possible. In case the user knows no aliasing can happen in the code the -polly-ignore-aliasing can be used to disable the check for possible aliasing. + +

Importing and exporting JScop files

+The flags -polly-run-import-jscop and -polly-run-export-jscop +allow the export and reimport of the polyhedral representation that Polly +generates for the Scops.