@@ -689,13 +689,10 @@ struct IslCodegenRes {
689
689
};
690
690
691
691
IslCodegenRes codegenISL (const Scop& scop) {
692
- // TODO: improve support for C++ callbacks in isl bindings generator
693
- // see https://github.com/PollyLabs/isl/issues/24
694
- // This cannot be done via islpp_wrap because the callback is stored for
695
- // later use while islpp_wrap passes a pointer to a stack-allocated
696
- // object to the call as a means to support capturing lambdas.
697
- auto collect =
698
- [](isl_ast_node* n, isl_ast_build* b, void * uTuple) -> isl_ast_node* {
692
+ IteratorMapsType iteratorMaps;
693
+ StmtSubscriptExprMapType stmtSubscripts;
694
+ auto collect = [&iteratorMaps, &scop, &stmtSubscripts](
695
+ isl::ast_node n, isl::ast_build b) -> isl::ast_node {
699
696
auto collectIteratorMaps =
700
697
[](isl::ast_node node,
701
698
isl::ast_build build,
@@ -738,16 +735,8 @@ IslCodegenRes codegenISL(const Scop& scop) {
738
735
return node.set_annotation (stmtId);
739
736
};
740
737
741
- auto & t = *static_cast <
742
- std::tuple<IteratorMapsType&, Scop&, StmtSubscriptExprMapType&>*>(
743
- uTuple);
744
-
745
- auto & uv = std::get<0 >(t);
746
- auto & scop = std::get<1 >(t);
747
- auto & stmtSubscripts = std::get<2 >(t);
748
- return collectIteratorMaps (
749
- isl::manage (n), isl::manage_copy (b), uv, scop, stmtSubscripts)
750
- .release ();
738
+ auto & uv = iteratorMaps;
739
+ return collectIteratorMaps (n, b, uv, scop, stmtSubscripts);
751
740
};
752
741
753
742
auto bands = detail::ScheduleTree::collect (
@@ -765,12 +754,8 @@ IslCodegenRes codegenISL(const Scop& scop) {
765
754
checkValidIslSchedule (scop.scheduleRoot ());
766
755
auto schedule = detail::toIslSchedule (scop.scheduleRoot ());
767
756
auto ctx = schedule.get_ctx ();
768
- IteratorMapsType iteratorMaps;
769
- StmtSubscriptExprMapType stmtSubscripts;
770
757
auto astBuild = isl::ast_build (schedule.get_ctx ());
771
- auto t = std::tie (iteratorMaps, scop, stmtSubscripts);
772
- astBuild = isl::manage (
773
- isl_ast_build_set_at_each_domain (astBuild.release (), collect, &t));
758
+ astBuild = astBuild.set_at_each_domain (collect);
774
759
astBuild = astBuild.set_iterators (Codegen::makeLoopIterators (ctx, maxDepth));
775
760
auto astNode = astBuild.node_from (schedule);
776
761
return {
0 commit comments