Skip to content

Commit 35de900

Browse files
committedJul 24, 2017
[NFC] Move PPCGCodeGeneration::pollyBuildAstExprForStmt to isl++.
Differential Revision: https://reviews.llvm.org/D35771 llvm-svn: 308869
1 parent b16ce77 commit 35de900

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed
 

‎polly/lib/CodeGen/PPCGCodeGeneration.cpp

+21-19
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static MustKillsInfo computeMustKillsInfo(const Scop &S) {
255255
/// This function is a callback for to generate the ast expressions for each
256256
/// of the scheduled ScopStmts.
257257
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,
259259
isl_multi_pw_aff *(*FunctionIndex)(__isl_take isl_multi_pw_aff *MPA,
260260
isl_id *Id, void *User),
261261
void *UserIndex,
@@ -264,28 +264,30 @@ static __isl_give isl_id_to_ast_expr *pollyBuildAstExprForStmt(
264264

265265
ScopStmt *Stmt = (ScopStmt *)StmtT;
266266

267-
isl_ctx *Ctx;
268-
269-
if (!Stmt || !Build)
267+
if (!Stmt || !Build_C)
270268
return NULL;
271269

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);
274273

275274
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();
289291
}
290292

291293
/// Given a LLVM Type, compute its size in bytes,

0 commit comments

Comments
 (0)
Please sign in to comment.