///
/// This function is like @see Scop::getPwAff() but strips away the invalid
/// domain part associated with the piecewise affine function.
- __isl_give isl_pw_aff *getPwAffOnly(const SCEV *E, BasicBlock *BB = nullptr);
+ isl::pw_aff getPwAffOnly(const SCEV *E, BasicBlock *BB = nullptr);
/// Return the domain of @p Stmt.
///
/// @param Stmt The statement for which the conditions should be returned.
- __isl_give isl_set *getDomainConditions(const ScopStmt *Stmt) const;
+ isl::set getDomainConditions(const ScopStmt *Stmt) const;
/// Return the domain of @p BB.
///
/// @param BB The block for which the conditions should be returned.
- __isl_give isl_set *getDomainConditions(BasicBlock *BB) const;
+ isl::set getDomainConditions(BasicBlock *BB) const;
/// Get a union set containing the iteration domains of all statements.
isl::union_set getDomains() const;
///
/// @return The schedule of all the statements in the SCoP, if the schedule of
/// the Scop does not contain extension nodes, and nullptr, otherwise.
- __isl_give isl_union_map *getSchedule() const;
+ isl::union_map getSchedule() const;
/// Get a schedule tree describing the schedule of all statements.
- __isl_give isl_schedule *getScheduleTree() const;
+ isl::schedule getScheduleTree() const;
/// Update the current schedule
///
dbgs() << "ReductionTagMap: " << ReductionTagMap << '\n';
dbgs() << "TaggedStmtDomain: " << TaggedStmtDomain << '\n';);
- Schedule = S.getScheduleTree();
+ Schedule = S.getScheduleTree().release();
if (!HasReductions) {
isl_union_map_free(ReductionTagMap);
DimensionSizesPw.push_back(nullptr);
continue;
}
- isl::pw_aff Size = isl::manage(S.getPwAffOnly(Expr));
+ isl::pw_aff Size = S.getPwAffOnly(Expr);
DimensionSizesPw.push_back(Size);
}
return true;
return isl::manage(isl_map_from_aff(isl_aff_zero_on_domain(
isl_local_space_from_space(getDomainSpace().release()))));
}
- auto *Schedule = getParent()->getSchedule();
+ auto *Schedule = getParent()->getSchedule().release();
if (!Schedule) {
isl_set_free(Domain);
return nullptr;
void ScopStmt::buildDomain() {
isl::id Id = isl::id::alloc(getIslCtx(), getBaseName(), this);
- Domain = isl::manage(getParent()->getDomainConditions(this));
+ Domain = getParent()->getDomainConditions(this);
Domain = Domain.set_tuple_id(Id);
}
return isl_set_set_dim_id(Domain, isl_dim_set, Dim, DimId);
}
-__isl_give isl_set *Scop::getDomainConditions(const ScopStmt *Stmt) const {
+isl::set Scop::getDomainConditions(const ScopStmt *Stmt) const {
return getDomainConditions(Stmt->getEntryBlock());
}
-__isl_give isl_set *Scop::getDomainConditions(BasicBlock *BB) const {
+isl::set Scop::getDomainConditions(BasicBlock *BB) const {
auto DIt = DomainMap.find(BB);
if (DIt != DomainMap.end())
- return DIt->getSecond().copy();
+ return DIt->getSecond();
auto &RI = *R.getRegionInfo();
auto *BBR = RI.getRegionFor(BB);
PropagatedRegions.insert(PredR);
}
- auto *PredBBDom = getDomainConditions(PredBB);
+ auto *PredBBDom = getDomainConditions(PredBB).release();
Loop *PredBBLoop = getFirstNonBoxedLoopFor(PredBB, LI, getBoxedLoops());
PredBBDom = adjustDomainDimensions(*this, PredBBDom, PredBBLoop, BBLoop);
}
// If the domain was deleted the assumptions are void.
- isl_set *Dom = getDomainConditions(AS.BB);
+ isl_set *Dom = getDomainConditions(AS.BB).release();
if (!Dom) {
isl_set_free(AS.Set);
continue;
return isl::manage(Domain);
}
-__isl_give isl_pw_aff *Scop::getPwAffOnly(const SCEV *E, BasicBlock *BB) {
+isl::pw_aff Scop::getPwAffOnly(const SCEV *E, BasicBlock *BB) {
PWACtx PWAC = getPwAff(E, BB);
isl_set_free(PWAC.second);
- return PWAC.first;
+ return isl::manage(PWAC.first);
}
isl::union_map
nullptr) == isl_stat_error;
}
-__isl_give isl_union_map *Scop::getSchedule() const {
- auto *Tree = getScheduleTree();
+isl::union_map Scop::getSchedule() const {
+ auto *Tree = getScheduleTree().release();
if (containsExtensionNode(Tree)) {
isl_schedule_free(Tree);
return nullptr;
}
auto *S = isl_schedule_get_map(Tree);
isl_schedule_free(Tree);
- return S;
+ return isl::manage(S);
}
-__isl_give isl_schedule *Scop::getScheduleTree() const {
- return isl_schedule_intersect_domain(isl_schedule_copy(Schedule),
- getDomains().release());
+isl::schedule Scop::getScheduleTree() const {
+ return isl::manage(isl_schedule_intersect_domain(isl_schedule_copy(Schedule),
+ getDomains().release()));
}
void Scop::setSchedule(__isl_take isl_union_map *NewSchedule) {
// We can not perform the dependence analysis and, consequently,
// the parallel code generation in case the schedule tree contains
// extension nodes.
- auto *ScheduleTree = S.getScheduleTree();
+ auto *ScheduleTree = S.getScheduleTree().release();
PerformParallelTest =
PerformParallelTest && !S.containsExtensionNode(ScheduleTree);
isl_schedule_free(ScheduleTree);
RunCondition = buildRunCondition(S, Build);
- Root = isl_ast_build_node_from_schedule(Build, S.getScheduleTree());
+ Root = isl_ast_build_node_from_schedule(Build, S.getScheduleTree().release());
isl_ast_build_free(Build);
}
P = isl_ast_node_print(RootNode, P, Options);
AstStr = isl_printer_get_str(P);
- auto *Schedule = S.getScheduleTree();
+ auto *Schedule = S.getScheduleTree().release();
DEBUG({
dbgs() << S.getContextStr() << "\n";
} else if (S.getStmtFor(Inst)) {
IsDead = false;
} else {
- auto *Domain = S.getDomainConditions(Inst->getParent());
+ auto *Domain = S.getDomainConditions(Inst->getParent()).release();
IsDead = isl_set_is_empty(Domain);
isl_set_free(Domain);
}
PPCGScop->dep_order = nullptr;
PPCGScop->tagged_dep_order = nullptr;
- PPCGScop->schedule = S->getScheduleTree();
+ PPCGScop->schedule = S->getScheduleTree().release();
// If we have something non-trivial to kill, add it to the schedule
if (KillsInfo.KillsSchedule.get())
PPCGScop->schedule = isl_schedule_sequence(
this->BB = BB;
if (BB) {
- auto *DC = S->getDomainConditions(BB);
+ auto *DC = S->getDomainConditions(BB).release();
NumIterators = isl_set_n_dim(DC);
isl_set_free(DC);
} else
// this means may-writes are in the current situation always live, there is
// no point in trying to remove them from the live-out set.
isl::union_set DeadCodeElim::getLiveOut(Scop &S) {
- isl::union_map Schedule = isl::manage(S.getSchedule());
+ isl::union_map Schedule = S.getSchedule();
isl::union_map MustWrites = S.getMustWrites();
isl::union_map WriteIterations = MustWrites.reverse();
isl::union_map WriteTimes = WriteIterations.apply_range(Schedule);
IslCtx = S.getSharedIslCtx();
DEBUG(dbgs() << "Going to flatten old schedule:\n");
- OldSchedule = give(S.getSchedule());
+ OldSchedule = S.getSchedule();
DEBUG(printSchedule(dbgs(), OldSchedule, 2));
auto Domains = S.getDomains();
OS << "}\n\n";
OS << "Schedule after flattening {\n";
- printSchedule(OS, give(S.getSchedule()), 4);
+ printSchedule(OS, S.getSchedule(), 4);
OS << "}\n";
}
if (S.containsExtensionNode(NewSchedule.get()))
return true;
auto NewScheduleMap = NewSchedule.get_map();
- auto OldSchedule = isl::manage(S.getSchedule());
+ auto OldSchedule = S.getSchedule();
assert(OldSchedule && "Only IslScheduleOptimizer can insert extension nodes "
"that make Scop::getSchedule() return nullptr.");
bool changed = !OldSchedule.is_equal(NewScheduleMap);
ZoneAlgorithm::ZoneAlgorithm(const char *PassName, Scop *S, LoopInfo *LI)
: PassName(PassName), IslCtx(S->getSharedIslCtx()), S(S), LI(LI),
- Schedule(give(S->getSchedule())) {
+ Schedule(S->getSchedule()) {
auto Domains = S->getDomains();
Schedule =