From 53c2cef7bf02c9d4a9af1168b2e81aacc3ea2049 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 20 Mar 2011 14:51:30 +0100 Subject: [PATCH] add isl_map_remove_divs Signed-off-by: Sven Verdoolaege --- doc/user.pod | 2 ++ include/isl/map.h | 1 + isl_map.c | 27 ++++++++++++++++----------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index a646ee1..72ffd44 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -975,6 +975,8 @@ using the following functions, which compute an overapproximation. __isl_take isl_basic_map *bmap); __isl_give isl_set *isl_set_remove_divs( __isl_take isl_set *set); + __isl_give isl_map *isl_map_remove_divs( + __isl_take isl_map *map); To iterate over all the sets or maps in a union set or map, use diff --git a/include/isl/map.h b/include/isl/map.h index 7e4ef78..8884aee 100644 --- a/include/isl/map.h +++ b/include/isl/map.h @@ -327,6 +327,7 @@ __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_basic_map *isl_basic_map_remove_divs( __isl_take isl_basic_map *bmap); +__isl_give isl_map *isl_map_remove_divs(__isl_take isl_map *map); __isl_give isl_map *isl_map_remove_dims(__isl_take isl_map *map, enum isl_dim_type type, unsigned first, unsigned n); struct isl_map *isl_map_remove_inputs(struct isl_map *map, diff --git a/isl_map.c b/isl_map.c index fbf95f7..0b3f7cc 100644 --- a/isl_map.c +++ b/isl_map.c @@ -1459,30 +1459,35 @@ __isl_give isl_basic_set *isl_basic_set_remove_divs( (struct isl_basic_map *)bset); } -struct isl_set *isl_set_remove_divs(struct isl_set *set) +__isl_give isl_map *isl_map_remove_divs(__isl_take isl_map *map) { int i; - if (!set) + if (!map) return NULL; - if (set->n == 0) - return set; + if (map->n == 0) + return map; - set = isl_set_cow(set); - if (!set) + map = isl_map_cow(map); + if (!map) return NULL; - for (i = 0; i < set->n; ++i) { - set->p[i] = isl_basic_set_remove_divs(set->p[i]); - if (!set->p[i]) + for (i = 0; i < map->n; ++i) { + map->p[i] = isl_basic_map_remove_divs(map->p[i]); + if (!map->p[i]) goto error; } - return set; + return map; error: - isl_set_free(set); + isl_map_free(map); return NULL; } +__isl_give isl_set *isl_set_remove_divs(__isl_take isl_set *set) +{ + return isl_map_remove_divs(set); +} + struct isl_basic_map *isl_basic_map_remove_dims(struct isl_basic_map *bmap, enum isl_dim_type type, unsigned first, unsigned n) { -- 2.7.4