X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_band.c;h=e545a8a4dc3c7eafbe584da1595f501dd463a1a7;hb=d091597e4a8c3644ede04c8f072af08175238085;hp=e381c60915f320e3bc77b3388c90e15e544fbc71;hpb=b0a600c3dbb267704fd3799ca50077d6471d2444;p=platform%2Fupstream%2Fisl.git diff --git a/isl_band.c b/isl_band.c index e381c60..e545a8a 100644 --- a/isl_band.c +++ b/isl_band.c @@ -1,7 +1,7 @@ /* * Copyright 2011 INRIA Saclay * - * Use of this software is governed by the GNU LGPLv2.1 license + * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, @@ -284,6 +284,44 @@ __isl_give isl_union_map *isl_band_get_suffix_schedule( return isl_union_map_from_union_pw_multi_aff(suffix); } +/* Call "fn" on each band (recursively) in the list + * in depth-first post-order. + */ +int isl_band_list_foreach_band(__isl_keep isl_band_list *list, + int (*fn)(__isl_keep isl_band *band, void *user), void *user) +{ + int i, n; + + if (!list) + return -1; + + n = isl_band_list_n_band(list); + for (i = 0; i < n; ++i) { + isl_band *band; + int r = 0; + + band = isl_band_list_get_band(list, i); + if (isl_band_has_children(band)) { + isl_band_list *children; + + children = isl_band_get_children(band); + r = isl_band_list_foreach_band(children, fn, user); + isl_band_list_free(children); + } + + if (!band) + r = -1; + if (r == 0) + r = fn(band, user); + + isl_band_free(band); + if (r) + return r; + } + + return 0; +} + /* Internal data used during the construction of the schedule * for the tile loops. * @@ -432,6 +470,7 @@ int isl_band_tile(__isl_keep isl_band *band, __isl_take isl_vec *sizes) child->children = band->children; band->children = list; + child->parent = band; isl_union_pw_multi_aff_free(band->pma); band->pma = sched;