add generic isl_pw_*_set_tuple_id
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 26 Sep 2011 11:39:30 +0000 (13:39 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 26 Sep 2011 16:07:26 +0000 (18:07 +0200)
For consistency, this means we need to change the prototype of
isl_pw_aff_set_tuple_id.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/aff.h
isl_aff.c
isl_pw_templ.c

index 4386843..8a504be 100644 (file)
@@ -2617,7 +2617,7 @@ It can be modified using
        #include <isl/aff.h>
        __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
                __isl_take isl_pw_aff *pwaff,
-               __isl_take isl_id *id);
+               enum isl_dim_type type, __isl_take isl_id *id);
        __isl_give isl_aff *isl_aff_set_dim_name(
                __isl_take isl_aff *aff, enum isl_dim_type type,
                unsigned pos, const char *s);
index 77a46b3..80472c9 100644 (file)
@@ -122,7 +122,7 @@ __isl_give isl_pw_aff *isl_pw_aff_align_params(__isl_take isl_pw_aff *pwaff,
        __isl_take isl_space *model);
 
 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(__isl_take isl_pw_aff *pwaff,
-       __isl_take isl_id *id);
+       enum isl_dim_type type, __isl_take isl_id *id);
 
 __isl_give isl_set *isl_pw_aff_domain(__isl_take isl_pw_aff *pwaff);
 
index 6533468..1c4f03f 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -1159,17 +1159,6 @@ __isl_give isl_pw_aff *isl_pw_aff_add_dims(__isl_take isl_pw_aff *pwaff,
        return isl_pw_aff_insert_dims(pwaff, type, pos, n);
 }
 
-__isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(__isl_take isl_pw_aff *pwaff,
-       __isl_take isl_id *id)
-{
-       isl_space *dim;
-
-       dim = isl_pw_aff_get_space(pwaff);
-       dim = isl_space_set_tuple_id(dim, isl_dim_in, id);
-
-       return isl_pw_aff_reset_space(pwaff, dim);
-}
-
 __isl_give isl_pw_aff *isl_pw_aff_from_aff(__isl_take isl_aff *aff)
 {
        isl_set *dom = isl_set_universe(isl_aff_get_domain_space(aff));
index 7f478a2..f34be2a 100644 (file)
@@ -1074,6 +1074,21 @@ __isl_give PW *FN(PW,reset_space)(__isl_take PW *pw, __isl_take isl_space *dim)
        domain = isl_space_domain(isl_space_copy(dim));
        return FN(PW,reset_space_and_domain)(pw, dim, domain);
 }
+
+__isl_give PW *FN(PW,set_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type,
+       __isl_take isl_id *id)
+{
+       isl_space *space;
+
+       pw = FN(PW,cow)(pw);
+       if (!pw)
+               return isl_id_free(id);
+
+       space = FN(PW,get_space)(pw);
+       space = isl_space_set_tuple_id(space, type, id);
+
+       return FN(PW,reset_space)(pw, space);
+}
 #endif
 
 int FN(PW,has_equal_space)(__isl_keep PW *pw1, __isl_keep PW *pw2)