[ScopInfo] Translate Scop::getContext to isl++ [NFC]

llvm-svn: 310221
This commit is contained in:
Tobias Grosser 2017-08-06 19:52:38 +00:00
parent 9a63570b13
commit 8ea1fc19b3
8 changed files with 27 additions and 28 deletions

View File

@ -2505,7 +2505,7 @@ public:
/// Get the constraint on parameter of this Scop.
///
/// @return The constraint on parameter of this Scop.
__isl_give isl_set *getContext() const;
isl::set getContext() const;
/// Return space of isl context parameters.
///

View File

@ -1025,7 +1025,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stmt, AccessType AccType, isl::map AccRel)
}
void MemoryAccess::realignParams() {
isl::set Ctx = isl::manage(Statement->getParent()->getContext());
isl::set Ctx = Statement->getParent()->getContext();
InvalidDomain = InvalidDomain.gist_params(Ctx);
AccessRelation = AccessRelation.gist_params(Ctx);
}
@ -1179,7 +1179,7 @@ void MemoryAccess::setNewAccessRelation(isl::map NewAccess) {
// Check whether there is an access for every statement instance.
isl::set StmtDomain = getStatement()->getDomain();
StmtDomain = StmtDomain.intersect_params(
isl::manage(getStatement()->getParent()->getContext()));
getStatement()->getParent()->getContext());
isl::set NewDomain = NewAccess.domain();
assert(StmtDomain.is_subset(NewDomain) &&
"Partial READ accesses not supported");
@ -1312,7 +1312,7 @@ void ScopStmt::realignParams() {
for (MemoryAccess *MA : *this)
MA->realignParams();
isl::set Ctx = isl::manage(Parent.getContext());
isl::set Ctx = Parent.getContext();
InvalidDomain = InvalidDomain.gist_params(Ctx);
Domain = Domain.gist_params(Ctx);
}
@ -2423,7 +2423,7 @@ void Scop::realignParams() {
for (ScopStmt &Stmt : *this)
Stmt.realignParams();
// Simplify the schedule according to the context too.
Schedule = isl_schedule_gist_domain_params(Schedule, getContext());
Schedule = isl_schedule_gist_domain_params(Schedule, getContext().release());
}
static __isl_give isl_set *
@ -2441,7 +2441,7 @@ simplifyAssumptionContext(__isl_take isl_set *AssumptionContext,
isl_set_gist_params(AssumptionContext, DomainParameters);
}
AssumptionContext = isl_set_gist_params(AssumptionContext, S.getContext());
AssumptionContext = isl_set_gist_params(AssumptionContext, S.getContext().release());
return AssumptionContext;
}
@ -3938,7 +3938,7 @@ void Scop::addInvariantLoads(ScopStmt &Stmt, InvariantAccessesTy &InvMAs) {
} else {
MACtx = isl_set_copy(DomainCtx);
MACtx = isl_set_subtract(MACtx, isl_set_union(MAInvalidCtx, NHCtx));
MACtx = isl_set_gist_params(MACtx, getContext());
MACtx = isl_set_gist_params(MACtx, getContext().release());
}
bool Consolidated = false;
@ -4244,7 +4244,7 @@ const ScopArrayInfo *Scop::getScopArrayInfo(Value *BasePtr, MemoryKind Kind) {
return SAI;
}
std::string Scop::getContextStr() const { return stringFromIslObj(Context); }
std::string Scop::getContextStr() const { return getContext().to_str(); }
std::string Scop::getAssumedContextStr() const {
assert(AssumedContext && "Assumed context not yet built");
@ -4278,7 +4278,7 @@ std::pair<std::string, std::string> Scop::getEntryExitStr() const {
return std::make_pair(EntryName, ExitName);
}
__isl_give isl_set *Scop::getContext() const { return isl_set_copy(Context); }
isl::set Scop::getContext() const { return isl::manage(isl_set_copy(Context)); }
__isl_give isl_space *Scop::getParamSpace() const {
return isl_set_get_space(Context);
}
@ -4466,7 +4466,7 @@ bool Scop::trackAssumption(AssumptionKind Kind, __isl_keep isl_set *Set,
void Scop::addAssumption(AssumptionKind Kind, __isl_take isl_set *Set,
DebugLoc Loc, AssumptionSign Sign, BasicBlock *BB) {
// Simplify the assumptions/restrictions first.
Set = isl_set_gist_params(Set, getContext());
Set = isl_set_gist_params(Set, getContext().release());
if (!trackAssumption(Kind, Set, Loc, Sign, BB)) {
isl_set_free(Set);

View File

@ -609,7 +609,7 @@ void BlockGenerator::generateConditionalExecution(
// If the condition is a tautology, don't generate a condition around the
// code.
bool IsPartialWrite =
!StmtDom.intersect_params(give(Stmt.getParent()->getContext()))
!StmtDom.intersect_params(Stmt.getParent()->getContext())
.is_subset(Subdomain);
if (!IsPartialWrite) {
GenThenFunc();

View File

@ -228,7 +228,7 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
isl_ast_node_free(AstRoot);
} else {
NodeBuilder.addParameters(S.getContext());
NodeBuilder.addParameters(S.getContext().release());
Value *RTC = NodeBuilder.createRTC(AI.getRunCondition());
Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);

View File

@ -426,7 +426,7 @@ void IslAst::init(const Dependences &D) {
AstBuildUserInfo BuildInfo;
if (UseContext)
Build = isl_ast_build_from_context(S.getContext());
Build = isl_ast_build_from_context(S.getContext().release());
else
Build = isl_ast_build_from_context(isl_set_universe(S.getParamSpace()));

View File

@ -815,9 +815,9 @@ IslNodeBuilder::createNewAccesses(ScopStmt *Stmt,
auto SchedDom = isl_set_from_union_set(
isl_union_map_domain(isl_union_map_copy(Schedule)));
auto AccDom = isl_map_domain(MA->getAccessRelation().release());
Dom = isl_set_intersect_params(Dom, Stmt->getParent()->getContext());
Dom = isl_set_intersect_params(Dom, Stmt->getParent()->getContext().release());
SchedDom =
isl_set_intersect_params(SchedDom, Stmt->getParent()->getContext());
isl_set_intersect_params(SchedDom, Stmt->getParent()->getContext().release());
assert(isl_set_is_subset(SchedDom, AccDom) &&
"Access relation not defined on full schedule domain");
assert(isl_set_is_subset(Dom, AccDom) &&
@ -1184,7 +1184,7 @@ Value *IslNodeBuilder::preloadInvariantLoad(const MemoryAccess &MA,
isl_set *Domain) {
isl_set *AccessRange = isl_map_range(MA.getAddressFunction().release());
AccessRange = isl_set_gist_params(AccessRange, S.getContext());
AccessRange = isl_set_gist_params(AccessRange, S.getContext().release());
if (!materializeParameters(AccessRange)) {
isl_set_free(AccessRange);

View File

@ -762,7 +762,7 @@ void GPUNodeBuilder::finalize() {
void GPUNodeBuilder::allocateDeviceArrays() {
assert(!ManagedMemory && "Managed memory will directly send host pointers "
"to the kernel. There is no need for device arrays");
isl_ast_build *Build = isl_ast_build_from_context(S.getContext());
isl_ast_build *Build = isl_ast_build_from_context(S.getContext().release());
for (int i = 0; i < Prog->n_array; ++i) {
gpu_array_info *Array = &Prog->array[i];
@ -1071,7 +1071,7 @@ static bool isPrefix(std::string String, std::string Prefix) {
Value *GPUNodeBuilder::getArraySize(gpu_array_info *Array) {
isl::ast_build Build =
isl::ast_build::from_context(isl::manage(S.getContext()));
isl::ast_build::from_context(S.getContext());
Value *ArraySize = ConstantInt::get(Builder.getInt64Ty(), Array->size);
if (!gpu_array_is_scalar(Array)) {
@ -1100,7 +1100,7 @@ Value *GPUNodeBuilder::getArrayOffset(gpu_array_info *Array) {
return nullptr;
isl::ast_build Build =
isl::ast_build::from_context(isl::manage(S.getContext()));
isl::ast_build::from_context(S.getContext());
isl::set Min = isl::manage(isl_set_copy(Array->extent)).lexmin();
@ -1517,8 +1517,7 @@ void GPUNodeBuilder::clearLoops(Function *F) {
std::tuple<Value *, Value *> GPUNodeBuilder::getGridSizes(ppcg_kernel *Kernel) {
std::vector<Value *> Sizes;
isl::ast_build Context =
isl::ast_build::from_context(isl::manage(S.getContext()));
isl::ast_build Context = isl::ast_build::from_context(S.getContext());
isl::multi_pw_aff GridSizePwAffs =
isl::manage(isl_multi_pw_aff_copy(Kernel->grid_size));
@ -2631,10 +2630,10 @@ public:
PPCGScop->start = 0;
PPCGScop->end = 0;
PPCGScop->context = S->getContext();
PPCGScop->context = S->getContext().release();
PPCGScop->domain = S->getDomains();
// TODO: investigate this further. PPCG calls collect_call_domains.
PPCGScop->call = isl_union_set_from_set(S->getContext());
PPCGScop->call = isl_union_set_from_set(S->getContext().release());
PPCGScop->tagged_reads = getTaggedReads();
PPCGScop->reads = S->getReads().release();
PPCGScop->live_in = nullptr;
@ -2845,7 +2844,7 @@ public:
isl_aff *One = isl_aff_zero_on_domain(LS);
One = isl_aff_add_constant_si(One, 1);
Bound = isl_pw_aff_add(Bound, isl_pw_aff_alloc(Dom, One));
Bound = isl_pw_aff_gist(Bound, S->getContext());
Bound = isl_pw_aff_gist(Bound, S->getContext().release());
Bounds.push_back(Bound);
}
}
@ -3375,7 +3374,7 @@ public:
// TODO: Handle LICM
auto SplitBlock = StartBlock->getSinglePredecessor();
Builder.SetInsertPoint(SplitBlock->getTerminator());
NodeBuilder.addParameters(S->getContext());
NodeBuilder.addParameters(S->getContext().release());
isl_ast_build *Build = isl_ast_build_alloc(S->getIslCtx());
isl_ast_expr *Condition = IslAst::buildRunCondition(*S, Build);

View File

@ -273,7 +273,7 @@ void JSONImporter::printScop(raw_ostream &OS, Scop &S) const {
typedef Dependences::StatementToIslMapTy StatementToIslMapTy;
bool JSONImporter::importContext(Scop &S, Json::Value &JScop) {
isl_set *OldContext = S.getContext();
isl_set *OldContext = S.getContext().release();
// Check if key 'context' is present.
if (!JScop.isMember("context")) {
@ -561,9 +561,9 @@ bool JSONImporter::importAccesses(Scop &S, Json::Value &JScop,
}
NewAccessDomain =
isl_set_intersect_params(NewAccessDomain, S.getContext());
isl_set_intersect_params(NewAccessDomain, S.getContext().release());
CurrentAccessDomain =
isl_set_intersect_params(CurrentAccessDomain, S.getContext());
isl_set_intersect_params(CurrentAccessDomain, S.getContext().release());
if (MA->isRead() &&
isl_set_is_subset(CurrentAccessDomain, NewAccessDomain) ==