Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp: export space and the set and map empty and universe constructors #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 17 additions & 1 deletion doc/user.pod
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -949,7 +960,12 @@ needs to be created using C<isl_space_params_alloc>.
For other sets, the space
needs to be created using C<isl_space_set_alloc>, while
for a relation, the space
needs to be created using C<isl_space_alloc>.
needs to be created using C<isl_space_alloc>. Spaces with named parameter
dimensions can be directly constructed using
C<isl_space_map_alloc_from_id_list>, C<isl_space_set_alloc_from_id_list>, or
C<isl_space_params_alloc_from_id_list>. Spaces without any parameter dimensions
can be conveniently constructed using C<isl_space_map_alloc_noparams>,
C<isl_space_set_alloc_noparams>, C<isl_space_params_alloc_empty>.

To check whether a given space is that of a set or a map
or whether it is a parameter space, use these functions:
Expand Down
4 changes: 4 additions & 0 deletions include/isl/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions include/isl/set.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
19 changes: 18 additions & 1 deletion include/isl/space.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -37,6 +37,23 @@ __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_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(
__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);

Expand Down
1 change: 1 addition & 0 deletions include/isl/union_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions include/isl/union_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
76 changes: 76 additions & 0 deletions isl_space.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand All @@ -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)
Expand Down