diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-05-06 19:52:09 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-05-06 19:52:09 +0000 |
commit | 69f8514cb79a5a9f89a7a01c8ab9eb8f855fdeee (patch) | |
tree | 06b595127f6ad24dd59ddd241dc96ab7df89152d | |
parent | 7a78f66145e234b7d3538aafaf059b84e10f449c (diff) | |
download | bcm5719-llvm-69f8514cb79a5a9f89a7a01c8ab9eb8f855fdeee.tar.gz bcm5719-llvm-69f8514cb79a5a9f89a7a01c8ab9eb8f855fdeee.zip |
Dependences: Add interface to retrieve dependences.
llvm-svn: 131009
-rwxr-xr-x | polly/include/polly/Dependences.h | 21 | ||||
-rw-r--r-- | polly/lib/Analysis/Dependences.cpp | 19 |
2 files changed, 40 insertions, 0 deletions
diff --git a/polly/include/polly/Dependences.h b/polly/include/polly/Dependences.h index 212dccbb815..7333b75e956 100755 --- a/polly/include/polly/Dependences.h +++ b/polly/include/polly/Dependences.h @@ -54,6 +54,19 @@ namespace polly { 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 @@ namespace polly { /// 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(); diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp index b63d3b280d8..74d23df4075 100644 --- a/polly/lib/Analysis/Dependences.cpp +++ b/polly/lib/Analysis/Dependences.cpp @@ -408,6 +408,25 @@ void Dependences::releaseMemory() { 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); } |