@@ -650,13 +650,10 @@ struct IslCodegenRes {
650
650
};
651
651
652
652
IslCodegenRes codegenISL (const Scop& scop) {
653
- // TODO: improve support for C++ callbacks in isl bindings generator
654
- // see https://github.com/PollyLabs/isl/issues/24
655
- // This cannot be done via islpp_wrap because the callback is stored for
656
- // later use while islpp_wrap passes a pointer to a stack-allocated
657
- // object to the call as a means to support capturing lambdas.
658
- auto collect =
659
- [](isl_ast_node* n, isl_ast_build* b, void * uTuple) -> isl_ast_node* {
653
+ IteratorMapsType iteratorMaps;
654
+ StmtSubscriptExprMapType stmtSubscripts;
655
+ auto collect = [&iteratorMaps, &scop, &stmtSubscripts](
656
+ isl::ast_node n, isl::ast_build b) -> isl::ast_node {
660
657
auto collectIteratorMaps =
661
658
[](isl::ast_node node,
662
659
isl::ast_build build,
@@ -693,16 +690,8 @@ IslCodegenRes codegenISL(const Scop& scop) {
693
690
return node.set_annotation (stmtId);
694
691
};
695
692
696
- auto & t = *static_cast <
697
- std::tuple<IteratorMapsType&, Scop&, StmtSubscriptExprMapType&>*>(
698
- uTuple);
699
-
700
- auto & uv = std::get<0 >(t);
701
- auto & scop = std::get<1 >(t);
702
- auto & stmtSubscripts = std::get<2 >(t);
703
- return collectIteratorMaps (
704
- isl::manage (n), isl::manage_copy (b), uv, scop, stmtSubscripts)
705
- .release ();
693
+ auto & uv = iteratorMaps;
694
+ return collectIteratorMaps (n, b, uv, scop, stmtSubscripts);
706
695
};
707
696
708
697
auto bands = detail::ScheduleTree::collect (
@@ -720,12 +709,8 @@ IslCodegenRes codegenISL(const Scop& scop) {
720
709
checkValidIslSchedule (scop.scheduleRoot ());
721
710
auto schedule = detail::toIslSchedule (scop.scheduleRoot ());
722
711
auto ctx = schedule.get_ctx ();
723
- IteratorMapsType iteratorMaps;
724
- StmtSubscriptExprMapType stmtSubscripts;
725
712
auto astBuild = isl::ast_build (schedule.get_ctx ());
726
- auto t = std::tie (iteratorMaps, scop, stmtSubscripts);
727
- astBuild = isl::manage (
728
- isl_ast_build_set_at_each_domain (astBuild.release (), collect, &t));
713
+ astBuild = astBuild.set_at_each_domain (collect);
729
714
astBuild = astBuild.set_iterators (Codegen::makeLoopIterators (ctx, maxDepth));
730
715
auto astNode = astBuild.node_from (schedule);
731
716
return {
0 commit comments