[ScopInfo] Move ScopStmt::getSchedule to isl++
authorTobias Grosser <tobias@grosser.es>
Sun, 6 Aug 2017 17:45:28 +0000 (17:45 +0000)
committerTobias Grosser <tobias@grosser.es>
Sun, 6 Aug 2017 17:45:28 +0000 (17:45 +0000)
llvm-svn: 310215

polly/include/polly/ScopInfo.h
polly/lib/Analysis/DependenceInfo.cpp
polly/lib/Analysis/PolyhedralInfo.cpp
polly/lib/Analysis/ScopInfo.cpp
polly/lib/Exchange/JSONExporter.cpp

index c76335a..de49a7d 100644 (file)
@@ -1334,7 +1334,7 @@ public:
   ///
   /// @return The schedule function of this ScopStmt, if it does not contain
   /// extension nodes, and nullptr, otherwise.
-  __isl_give isl_map *getSchedule() const;
+  isl::map getSchedule() const;
 
   /// Get an isl string representing this schedule.
   ///
index c34ffde..939dffa 100644 (file)
@@ -156,7 +156,7 @@ static void collectInfo(Scop &S, isl_union_map *&Read,
       } else {
         accdom = tag(accdom, MA, Level);
         if (Level > Dependences::AL_Statement) {
-          auto *StmtScheduleMap = Stmt.getSchedule();
+          isl_map *StmtScheduleMap = Stmt.getSchedule().release();
           assert(StmtScheduleMap &&
                  "Schedules that contain extension nodes require special "
                  "handling.");
@@ -174,7 +174,8 @@ static void collectInfo(Scop &S, isl_union_map *&Read,
     }
 
     if (!ReductionArrays.empty() && Level == Dependences::AL_Statement)
-      StmtSchedule = isl_union_map_add_map(StmtSchedule, Stmt.getSchedule());
+      StmtSchedule =
+          isl_union_map_add_map(StmtSchedule, Stmt.getSchedule().release());
   }
 
   StmtSchedule =
@@ -743,7 +744,7 @@ bool Dependences::isValidSchedule(Scop &S,
     isl_map *StmtScat;
 
     if (NewSchedule->find(&Stmt) == NewSchedule->end())
-      StmtScat = Stmt.getSchedule();
+      StmtScat = Stmt.getSchedule().release();
     else
       StmtScat = isl_map_copy((*NewSchedule)[&Stmt]);
     assert(StmtScat &&
index 223a1e8..6c43805 100644 (file)
@@ -131,7 +131,7 @@ __isl_give isl_union_map *PolyhedralInfo::getScheduleForLoop(const Scop *S,
 
       unsigned int MaxDim = SS.getNumIterators();
       DEBUG(dbgs() << "Maximum depth of Stmt:\t" << MaxDim << "\n");
-      auto *ScheduleMap = SS.getSchedule();
+      isl_map *ScheduleMap = SS.getSchedule().release();
       assert(
           ScheduleMap &&
           "Schedules that contain extension nodes require special handling.");
index 713d031..0f75646 100644 (file)
@@ -1221,12 +1221,12 @@ bool MemoryAccess::isLatestPartialAccess() const {
 
 //===----------------------------------------------------------------------===//
 
-__isl_give isl_map *ScopStmt::getSchedule() const {
+isl::map ScopStmt::getSchedule() const {
   isl_set *Domain = getDomain().release();
   if (isl_set_is_empty(Domain)) {
     isl_set_free(Domain);
-    return isl_map_from_aff(isl_aff_zero_on_domain(
-        isl_local_space_from_space(getDomainSpace().release())));
+    return isl::manage(isl_map_from_aff(isl_aff_zero_on_domain(
+        isl_local_space_from_space(getDomainSpace().release()))));
   }
   auto *Schedule = getParent()->getSchedule();
   if (!Schedule) {
@@ -1238,14 +1238,14 @@ __isl_give isl_map *ScopStmt::getSchedule() const {
   if (isl_union_map_is_empty(Schedule)) {
     isl_set_free(Domain);
     isl_union_map_free(Schedule);
-    return isl_map_from_aff(isl_aff_zero_on_domain(
-        isl_local_space_from_space(getDomainSpace().release())));
+    return isl::manage(isl_map_from_aff(isl_aff_zero_on_domain(
+        isl_local_space_from_space(getDomainSpace().release()))));
   }
   auto *M = isl_map_from_union_map(Schedule);
   M = isl_map_coalesce(M);
   M = isl_map_gist_domain(M, Domain);
   M = isl_map_coalesce(M);
-  return M;
+  return isl::manage(M);
 }
 
 void ScopStmt::restrictDomain(isl::set NewDomain) {
@@ -1881,7 +1881,7 @@ void ScopStmt::checkForReductions() {
 std::string ScopStmt::getDomainStr() const { return Domain.to_str(); }
 
 std::string ScopStmt::getScheduleStr() const {
-  auto *S = getSchedule();
+  auto *S = getSchedule().release();
   if (!S)
     return "";
   auto Str = stringFromIslObj(S);
index 10beddc..76b038d 100644 (file)
@@ -396,7 +396,8 @@ bool JSONImporter::importSchedule(Scop &S, Json::Value &JScop,
     if (NewSchedule.find(&Stmt) != NewSchedule.end())
       ScheduleMap = isl_union_map_add_map(ScheduleMap, NewSchedule[&Stmt]);
     else
-      ScheduleMap = isl_union_map_add_map(ScheduleMap, Stmt.getSchedule());
+      ScheduleMap =
+          isl_union_map_add_map(ScheduleMap, Stmt.getSchedule().release());
   }
 
   S.setSchedule(ScheduleMap);