Dependences: Add interface to retrieve dependences.

llvm-svn: 131009
This commit is contained in:
Tobias Grosser 2011-05-06 19:52:09 +00:00
parent 7a78f66145
commit 69f8514cb7
2 changed files with 40 additions and 0 deletions

View File

@ -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();

View File

@ -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);
}