/// @param TargetRel The target location.
/// @param Domain The original domain under which the copy statement would
/// be executed.
- ScopStmt(Scop &parent, __isl_take isl_map *SourceRel,
- __isl_take isl_map *TargetRel, __isl_take isl_set *Domain);
+ ScopStmt(Scop &parent, isl::map SourceRel, isl::map TargetRel,
+ isl::set Domain);
/// Initialize members after all MemoryAccesses have been added.
void init(LoopInfo &LI);
/// @param TargetRel The target location.
/// @param Domain The original domain under which the copy statement would
/// be executed.
- ScopStmt *addScopStmt(__isl_take isl_map *SourceRel,
- __isl_take isl_map *TargetRel,
- __isl_take isl_set *Domain);
+ ScopStmt *addScopStmt(isl::map SourceRel, isl::map TargetRel,
+ isl::set Domain);
/// Add the access function to all MemoryAccess objects of the Scop
/// created in this pass.
UseInstructionNames);
}
-ScopStmt::ScopStmt(Scop &parent, __isl_take isl_map *SourceRel,
- __isl_take isl_map *TargetRel, __isl_take isl_set *NewDomain)
- : Parent(parent), InvalidDomain(nullptr), Domain(isl::manage(NewDomain)),
- BB(nullptr), R(nullptr), Build(nullptr) {
+ScopStmt::ScopStmt(Scop &parent, isl::map SourceRel, isl::map TargetRel,
+ isl::set NewDomain)
+ : Parent(parent), InvalidDomain(nullptr), Domain(NewDomain), BB(nullptr),
+ R(nullptr), Build(nullptr) {
BaseName = getIslCompatibleName("CopyStmt_", "",
std::to_string(parent.getCopyStmtsNum()));
- auto *Id = isl_id_alloc(getIslCtx(), getBaseName(), this);
- 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));
+ isl::id Id = isl::id::alloc(getIslCtx(), getBaseName(), this);
+ Domain = Domain.set_tuple_id(Id);
+ TargetRel = TargetRel.set_tuple_id(isl::dim::in, Id);
+ auto *Access =
+ new MemoryAccess(this, MemoryAccess::AccessType::MUST_WRITE, TargetRel);
parent.addAccessFunction(Access);
addAccess(Access);
- SourceRel = isl_map_set_tuple_id(SourceRel, isl_dim_in, isl_id_copy(Id));
- Access = new MemoryAccess(this, MemoryAccess::AccessType::READ,
- isl::manage(SourceRel));
+ SourceRel = SourceRel.set_tuple_id(isl::dim::in, Id);
+ Access = new MemoryAccess(this, MemoryAccess::AccessType::READ, SourceRel);
parent.addAccessFunction(Access);
addAccess(Access);
}
StmtMap[BB].push_back(Stmt);
}
-ScopStmt *Scop::addScopStmt(__isl_take isl_map *SourceRel,
- __isl_take isl_map *TargetRel,
- __isl_take isl_set *Domain) {
+ScopStmt *Scop::addScopStmt(isl::map SourceRel, isl::map TargetRel,
+ isl::set Domain) {
#ifndef NDEBUG
- isl_set *SourceDomain = isl_map_domain(isl_map_copy(SourceRel));
- isl_set *TargetDomain = isl_map_domain(isl_map_copy(TargetRel));
- assert(isl_set_is_subset(Domain, TargetDomain) &&
+ isl::set SourceDomain = SourceRel.domain();
+ isl::set TargetDomain = TargetRel.domain();
+ assert(Domain.is_subset(TargetDomain) &&
"Target access not defined for complete statement domain");
- assert(isl_set_is_subset(Domain, SourceDomain) &&
+ assert(Domain.is_subset(SourceDomain) &&
"Source access not defined for complete statement domain");
- isl_set_free(SourceDomain);
- isl_set_free(TargetDomain);
#endif
Stmts.emplace_back(*this, SourceRel, TargetRel, Domain);
CopyStmtsNum++;
// originating statement is executed.
auto DomainId = Domain.get_tuple_id();
auto *NewStmt = Stmt->getParent()->addScopStmt(
- OldAcc.release(), MMI.B->getLatestAccessRelation().release(),
- Domain.copy());
+ OldAcc, MMI.B->getLatestAccessRelation(), Domain);
ExtMap = ExtMap.set_tuple_id(isl::dim::out, isl::manage(DomainId.copy()));
ExtMap = ExtMap.intersect_range(isl::manage(Domain.copy()));
ExtMap = ExtMap.set_tuple_id(isl::dim::out, NewStmt->getDomainId());
ExtMap = ExtMap.reverse();
ExtMap = ExtMap.fix_si(isl::dim::out, MMI.j, 0);
NewStmt = Stmt->getParent()->addScopStmt(
- OldAcc.release(), MMI.A->getLatestAccessRelation().release(),
- Domain.copy());
+ OldAcc, MMI.A->getLatestAccessRelation(), Domain);
// Restrict the domains of the copy statements to only execute when also its
// originating statement is executed.