summaryrefslogtreecommitdiffstats
path: root/polly/include
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2012-10-02 19:50:38 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2012-10-02 19:50:38 +0000
commit0934e70e6e30a320932dab82d2cc306a201328ea (patch)
tree075553d80120e512d2d3d065d8de1bedd6f24ea3 /polly/include
parent50fce4f8dea7959f4ab3df7747167c75e7f7b627 (diff)
downloadbcm5719-llvm-0934e70e6e30a320932dab82d2cc306a201328ea.tar.gz
bcm5719-llvm-0934e70e6e30a320932dab82d2cc306a201328ea.zip
Add an ast pretty printer pass based on the isl code generator
llvm-svn: 165036
Diffstat (limited to 'polly/include')
-rw-r--r--polly/include/polly/CodeGen/IslAst.h75
-rw-r--r--polly/include/polly/LinkAllPasses.h11
-rwxr-xr-xpolly/include/polly/ScopInfo.h4
3 files changed, 88 insertions, 2 deletions
diff --git a/polly/include/polly/CodeGen/IslAst.h b/polly/include/polly/CodeGen/IslAst.h
new file mode 100644
index 00000000000..eb6fa6b4add
--- /dev/null
+++ b/polly/include/polly/CodeGen/IslAst.h
@@ -0,0 +1,75 @@
+//===- IslAst.h - Interface to the isl code generator-------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// The isl code generator interface takes a Scop and generates a isl_ast. This
+// ist_ast can either be returned directly or it can be pretty printed to
+// stdout.
+//
+// A typical isl_ast output looks like this:
+//
+// for (c2 = max(0, ceild(n + m, 2); c2 <= min(511, floord(5 * n, 3)); c2++) {
+// bb2(c2);
+// }
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef POLLY_ISL_AST_H
+#define POLLY_ISL_AST_H
+
+#include "polly/Config/config.h"
+
+#ifdef ISL_CODEGEN_FOUND
+
+#include "polly/ScopPass.h"
+
+struct clast_name;
+namespace llvm {
+ class raw_ostream;
+}
+
+struct isl_ast_node;
+struct isl_ast_build;
+struct isl_pw_multi_aff;
+
+namespace polly {
+ class Scop;
+ class IslAst;
+
+ struct IslAstUser {
+ struct isl_ast_build *Context;
+ struct isl_pw_multi_aff *PMA;
+ };
+
+ class IslAstInfo: public ScopPass {
+ Scop *S;
+ IslAst *Ast;
+
+ public:
+ static char ID;
+ IslAstInfo() : ScopPass(ID), Ast(NULL) {}
+
+ /// Print a source code representation of the program.
+ void pprint(llvm::raw_ostream &OS);
+
+ isl_ast_node *getAst();
+
+ bool runOnScop(Scop &S);
+ void printScop(llvm::raw_ostream &OS) const;
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const;
+ virtual void releaseMemory();
+ };
+}
+
+namespace llvm {
+ class PassRegistry;
+ void initializeIslAstInfoPass(llvm::PassRegistry&);
+}
+
+#endif /* ISL_CODEGEN_FOUND */
+#endif /* POLLY_ISL_AST_H */
diff --git a/polly/include/polly/LinkAllPasses.h b/polly/include/polly/LinkAllPasses.h
index fca2c71b8de..2466a248711 100644
--- a/polly/include/polly/LinkAllPasses.h
+++ b/polly/include/polly/LinkAllPasses.h
@@ -48,6 +48,11 @@ namespace polly {
llvm::Pass *createRegionSimplifyPass();
llvm::Pass *createScopDetectionPass();
llvm::Pass *createScopInfoPass();
+
+#ifdef ISL_CODEGEN_FOUND
+ llvm::Pass *createIslAstInfoPass();
+#endif
+
llvm::Pass *createIslScheduleOptimizerPass();
llvm::Pass *createTempScopInfoPass();
@@ -100,6 +105,9 @@ namespace {
#ifdef PLUTO_FOUND
createPlutoOptimizerPass();
#endif
+#ifdef ISL_CODEGEN_FOUND
+ createIslAstInfoPass();
+#endif
createIslScheduleOptimizerPass();
createTempScopInfoPass();
@@ -127,6 +135,9 @@ namespace llvm {
void initializeIndependentBlocksPass(llvm::PassRegistry&);
void initializeJSONExporterPass(llvm::PassRegistry&);
void initializeJSONImporterPass(llvm::PassRegistry&);
+#ifdef ISL_CODEGEN_FOUND
+ void initializeIslAstInfoPass(llvm::PassRegistry&);
+#endif
void initializeIslScheduleOptimizerPass(llvm::PassRegistry&);
#ifdef PLUTO_FOUND
void initializePlutoOptimizerPass(llvm::PassRegistry&);
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index edb30ece5ed..298ec96c628 100755
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -302,7 +302,7 @@ public:
/// @brief Get the iteration domain of this ScopStmt.
///
/// @return The iteration domain of this ScopStmt.
- isl_set *getDomain() const;
+ __isl_give isl_set *getDomain() const;
/// @brief Get the space of the iteration domain
///
@@ -320,7 +320,7 @@ public:
/// @brief Get the scattering function of this ScopStmt.
///
/// @return The scattering function of this ScopStmt.
- isl_map *getScattering() const;
+ __isl_give isl_map *getScattering() const;
void setScattering(isl_map *scattering);
/// @brief Get an isl string representing this scattering.
OpenPOWER on IntegriCloud