Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 90beb11

Browse files
author
Sven Verdoolaege
committed
Scop: do not allow outside users to modify the domain
There is no need for outside users to modify the domain directly. They should use the appropriate methods.
1 parent 70008f5 commit 90beb11

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tc/core/polyhedral/scop.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ScopUPtr Scop::makeScop(isl::ctx ctx, const lang::TreeRef& treeRef) {
7878
return makeScop(ctx, tc2halide::translate(ctx, treeRef));
7979
}
8080

81-
isl::union_set& Scop::domain() {
81+
isl::union_set& Scop::domainRef() {
8282
auto dom = scheduleRoot()->elemAs<ScheduleTreeElemDomain>();
8383
CHECK(dom) << "root is not a domain in: " << *scheduleRoot();
8484
// TODO: activate this when the invariant has a chance of working (i.e. we
@@ -92,7 +92,7 @@ isl::union_set& Scop::domain() {
9292
}
9393

9494
const isl::union_set Scop::domain() const {
95-
return const_cast<Scop*>(this)->domain();
95+
return const_cast<Scop*>(this)->domainRef();
9696
}
9797

9898
std::ostream& operator<<(std::ostream& os, const Scop& s) {

tc/core/polyhedral/scop.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct Scop {
110110

111111
// Specialize the Scop with respect to its globalParameterContext.
112112
void specializeToContext() {
113-
domain() = domain().intersect_params(globalParameterContext);
113+
domainRef() = domain().intersect_params(globalParameterContext);
114114
reads = reads.intersect_params(globalParameterContext);
115115
writes = writes.intersect_params(globalParameterContext);
116116
}
@@ -489,7 +489,9 @@ struct Scop {
489489
// state is kept.
490490
// By analogy with generalized functions, the domain is the "support" part
491491
// of the ScheduleTree "function".
492-
isl::union_set& domain();
492+
private:
493+
isl::union_set& domainRef();
494+
public:
493495
const isl::union_set domain() const;
494496
// The parameter values of a specialized Scop.
495497
std::unordered_map<std::string, int> parameterValues;

0 commit comments

Comments
 (0)