generalize isl_multi_aff_set_dim_name
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 16 Jul 2012 12:30:36 +0000 (14:30 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 18 Sep 2012 12:58:05 +0000 (14:58 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_aff.c
isl_multi_templ.c

index 1fb8580..0b9bf88 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -2687,31 +2687,6 @@ int isl_multi_aff_plain_is_equal(__isl_keep isl_multi_aff *maff1,
        return 1;
 }
 
-__isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
-       __isl_take isl_multi_aff *maff,
-       enum isl_dim_type type, unsigned pos, const char *s)
-{
-       int i;
-
-       maff = isl_multi_aff_cow(maff);
-       if (!maff)
-               return NULL;
-
-       maff->space = isl_space_set_dim_name(maff->space, type, pos, s);
-       if (!maff->space)
-               return isl_multi_aff_free(maff);
-
-       if (type == isl_dim_out)
-               return maff;
-       for (i = 0; i < maff->n; ++i) {
-               maff->p[i] = isl_aff_set_dim_name(maff->p[i], type, pos, s);
-               if (!maff->p[i])
-                       return isl_multi_aff_free(maff);
-       }
-
-       return maff;
-}
-
 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(__isl_take isl_multi_aff *maff,
        enum isl_dim_type type, unsigned first, unsigned n)
 {
index 17b4e0c..6bf940c 100644 (file)
@@ -121,6 +121,31 @@ unsigned FN(MULTI(BASE),dim)(__isl_keep MULTI(BASE) *multi,
        return multi ? isl_space_dim(multi->space, type) : 0;
 }
 
+__isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_name)(
+       __isl_take MULTI(BASE) *multi,
+       enum isl_dim_type type, unsigned pos, const char *s)
+{
+       int i;
+
+       multi = FN(MULTI(BASE),cow)(multi);
+       if (!multi)
+               return NULL;
+
+       multi->space = isl_space_set_dim_name(multi->space, type, pos, s);
+       if (!multi->space)
+               return FN(MULTI(BASE),free)(multi);
+
+       if (type == isl_dim_out)
+               return multi;
+       for (i = 0; i < multi->n; ++i) {
+               multi->p[i] = FN(EL,set_dim_name)(multi->p[i], type, pos, s);
+               if (!multi->p[i])
+                       return FN(MULTI(BASE),free)(multi);
+       }
+
+       return multi;
+}
+
 const char *FN(MULTI(BASE),get_tuple_name)(__isl_keep MULTI(BASE) *multi,
        enum isl_dim_type type)
 {