[polly] r310207 - Move ScopStmt::Domain to isl++
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 6 09:11:53 PDT 2017
Author: grosser
Date: Sun Aug 6 09:11:53 2017
New Revision: 310207
URL: http://llvm.org/viewvc/llvm-project?rev=310207&view=rev
Log:
Move ScopStmt::Domain to isl++
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=310207&r1=310206&r2=310207&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Sun Aug 6 09:11:53 2017
@@ -1222,7 +1222,7 @@ private:
///
/// A pair of statement and iteration vector (S, (5,3)) is called statement
/// instance.
- isl_set *Domain;
+ isl::set Domain;
/// The memory accesses of this statement.
///
@@ -1598,7 +1598,7 @@ public:
/// Restrict the domain of the statement.
///
/// @param NewDomain The new statement domain.
- void restrictDomain(__isl_take isl_set *NewDomain);
+ void restrictDomain(isl::set NewDomain);
/// Get the loop for a dimension.
///
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=310207&r1=310206&r2=310207&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun Aug 6 09:11:53 2017
@@ -1251,10 +1251,9 @@ __isl_give isl_map *ScopStmt::getSchedul
return M;
}
-void ScopStmt::restrictDomain(__isl_take isl_set *NewDomain) {
- assert(isl_set_is_subset(NewDomain, Domain) &&
+void ScopStmt::restrictDomain(isl::set NewDomain) {
+ assert(NewDomain.is_subset(Domain) &&
"New domain is not a subset of old domain!");
- isl_set_free(Domain);
Domain = NewDomain;
}
@@ -1318,7 +1317,7 @@ void ScopStmt::realignParams() {
isl::set Ctx = isl::manage(Parent.getContext());
InvalidDomain = InvalidDomain.gist_params(Ctx);
- Domain = isl_set_gist_params(Domain, Ctx.copy());
+ Domain = Domain.gist_params(Ctx);
}
/// Add @p BSet to the set @p User if @p BSet is bounded.
@@ -1690,17 +1689,16 @@ buildConditionSets(Scop &S, BasicBlock *
}
void ScopStmt::buildDomain() {
- isl_id *Id = isl_id_alloc(getIslCtx(), getBaseName(), this);
+ isl::id Id = isl::id::alloc(getIslCtx(), getBaseName(), this);
- Domain = getParent()->getDomainConditions(this);
- Domain = isl_set_set_tuple_id(Domain, Id);
+ Domain = isl::manage(getParent()->getDomainConditions(this));
+ Domain = Domain.set_tuple_id(Id);
}
void ScopStmt::collectSurroundingLoops() {
- for (unsigned u = 0, e = isl_set_n_dim(Domain); u < e; u++) {
- isl_id *DimId = isl_set_get_dim_id(Domain, isl_dim_set, u);
- NestLoops.push_back(static_cast<Loop *>(isl_id_get_user(DimId)));
- isl_id_free(DimId);
+ for (unsigned u = 0, e = Domain.dim(isl::dim::set); u < e; u++) {
+ isl::id DimId = Domain.get_dim_id(isl::dim::set, u);
+ NestLoops.push_back(static_cast<Loop *>(DimId.get_user()));
}
}
@@ -1724,12 +1722,12 @@ ScopStmt::ScopStmt(Scop &parent, BasicBl
ScopStmt::ScopStmt(Scop &parent, __isl_take isl_map *SourceRel,
__isl_take isl_map *TargetRel, __isl_take isl_set *NewDomain)
- : Parent(parent), InvalidDomain(nullptr), Domain(NewDomain), BB(nullptr),
- R(nullptr), Build(nullptr) {
+ : Parent(parent), InvalidDomain(nullptr), Domain(isl::manage(NewDomain)),
+ BB(nullptr), R(nullptr), Build(nullptr) {
BaseName = getIslCompatibleName("CopyStmt_", "",
std::to_string(parent.getCopyStmtsNum()));
auto *Id = isl_id_alloc(getIslCtx(), getBaseName(), this);
- Domain = isl_set_set_tuple_id(Domain, isl_id_copy(Id));
+ Domain = Domain.set_tuple_id(isl::manage(isl_id_copy(Id)));
TargetRel = isl_map_set_tuple_id(TargetRel, isl_dim_in, Id);
auto *Access = new MemoryAccess(this, MemoryAccess::AccessType::MUST_WRITE,
isl::manage(TargetRel));
@@ -1884,7 +1882,7 @@ void ScopStmt::checkForReductions() {
}
}
-std::string ScopStmt::getDomainStr() const { return stringFromIslObj(Domain); }
+std::string ScopStmt::getDomainStr() const { return Domain.to_str(); }
std::string ScopStmt::getScheduleStr() const {
auto *S = getSchedule();
@@ -1913,17 +1911,17 @@ Loop *ScopStmt::getLoopForDimension(unsi
isl_ctx *ScopStmt::getIslCtx() const { return Parent.getIslCtx(); }
-__isl_give isl_set *ScopStmt::getDomain() const { return isl_set_copy(Domain); }
+__isl_give isl_set *ScopStmt::getDomain() const { return Domain.copy(); }
__isl_give isl_space *ScopStmt::getDomainSpace() const {
- return isl_set_get_space(Domain);
+ return Domain.get_space().release();
}
__isl_give isl_id *ScopStmt::getDomainId() const {
- return isl_set_get_tuple_id(Domain);
+ return Domain.get_tuple_id().release();
}
-ScopStmt::~ScopStmt() { isl_set_free(Domain); }
+ScopStmt::~ScopStmt() {}
void ScopStmt::printInstructions(raw_ostream &OS) const {
OS << "Instructions {\n";
@@ -4806,10 +4804,10 @@ bool Scop::restrictDomains(__isl_take is
NewStmtDomain = isl_union_set_coalesce(NewStmtDomain);
if (isl_union_set_is_empty(NewStmtDomain)) {
- Stmt.restrictDomain(isl_set_empty(Stmt.getDomainSpace()));
+ Stmt.restrictDomain(isl::set::empty(isl::manage(Stmt.getDomainSpace())));
isl_union_set_free(NewStmtDomain);
} else
- Stmt.restrictDomain(isl_set_from_union_set(NewStmtDomain));
+ Stmt.restrictDomain(isl::manage(isl_set_from_union_set(NewStmtDomain)));
}
isl_union_set_free(Domain);
return Changed;
More information about the llvm-commits
mailing list