isl_schedule.c: extract out isl_band_alloc
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 20 Mar 2012 16:03:46 +0000 (17:03 +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>
isl_band.c
isl_band_private.h
isl_schedule.c

index acd1c53..b6624cf 100644 (file)
@@ -17,6 +17,19 @@ isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band)
        return band ? isl_union_pw_multi_aff_get_ctx(band->pma) : NULL;
 }
 
+__isl_give isl_band *isl_band_alloc(isl_ctx *ctx)
+{
+       isl_band *band;
+
+       band = isl_calloc_type(ctx, isl_band);
+       if (!band)
+               return NULL;
+
+       band->ref = 1;
+
+       return band;
+}
+
 /* We not only increment the reference count of the band,
  * but also that of the schedule that contains this band.
  * This ensures that the schedule won't disappear while there
index 55599cb..8f201f6 100644 (file)
@@ -33,6 +33,8 @@ struct isl_band {
        isl_band_list *children;
 };
 
+__isl_give isl_band *isl_band_alloc(isl_ctx *ctx);
+
 __isl_give isl_union_map *isl_band_list_get_suffix_schedule(
        __isl_keep isl_band_list *list);
 
index 77ab0b0..fe430d6 100644 (file)
@@ -2911,11 +2911,10 @@ static __isl_give isl_band *construct_band(__isl_keep isl_schedule *schedule,
        isl_band *band;
        unsigned start, end;
 
-       band = isl_calloc_type(ctx, isl_band);
+       band = isl_band_alloc(ctx);
        if (!band)
                return NULL;
 
-       band->ref = 1;
        band->schedule = schedule;
        band->parent = parent;