From 1a879f17bc3611936168d0ea017855731c484cb6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 16 Oct 2011 15:07:44 +0200 Subject: [PATCH] add isl_union_map_gist_params Signed-off-by: Sven Verdoolaege --- doc/user.pod | 6 ++++++ include/isl/union_map.h | 3 +++ include/isl/union_set.h | 3 +++ isl_union_map.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index bc26688..3b83443 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -2372,6 +2372,9 @@ instead. __isl_give isl_union_set *isl_union_set_gist( __isl_take isl_union_set *uset, __isl_take isl_union_set *context); + __isl_give isl_union_set *isl_union_set_gist_params( + __isl_take isl_union_set *uset, + __isl_take isl_set *set); __isl_give isl_basic_map *isl_basic_map_gist( __isl_take isl_basic_map *bmap, __isl_take isl_basic_map *context); @@ -2383,6 +2386,9 @@ instead. __isl_give isl_union_map *isl_union_map_gist( __isl_take isl_union_map *umap, __isl_take isl_union_map *context); + __isl_give isl_union_map *isl_union_map_gist_params( + __isl_take isl_union_map *umap, + __isl_take isl_set *set); The gist operation returns a set or relation that has the same intersection with the context as the input set or relation. diff --git a/include/isl/union_map.h b/include/isl/union_map.h index 15918f7..6e21dad 100644 --- a/include/isl/union_map.h +++ b/include/isl/union_map.h @@ -81,6 +81,9 @@ __isl_give isl_union_map *isl_union_map_flat_range_product( __isl_export __isl_give isl_union_map *isl_union_map_gist(__isl_take isl_union_map *umap, __isl_take isl_union_map *context); +__isl_export +__isl_give isl_union_map *isl_union_map_gist_params( + __isl_take isl_union_map *umap, __isl_take isl_set *set); __isl_export __isl_give isl_union_map *isl_union_map_intersect_domain( diff --git a/include/isl/union_set.h b/include/isl/union_set.h index b1c3b27..50219de 100644 --- a/include/isl/union_set.h +++ b/include/isl/union_set.h @@ -59,6 +59,9 @@ __isl_give isl_union_set *isl_union_set_product(__isl_take isl_union_set *uset1, __isl_export __isl_give isl_union_set *isl_union_set_gist(__isl_take isl_union_set *uset, __isl_take isl_union_set *context); +__isl_export +__isl_give isl_union_set *isl_union_set_gist_params( + __isl_take isl_union_set *uset, __isl_take isl_set *set); __isl_export __isl_give isl_union_set *isl_union_set_apply( diff --git a/isl_union_map.c b/isl_union_map.c index 5ccc46e..810697c 100644 --- a/isl_union_map.c +++ b/isl_union_map.c @@ -744,6 +744,38 @@ error: return NULL; } +static int gist_params_entry(void **entry, void *user) +{ + struct isl_union_map_gen_bin_set_data *data = user; + isl_map *map = *entry; + int empty; + + map = isl_map_copy(map); + map = isl_map_gist_params(map, isl_set_copy(data->set)); + + empty = isl_map_is_empty(map); + if (empty < 0) { + isl_map_free(map); + return -1; + } + + data->res = isl_union_map_add_map(data->res, map); + + return 0; +} + +__isl_give isl_union_map *isl_union_map_gist_params( + __isl_take isl_union_map *umap, __isl_take isl_set *set) +{ + return gen_bin_set_op(umap, set, &gist_params_entry); +} + +__isl_give isl_union_set *isl_union_set_gist_params( + __isl_take isl_union_set *uset, __isl_take isl_set *set) +{ + return isl_union_map_gist_params(uset, set); +} + __isl_give isl_union_map *isl_union_map_gist(__isl_take isl_union_map *umap, __isl_take isl_union_map *context) { -- 2.7.4