From 3177d92af50db1d382f40e7ec2c02f7252bbc3b0 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Tue, 18 Jul 2017 10:30:56 +0200 Subject: [PATCH 1/5] Add travis.yml --- .travis.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..75aba98b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +language: c + +compiler: + - clang + - gcc + +os: + - linux + +# OSX builds do not work yet +# - osx + +osx_image: xcode9 + +dist: trusty + +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gmp ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install --with-clang --with-lld --with-python llvm ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgmp-dev libedit-dev ; fi + - export PATH=/usr/local/opt/llvm/bin:$PATH + - git submodule init + - git submodule update +env: + - INT=gmp + - INT=imath + - INT=imath-32 + +script: + - ./autogen.sh && ./configure --with-int=$INT --with-clang=system && make && make check From 367ad6a9940142d201eab70a4b5752858e240555 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Wed, 16 Aug 2017 10:52:42 +0200 Subject: [PATCH 2/5] Add isl_space_[set|map|params]_alloc_from_id_list This allows the allocation of an isl_space with a list of parameter ids. As a result, the space that is returned contains parameter dimensions that are uniquely identified by an isl_id. Such parameter dimensions are also called named parameter dimensions. Named parameter dimensions are uniquely identified by the isl_id they reference and compare according to the rules for isl_ids (see manual): "Identifiers with the same name but different pointer values are considered to be distinct. Similarly, identifiers with different names but the same pointer value are also considered to be distinct. Equal identifiers are represented using the same object." Also add isl_space_[set|map]_noparams and isl_space_params_alloc_empty for the allocation of spaces without any parameters. These will later serve as convenience alternatives in the python/c++ interfaces, where the allocation functions that allow for the creation of unnamed parameter dimensions are not available. Signed-off-by: Tobias Grosser --- doc/user.pod | 18 ++++++++++- include/isl/space.h | 14 +++++++++ isl_space.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) diff --git a/doc/user.pod b/doc/user.pod index 1bb0da48..1112ee25 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -941,6 +941,17 @@ parameters is discouraged. unsigned nparam); __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx, unsigned nparam, unsigned dim); + __isl_give isl_space *isl_space_map_alloc_from_id_list( + __isl_take isl_id_list *param_ids, + unsigned n_in, unsigned n_out); + __isl_give isl_space *isl_space_set_alloc_from_id_list( + __isl_take isl_id_list *param_ids, + unsigned n_set); + __isl_give isl_space *isl_space_params_alloc_from_id_list( + __isl_take isl_id_list *param_ids); + __isl_give isl_space *isl_space_map_alloc_noparams(isl_ctx *ctx); + __isl_give isl_space *isl_space_set_alloc_noparams(isl_ctx *ctx); + __isl_give isl_space *isl_space_params_alloc_empty(isl_ctx *ctx); __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space); __isl_null isl_space *isl_space_free(__isl_take isl_space *space); @@ -949,7 +960,12 @@ needs to be created using C. For other sets, the space needs to be created using C, while for a relation, the space -needs to be created using C. +needs to be created using C. Spaces with named parameter +dimensions can be directly constructed using +C, C, or +C. Spaces without any parameter dimensions +can be conveniently constructed using C, +C, C. To check whether a given space is that of a set or a map or whether it is a parameter space, use these functions: diff --git a/include/isl/space.h b/include/isl/space.h index 78a18181..49c33766 100644 --- a/include/isl/space.h +++ b/include/isl/space.h @@ -37,6 +37,20 @@ __isl_give isl_space *isl_space_alloc(isl_ctx *ctx, __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx, unsigned nparam, unsigned dim); __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx, unsigned nparam); + +__isl_give isl_space *isl_space_map_alloc_noparams(isl_ctx *ctx, + unsigned n_in, unsigned n_out); +__isl_give isl_space *isl_space_set_alloc_noparams(isl_ctx *ctx, + unsigned n_set); +__isl_give isl_space *isl_space_params_alloc_empty(isl_ctx *ctx); + +__isl_give isl_space *isl_space_map_alloc_from_id_list( + __isl_take isl_id_list *param_ids, unsigned n_in, unsigned n_out); +__isl_give isl_space *isl_space_set_alloc_from_id_list( + __isl_take isl_id_list *param_ids, unsigned n_set); +__isl_give isl_space *isl_space_params_alloc_from_id_list( + __isl_take isl_id_list *param_ids); + __isl_give isl_space *isl_space_copy(__isl_keep isl_space *dim); __isl_null isl_space *isl_space_free(__isl_take isl_space *space); diff --git a/isl_space.c b/isl_space.c index 0ddacc23..bf09c0de 100644 --- a/isl_space.c +++ b/isl_space.c @@ -51,6 +51,59 @@ __isl_give isl_space *isl_space_alloc(isl_ctx *ctx, return dim; } +/* Allocate a map space without any parameter dimensions. + */ +__isl_give isl_space *isl_space_map_alloc_noparams(isl_ctx *ctx, + unsigned n_in, unsigned n_out) +{ + return isl_space_alloc(ctx, 0, n_in, n_out); +} + +/* Allocate a map space without any parameter dimensions. + */ +__isl_give isl_space *isl_space_set_alloc_noparams(isl_ctx *ctx, + unsigned n_set) +{ + return isl_space_set_alloc(ctx, 0, n_set); +} + +/* Allocate a parameter space without any parameter dimensions. + */ +__isl_give isl_space *isl_space_params_alloc_empty(isl_ctx *ctx) +{ + return isl_space_params_alloc(ctx, 0); +} + +/* Allocate a map space with named parameter dimensions. + */ +__isl_give isl_space *isl_space_map_alloc_from_id_list( + __isl_take isl_id_list *param_ids, unsigned n_in, unsigned n_out) +{ + isl_ctx *ctx; + isl_space *space; + unsigned nparam; + int i; + + if (!param_ids) + return NULL; + + ctx = isl_id_list_get_ctx(param_ids); + nparam = isl_id_list_n_id(param_ids); + space = isl_space_alloc(ctx, nparam, n_in, n_out); + + if (!space) + return NULL; + + for (i = 0; i < nparam; i++) { + isl_id *id = isl_id_list_get_id(param_ids, i); + space = isl_space_set_dim_id(space, isl_dim_param, i, id); + } + + isl_id_list_free(param_ids); + + return space; +} + /* Mark the space as being that of a set, by setting the domain tuple * to isl_id_none. */ @@ -95,6 +148,18 @@ __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx, return space; } +/* Allocate a set space with named parameter dimensions. + */ +__isl_give isl_space *isl_space_set_alloc_from_id_list( + __isl_take isl_id_list *param_ids, unsigned n_set) +{ + isl_space *space; + + space = isl_space_map_alloc_from_id_list(param_ids, 0, n_set); + space = mark_as_set(space); + return space; +} + /* Mark the space as being that of a parameter domain, by setting * both tuples to isl_id_none. */ @@ -107,6 +172,17 @@ static __isl_give isl_space *mark_as_params(isl_space *space) return space; } +/* Allocate a parameter space with named parameter dimensions. + */ +__isl_give isl_space *isl_space_params_alloc_from_id_list( + __isl_take isl_id_list *param_ids) +{ + isl_space *space; + space = isl_space_map_alloc_from_id_list(param_ids, 0, 0); + space = mark_as_params(space); + return space; +} + /* Is the space that of a parameter domain? */ isl_bool isl_space_is_params(__isl_keep isl_space *space) From 180c63396f54386c85167eaf5dae1b89ca47f36f Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 3 Aug 2017 20:45:34 +0200 Subject: [PATCH 3/5] cpp/python: export isl_space isl_space is a documented isl data type required to programmatically generate isl objects. It is required to generate empty and universe sets and maps. To construct an isl_space this commit also exports three allocators, isl_[set|map]_alloc_noparams and isl_params_alloc_empty that allow the convenient construction of spaces without parameter dimensions. These constructors are exported as unnamed constructors. This is according to the isl interface guidelines, as each given set of argument types uniquely identifies the constructed space. Hence, there is no ambiguity and an unnamed constructor can be used. Spaces with named parameter dimensions can currently be obtained by using isl::manage or isl::manage_copy. After isl_id and isl_id_list have been exposed additional constructors that allow construction with named parameter lists can be exposed. Signed-off-by: Tobias Grosser Reviewed-by: Oleksandr Zinenko --- include/isl/space.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/isl/space.h b/include/isl/space.h index 49c33766..c4bcfa85 100644 --- a/include/isl/space.h +++ b/include/isl/space.h @@ -18,7 +18,7 @@ extern "C" { #endif -struct isl_space; +struct __isl_export isl_space; typedef struct isl_space isl_space; enum isl_dim_type { @@ -38,10 +38,13 @@ __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx, unsigned nparam, unsigned dim); __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx, unsigned nparam); +__isl_constructor __isl_give isl_space *isl_space_map_alloc_noparams(isl_ctx *ctx, unsigned n_in, unsigned n_out); +__isl_constructor __isl_give isl_space *isl_space_set_alloc_noparams(isl_ctx *ctx, unsigned n_set); +__isl_constructor __isl_give isl_space *isl_space_params_alloc_empty(isl_ctx *ctx); __isl_give isl_space *isl_space_map_alloc_from_id_list( From 7ce6b49fa9f5a210f4cc15658815b6b68a3b6ac2 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 3 Aug 2017 22:59:45 +0200 Subject: [PATCH 4/5] cpp/python: export empty and universe constructors for sets These functions are documented and commonly used when constructing isl sets. Export them for basic sets, sets, and union sets: isl_basic_set_empty isl_basic_set_universe isl_set_empty isl_set_universe isl_union_set_empty As the arguments of these constructors do not always uniquely identify the constructed object, named constructors are introduced according to the isl interface guidelines. Signed-off-by: Tobias Grosser Reviewed-by: Oleksandr Zinenko --- include/isl/set.h | 4 ++++ include/isl/union_set.h | 1 + 2 files changed, 5 insertions(+) diff --git a/include/isl/set.h b/include/isl/set.h index 793195b0..609dabb7 100644 --- a/include/isl/set.h +++ b/include/isl/set.h @@ -91,7 +91,9 @@ int isl_basic_set_is_rational(__isl_keep isl_basic_set *bset); __isl_null isl_basic_set *isl_basic_set_free(__isl_take isl_basic_set *bset); __isl_give isl_basic_set *isl_basic_set_copy(__isl_keep isl_basic_set *bset); +__isl_export __isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_space *space); +__isl_export __isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_space *space); __isl_give isl_basic_set *isl_basic_set_nat_universe(__isl_take isl_space *dim); __isl_give isl_basic_set *isl_basic_set_positive_orthant( @@ -236,7 +238,9 @@ isl_bool isl_basic_set_is_subset(__isl_keep isl_basic_set *bset1, isl_bool isl_basic_set_plain_is_equal(__isl_keep isl_basic_set *bset1, __isl_keep isl_basic_set *bset2); +__isl_export __isl_give isl_set *isl_set_empty(__isl_take isl_space *space); +__isl_export __isl_give isl_set *isl_set_universe(__isl_take isl_space *space); __isl_give isl_set *isl_set_nat_universe(__isl_take isl_space *dim); __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set); diff --git a/include/isl/union_set.h b/include/isl/union_set.h index 6e4e0b68..7da891ee 100644 --- a/include/isl/union_set.h +++ b/include/isl/union_set.h @@ -16,6 +16,7 @@ __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_export __isl_give isl_union_set *isl_union_set_empty(__isl_take isl_space *space); __isl_give isl_union_set *isl_union_set_copy(__isl_keep isl_union_set *uset); __isl_null isl_union_set *isl_union_set_free(__isl_take isl_union_set *uset); From 7cc58a9b255b99ce6e9015329b8d4ad83d6fdc35 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 3 Aug 2017 23:01:04 +0200 Subject: [PATCH 5/5] cpp/python: export empty and universe constructors for maps These functions are documented and commonly used when constructing isl maps. Export them for basic maps, maps, and union maps: isl_basic_map_empty isl_basic_map_universe isl_map_empty isl_map_universe isl_union_map_empty As the arguments of these constructors do not always uniquely identify the constructed object, named constructors are introduced according to the isl interface guidelines. Signed-off-by: Tobias Grosser Reviewed-by: Oleksandr Zinenko --- include/isl/map.h | 4 ++++ include/isl/union_map.h | 1 + 2 files changed, 5 insertions(+) diff --git a/include/isl/map.h b/include/isl/map.h index 0ff17fe5..11ac8df0 100644 --- a/include/isl/map.h +++ b/include/isl/map.h @@ -119,7 +119,9 @@ __isl_give isl_basic_map *isl_basic_map_less_at(__isl_take isl_space *dim, unsigned pos); __isl_give isl_basic_map *isl_basic_map_more_at(__isl_take isl_space *dim, unsigned pos); +__isl_export __isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_space *space); +__isl_export __isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_space *space); __isl_give isl_basic_map *isl_basic_map_nat_universe(__isl_take isl_space *dim); __isl_give isl_basic_map *isl_basic_map_remove_redundancies( @@ -281,8 +283,10 @@ isl_bool isl_basic_map_is_subset(__isl_keep isl_basic_map *bmap1, isl_bool isl_basic_map_is_strict_subset(__isl_keep isl_basic_map *bmap1, __isl_keep isl_basic_map *bmap2); +__isl_export __isl_give isl_map *isl_map_universe(__isl_take isl_space *space); __isl_give isl_map *isl_map_nat_universe(__isl_take isl_space *dim); +__isl_export __isl_give isl_map *isl_map_empty(__isl_take isl_space *space); __isl_give isl_map *isl_map_identity(__isl_take isl_space *dim); __isl_give isl_map *isl_map_lex_lt_first(__isl_take isl_space *dim, unsigned n); diff --git a/include/isl/union_map.h b/include/isl/union_map.h index 966164db..a0a7ab1e 100644 --- a/include/isl/union_map.h +++ b/include/isl/union_map.h @@ -24,6 +24,7 @@ __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_export __isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *space); __isl_give isl_union_map *isl_union_map_copy(__isl_keep isl_union_map *umap); __isl_null isl_union_map *isl_union_map_free(__isl_take isl_union_map *umap);