- ctx = isl_basic_set_list_get_ctx(domain_list);
-
- data.depth = isl_ast_build_get_depth(build);
- data.piece = domain_list->p;
- g = isl_tarjan_graph_init(ctx, n, &shared_outer, &data);
- if (!g)
- return NULL;
-
- i = 0;
- do {
- int first;
- isl_ast_graft_list *list_c;
-
- if (g->order[i] == -1)
- isl_die(ctx, isl_error_internal, "cannot happen",
- break);
- first = i;
- while (g->order[i] != -1) {
- ++i; --n;
- }
- if (first == 0 && n == 0) {
- isl_tarjan_graph_free(g);
- return generate_sorted_domains(domain_list,
- executed, build);
- }
- list_c = generate_sorted_domains_part(domain_list,
- g->order + first, i - first, executed, build);
- list_c = isl_ast_graft_list_fuse(list_c, build);
- if (first == 0)
- list = list_c;
- else
- list = isl_ast_graft_list_concat(list, list_c);
- ++i;
- } while (list && n);
-
- if (n > 0)
- list = isl_ast_graft_list_free(list);
-
- list = isl_ast_graft_list_sort(list);
+ depth = isl_ast_build_get_depth(build);
+ data.list = NULL;
+ data.executed = executed;
+ data.build = build;
+ data.single = 0;
+ if (isl_basic_set_list_foreach_scc(domain_list, &shared_outer, &depth,
+ &generate_sorted_domains_wrap,
+ &data) < 0)
+ data.list = isl_ast_graft_list_free(data.list);