[polly] r262009 - IslAst: Expose run-time check generation as individual function

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 04:59:38 PST 2016


Author: grosser
Date: Fri Feb 26 06:59:38 2016
New Revision: 262009

URL: http://llvm.org/viewvc/llvm-project?rev=262009&view=rev
Log:
IslAst: Expose run-time check generation as individual function

This allows to construct run-time checks for a scop without having to generate
a full AST. This is currently not taken advantage of in Polly itself, but
external users may benefit from this feature.

Modified:
    polly/trunk/include/polly/CodeGen/IslAst.h
    polly/trunk/lib/CodeGen/IslAst.cpp

Modified: polly/trunk/include/polly/CodeGen/IslAst.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslAst.h?rev=262009&r1=262008&r2=262009&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslAst.h (original)
+++ polly/trunk/include/polly/CodeGen/IslAst.h Fri Feb 26 06:59:38 2016
@@ -56,6 +56,15 @@ public:
   /// @brief Get the run-time conditions for the Scop.
   __isl_give isl_ast_expr *getRunCondition();
 
+  /// @brief Build run-time condition for scop.
+  ///
+  /// @param S     The scop to build the condition for.
+  /// @param Build The isl_build object to use to build the condition.
+  ///
+  /// @returns An ast expression that describes the necessary run-time check.
+  static isl_ast_expr *buildRunCondition(Scop *S,
+                                         __isl_keep isl_ast_build *Build);
+
 private:
   Scop *S;
   isl_ast_node *Root;
@@ -64,8 +73,6 @@ private:
 
   IslAst(Scop *Scop);
   void init(const Dependences &D);
-
-  void buildRunCondition(__isl_keep isl_ast_build *Build);
 };
 
 class IslAstInfo : public ScopPass {

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=262009&r1=262008&r2=262009&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Fri Feb 26 06:59:38 2016
@@ -329,7 +329,10 @@ buildCondition(__isl_keep isl_ast_build
   return NonAliasGroup;
 }
 
-void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
+__isl_give isl_ast_expr *
+IslAst::buildRunCondition(Scop *S, __isl_keep isl_ast_build *Build) {
+  isl_ast_expr *RunCondition;
+
   // The conditions that need to be checked at run-time for this scop are
   // available as an isl_set in the runtime check context from which we can
   // directly derive a run-time condition.
@@ -355,6 +358,8 @@ void IslAst::buildRunCondition(__isl_kee
             RunCondition, buildCondition(Build, RWAccIt0, &ROAccIt));
     }
   }
+
+  return RunCondition;
 }
 
 /// @brief Simple cost analysis for a given SCoP
@@ -418,7 +423,7 @@ void IslAst::init(const Dependences &D)
                                               &BuildInfo);
   }
 
-  buildRunCondition(Build);
+  RunCondition = buildRunCondition(S, Build);
 
   Root = isl_ast_build_node_from_schedule(Build, S->getScheduleTree());
 




More information about the llvm-commits mailing list