[polly] r247126 - IslNodeBuilder: Add virtual function to obtain the schedule of an ast node

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 02:24:39 PDT 2015


Author: grosser
Date: Wed Sep  9 04:24:38 2015
New Revision: 247126

URL: http://llvm.org/viewvc/llvm-project?rev=247126&view=rev
Log:
IslNodeBuilder: Add virtual function to obtain the schedule of an ast node

Not all users of our IslNodeBuilder will attach scheduling information to the
AST in the same way IslAstInfo is doing it today. By going through a virtual
function when extracting the schedule of an AST node other users can provide
their own functions for extract scheduling information in case they attach
scheduling information in a different way to the AST nodes.

No functional change for Polly itself intended.

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

Modified: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslNodeBuilder.h?rev=247126&r1=247125&r2=247126&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Wed Sep  9 04:24:38 2015
@@ -24,6 +24,7 @@ using namespace llvm;
 
 struct isl_ast_node;
 struct isl_ast_build;
+struct isl_union_map;
 
 class IslNodeBuilder {
 public:
@@ -262,6 +263,19 @@ protected:
                         __isl_take isl_union_map *Schedule);
   virtual void createUser(__isl_take isl_ast_node *User);
   virtual void createBlock(__isl_take isl_ast_node *Block);
+
+  /// @brief Get the schedule for a given AST node.
+  ///
+  /// This information is used to reason about parallelism of loops or the
+  /// locality of memory accesses under a given schedule.
+  ///
+  /// @param Node The node we want to obtain the schedule for.
+  /// @return Return an isl_union_map that maps from the statements executed
+  ///         below this ast node to the scheduling vectors used to enumerate
+  ///         them.
+  ///
+  virtual __isl_give isl_union_map *
+  getScheduleForAstNode(__isl_take isl_ast_node *Node);
 };
 
 #endif

Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=247126&r1=247125&r2=247126&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Wed Sep  9 04:24:38 2015
@@ -273,6 +273,11 @@ addReferencesFromStmtUnionSet(isl_union_
   isl_union_set_free(USet);
 }
 
+__isl_give isl_union_map *
+IslNodeBuilder::getScheduleForAstNode(__isl_keep isl_ast_node *For) {
+  return IslAstInfo::getSchedule(For);
+}
+
 void IslNodeBuilder::getReferencesInSubtree(__isl_keep isl_ast_node *For,
                                             SetVector<Value *> &Values,
                                             SetVector<const Loop *> &Loops) {
@@ -287,7 +292,7 @@ void IslNodeBuilder::getReferencesInSubt
   for (const auto &I : OutsideLoopIterations)
     Values.insert(cast<SCEVUnknown>(I.second)->getValue());
 
-  isl_union_set *Schedule = isl_union_map_domain(IslAstInfo::getSchedule(For));
+  isl_union_set *Schedule = isl_union_map_domain(getScheduleForAstNode(For));
   addReferencesFromStmtUnionSet(Schedule, References);
 
   for (const SCEV *Expr : SCEVs) {
@@ -378,7 +383,7 @@ void IslNodeBuilder::createForVector(__i
   for (int i = 1; i < VectorWidth; i++)
     IVS[i] = Builder.CreateAdd(IVS[i - 1], ValueInc, "p_vector_iv");
 
-  isl_union_map *Schedule = IslAstInfo::getSchedule(For);
+  isl_union_map *Schedule = getScheduleForAstNode(For);
   assert(Schedule && "For statement annotation does not contain its schedule");
 
   IDToValue[IteratorID] = ValueLB;




More information about the llvm-commits mailing list