add isl_schedule_foreach_band
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 20 Mar 2012 15:01:12 +0000 (16:01 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 6 May 2012 12:33:07 +0000 (14:33 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/schedule.h
isl_schedule.c

index acff560..7869890 100644 (file)
@@ -4417,6 +4417,15 @@ using the following function.
        __isl_give isl_band_list *isl_schedule_get_band_forest(
                __isl_keep isl_schedule *schedule);
 
+The individual bands can be visited in depth-first post-order
+using the following function.
+
+       #include <isl/schedule.h>
+       int isl_schedule_foreach_band(
+               __isl_keep isl_schedule *sched,
+               int (*fn)(__isl_keep isl_band *band, void *user),
+               void *user);
+
 The list can be manipulated as explained in L<"Lists">.
 The bands inside the list can be copied and freed using the following
 functions.
@@ -4468,7 +4477,8 @@ within its band.
 That is, if the dependence distances of the proximity
 dependences are all zero in that direction (for fixed
 iterations of outer bands).
-The function C<isl_band_list_foreach_band> calls C<fn> on the bands
+Like C<isl_schedule_foreach_band>,
+the function C<isl_band_list_foreach_band> calls C<fn> on the bands
 in depth-first post-order.
 
 A band can be tiled using the following function.
index b9b07aa..385c6c4 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <isl/union_set_type.h>
 #include <isl/union_map_type.h>
+#include <isl/band.h>
 #include <isl/list.h>
 
 #if defined(__cplusplus)
@@ -51,6 +52,9 @@ __isl_give isl_printer *isl_printer_print_schedule(__isl_take isl_printer *p,
        __isl_keep isl_schedule *schedule);
 void isl_schedule_dump(__isl_keep isl_schedule *schedule);
 
+int isl_schedule_foreach_band(__isl_keep isl_schedule *sched,
+       int (*fn)(__isl_keep isl_band *band, void *user), void *user);
+
 #if defined(__cplusplus)
 }
 #endif
index fe430d6..f944354 100644 (file)
@@ -3099,6 +3099,24 @@ __isl_give isl_band_list *isl_schedule_get_band_forest(
        return isl_band_list_dup(schedule->band_forest);
 }
 
+/* Call "fn" on each band in the schedule in depth-first post-order.
+ */
+int isl_schedule_foreach_band(__isl_keep isl_schedule *sched,
+       int (*fn)(__isl_keep isl_band *band, void *user), void *user)
+{
+       int r;
+       isl_band_list *forest;
+
+       if (!sched)
+               return -1;
+
+       forest = isl_schedule_get_band_forest(sched);
+       r = isl_band_list_foreach_band(forest, fn, user);
+       isl_band_list_free(forest);
+
+       return r;
+}
+
 static __isl_give isl_printer *print_band_list(__isl_take isl_printer *p,
        __isl_keep isl_band_list *list);