From 8aefe0623d375cc83ba7812a5739a72c89dfeb3d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 2 Jan 2014 15:44:47 +0100 Subject: [PATCH] add isl_multi_aff_flatten_domain Signed-off-by: Sven Verdoolaege --- doc/user.pod | 3 +++ include/isl/aff.h | 3 +++ isl_aff.c | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 3d26627b..b7d73c6c 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -4501,6 +4501,9 @@ It can be modified using __isl_take isl_multi_pw_aff *mpa, enum isl_dim_type type, const char *s); + __isl_give isl_multi_aff *isl_multi_aff_flatten_domain( + __isl_take isl_multi_aff *ma); + __isl_give isl_multi_aff *isl_multi_aff_insert_dims( __isl_take isl_multi_aff *ma, enum isl_dim_type type, unsigned first, unsigned n); diff --git a/include/isl/aff.h b/include/isl/aff.h index f4ee1fe7..c0fedb4a 100644 --- a/include/isl/aff.h +++ b/include/isl/aff.h @@ -419,6 +419,9 @@ __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); +__isl_give isl_multi_aff *isl_multi_aff_flatten_domain( + __isl_take isl_multi_aff *ma); + __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_product( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_flat_range_product( diff --git a/isl_aff.c b/isl_aff.c index 97008b0e..3af31683 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -3273,6 +3273,28 @@ error: #undef NO_DOMAIN #undef NO_INTERSECT_DOMAIN +/* Remove any internal structure of the domain of "ma". + * If there is any such internal structure in the input, + * then the name of the corresponding space is also removed. + */ +__isl_give isl_multi_aff *isl_multi_aff_flatten_domain( + __isl_take isl_multi_aff *ma) +{ + isl_space *space; + + if (!ma) + return NULL; + + if (!ma->space->nested[0]) + return ma; + + space = isl_multi_aff_get_space(ma); + space = isl_space_flatten_domain(space); + ma = isl_multi_aff_reset_space(ma, space); + + return ma; +} + /* Given a map space, return an isl_multi_aff that maps a wrapped copy * of the space to its domain. */ -- 2.11.4.GIT