From ddd566e5697e9d15ae243e8d8e2d8e5991107c31 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 28 Dec 2018 12:38:22 +0100 Subject: [PATCH] add exported isl_union_{set,map}_empty_ctx The space argument of isl_union_{set,map}_empty_space allows the user to initialize the parameter space of the union set or map. There is, however, no need to specify this parameter space in advance since any binary operation performed on union sets or maps will align the parameters of the arguments. In practice, the only (minor) advantage of specifying this space beforehand is that it saves on an allocation of a space. This is not a sufficient reason to force the user to get hold of some space before constructing a union set or map. The user may very well construct a default space using isl_space_unit, but conceptually there should be no need, so offer a variant of the function that only requires an isl_ctx. Signed-off-by: Sven Verdoolaege --- doc/user.pod | 4 ++++ include/isl/union_map.h | 2 ++ include/isl/union_set.h | 2 ++ isl_union_map.c | 14 ++++++++++++++ 4 files changed, 22 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 5def8ba2..255bda18 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -1920,10 +1920,14 @@ C has functions for creating some standard sets and relations. __isl_take isl_space *space); __isl_give isl_map *isl_map_empty( __isl_take isl_space *space); + __isl_give isl_union_set *isl_union_set_empty_ctx( + isl_ctx *ctx); __isl_give isl_union_set *isl_union_set_empty_space( __isl_take isl_space *space); __isl_give isl_union_set *isl_union_set_empty( __isl_take isl_space *space); + __isl_give isl_union_map *isl_union_map_empty_ctx( + isl_ctx *ctx); __isl_give isl_union_map *isl_union_map_empty_space( __isl_take isl_space *space); __isl_give isl_union_map *isl_union_map_empty( diff --git a/include/isl/union_map.h b/include/isl/union_map.h index 3a86f400..ef400d7b 100644 --- a/include/isl/union_map.h +++ b/include/isl/union_map.h @@ -25,6 +25,8 @@ __isl_give isl_union_map *isl_union_map_from_basic_map( __isl_take isl_basic_map *bmap); __isl_constructor __isl_give isl_union_map *isl_union_map_from_map(__isl_take isl_map *map); +__isl_overload +__isl_give isl_union_map *isl_union_map_empty_ctx(isl_ctx *ctx); __isl_give isl_union_map *isl_union_map_empty_space( __isl_take isl_space *space); __isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *space); diff --git a/include/isl/union_set.h b/include/isl/union_set.h index 90c83bbb..844dbb1d 100644 --- a/include/isl/union_set.h +++ b/include/isl/union_set.h @@ -16,6 +16,8 @@ __isl_give isl_union_set *isl_union_set_from_basic_set( __isl_take isl_basic_set *bset); __isl_constructor __isl_give isl_union_set *isl_union_set_from_set(__isl_take isl_set *set); +__isl_overload +__isl_give isl_union_set *isl_union_set_empty_ctx(isl_ctx *ctx); __isl_give isl_union_set *isl_union_set_empty_space( __isl_take isl_space *space); __isl_give isl_union_set *isl_union_set_empty(__isl_take isl_space *space); diff --git a/isl_union_map.c b/isl_union_map.c index dd4ca1dc..de866328 100644 --- a/isl_union_map.c +++ b/isl_union_map.c @@ -122,6 +122,13 @@ static __isl_give isl_union_map *isl_union_map_alloc( return umap; } +/* Create an empty union map without specifying any parameters. + */ +__isl_give isl_union_map *isl_union_map_empty_ctx(isl_ctx *ctx) +{ + return isl_union_map_empty_space(isl_space_unit(ctx)); +} + __isl_give isl_union_map *isl_union_map_empty_space(__isl_take isl_space *space) { return isl_union_map_alloc(space, 16); @@ -134,6 +141,13 @@ __isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *space) return isl_union_map_empty_space(space); } +/* Create an empty union set without specifying any parameters. + */ +__isl_give isl_union_set *isl_union_set_empty_ctx(isl_ctx *ctx) +{ + return uset_from_umap(isl_union_map_empty_ctx(ctx)); +} + __isl_give isl_union_set *isl_union_set_empty_space(__isl_take isl_space *space) { return uset_from_umap(isl_union_map_empty_space(space)); -- 2.11.4.GIT