[llvm-commits] [polly] r131009 - in /polly/trunk: include/polly/Dependences.h lib/Analysis/Dependences.cpp

Tobias Grosser grosser at fim.uni-passau.de
Fri May 6 12:52:09 PDT 2011


Author: grosser
Date: Fri May  6 14:52:09 2011
New Revision: 131009

URL: http://llvm.org/viewvc/llvm-project?rev=131009&view=rev
Log:
Dependences: Add interface to retrieve dependences.

Modified:
    polly/trunk/include/polly/Dependences.h
    polly/trunk/lib/Analysis/Dependences.cpp

Modified: polly/trunk/include/polly/Dependences.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Dependences.h?rev=131009&r1=131008&r2=131009&view=diff
==============================================================================
--- polly/trunk/include/polly/Dependences.h (original)
+++ polly/trunk/include/polly/Dependences.h Fri May  6 14:52:09 2011
@@ -54,6 +54,19 @@
 
   public:
     static char ID;
+
+    /// @brief The type of the dependences.
+    enum Type {
+      // Write after read
+      TYPE_WAR = 0x1,
+
+      // Read after write
+      TYPE_RAW = 0x2,
+
+      // Write after write
+      TYPE_WAW = 0x4
+    };
+
     typedef std::map<ScopStmt*, isl_map*> StatementToIslMapTy;
 
     Dependences();
@@ -80,6 +93,14 @@
     ///              execute in parallel.
     bool isParallelFor(const clast_for *f);
 
+    /// @brief Get the dependences in this Scop.
+    ///
+    /// @param dependenceKinds This integer defines the different kinds of
+    ///                        dependences that will be returned. To return
+    ///                        more than one kind, the different kinds are
+    ///                        'ored' together.
+    isl_union_map *getDependences(int dependenceKinds);
+
     bool runOnScop(Scop &S);
     void printScop(raw_ostream &OS) const;
     virtual void releaseMemory();

Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=131009&r1=131008&r2=131009&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Fri May  6 14:52:09 2011
@@ -408,6 +408,25 @@
   sink = must_source = may_source = NULL;
 }
 
+isl_union_map *Dependences::getDependences(int type) {
+  isl_dim *dim = isl_union_map_get_dim(must_dep);
+  isl_union_map *dependences = isl_union_map_empty(dim);
+
+  if (type & TYPE_RAW)
+    dependences = isl_union_map_union(dependences,
+                                      isl_union_map_copy(must_dep));
+
+  if (type & TYPE_WAR)
+    dependences = isl_union_map_union(dependences,
+                                      isl_union_map_copy(war_dep));
+
+  if (type & TYPE_WAW)
+    dependences = isl_union_map_union(dependences,
+                                      isl_union_map_copy(waw_dep));
+
+  return dependences;
+}
+
 void Dependences::getAnalysisUsage(AnalysisUsage &AU) const {
   ScopPass::getAnalysisUsage(AU);
 }





More information about the llvm-commits mailing list