From dfd3cb0b9759478067a16b16265c549bebca8919 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 16 Jul 2012 14:30:36 +0200 Subject: [PATCH] generalize isl_multi_aff_set_dim_name Signed-off-by: Sven Verdoolaege --- isl_aff.c | 25 ------------------------- isl_multi_templ.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/isl_aff.c b/isl_aff.c index 1fb85805..0b9bf883 100644 --- 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) { diff --git a/isl_multi_templ.c b/isl_multi_templ.c index 17b4e0c9..6bf940c7 100644 --- a/isl_multi_templ.c +++ b/isl_multi_templ.c @@ -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) { -- 2.11.4.GIT