@@ -255,7 +255,7 @@ static MustKillsInfo computeMustKillsInfo(const Scop &S) {
255
255
// / This function is a callback for to generate the ast expressions for each
256
256
// / of the scheduled ScopStmts.
257
257
static __isl_give isl_id_to_ast_expr *pollyBuildAstExprForStmt (
258
- void *StmtT, isl_ast_build *Build ,
258
+ void *StmtT, __isl_take isl_ast_build *Build_C ,
259
259
isl_multi_pw_aff *(*FunctionIndex)(__isl_take isl_multi_pw_aff *MPA,
260
260
isl_id *Id, void *User),
261
261
void *UserIndex,
@@ -264,28 +264,30 @@ static __isl_give isl_id_to_ast_expr *pollyBuildAstExprForStmt(
264
264
265
265
ScopStmt *Stmt = (ScopStmt *)StmtT;
266
266
267
- isl_ctx *Ctx;
268
-
269
- if (!Stmt || !Build)
267
+ if (!Stmt || !Build_C)
270
268
return NULL ;
271
269
272
- Ctx = isl_ast_build_get_ctx (Build);
273
- isl_id_to_ast_expr *RefToExpr = isl_id_to_ast_expr_alloc (Ctx, 0 );
270
+ isl::ast_build Build = isl::manage (isl_ast_build_copy (Build_C));
271
+ isl::ctx Ctx = Build.get_ctx ();
272
+ isl::id_to_ast_expr RefToExpr = isl::id_to_ast_expr::alloc (Ctx, 0 );
274
273
275
274
for (MemoryAccess *Acc : *Stmt) {
276
- isl_map *AddrFunc = Acc->getAddressFunction ().release ();
277
- AddrFunc = isl_map_intersect_domain (AddrFunc, Stmt->getDomain ());
278
- isl_id *RefId = Acc->getId ().release ();
279
- isl_pw_multi_aff *PMA = isl_pw_multi_aff_from_map (AddrFunc);
280
- isl_multi_pw_aff *MPA = isl_multi_pw_aff_from_pw_multi_aff (PMA);
281
- MPA = isl_multi_pw_aff_coalesce (MPA);
282
- MPA = FunctionIndex (MPA, RefId, UserIndex);
283
- isl_ast_expr *Access = isl_ast_build_access_from_multi_pw_aff (Build, MPA);
284
- Access = FunctionExpr (Access, RefId, UserExpr);
285
- RefToExpr = isl_id_to_ast_expr_set (RefToExpr, RefId, Access);
286
- }
287
-
288
- return RefToExpr;
275
+ isl::map AddrFunc = Acc->getAddressFunction ();
276
+ AddrFunc = AddrFunc.intersect_domain (isl::manage (Stmt->getDomain ()));
277
+
278
+ isl::id RefId = Acc->getId ();
279
+ isl::pw_multi_aff PMA = isl::pw_multi_aff::from_map (AddrFunc);
280
+
281
+ isl::multi_pw_aff MPA = isl::multi_pw_aff (PMA);
282
+ MPA = MPA.coalesce ();
283
+ MPA = isl::manage (FunctionIndex (MPA.release (), RefId.get (), UserIndex));
284
+
285
+ isl::ast_expr Access = Build.access_from (MPA);
286
+ Access = isl::manage (FunctionExpr (Access.release (), RefId.get (), UserExpr));
287
+ RefToExpr = RefToExpr.set (RefId, Access);
288
+ }
289
+
290
+ return RefToExpr.release ();
289
291
}
290
292
291
293
// / Given a LLVM Type, compute its size in bytes,
0 commit comments