Make JScop export/reimport accessible from clang

llvm-svn: 144638
This commit is contained in:
Tobias Grosser 2011-11-15 11:38:36 +00:00
parent 9847e744e2
commit ecf6cd06f0
4 changed files with 38 additions and 9 deletions

View File

@ -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&);

View File

@ -167,10 +167,13 @@ void JSONExporter::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<ScopInfo>();
}
static RegisterPass<JSONExporter> 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<Dependences>();
}
static RegisterPass<JSONImporter> 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();

View File

@ -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<bool>
ImportJScop("polly-run-import-jscop",
cl::desc("Export the JScop description of the detected Scops"),
cl::Hidden, cl::init(false));
static cl::opt<bool>
ExportJScop("polly-run-export-jscop",
cl::desc("Export the JScop description of the detected Scops"),
cl::Hidden, cl::init(false));
static cl::opt<bool>
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());
}

View File

@ -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 <b>-polly-ignore-aliasing</b> can be used to disable the check for
possible aliasing.
<h3>Importing and exporting JScop files</h3>
The flags <b>-polly-run-import-jscop</b> and <b>-polly-run-export-jscop</b>
allow the export and reimport of the polyhedral representation that Polly
generates for the Scops.
</div>
</body>
</html>