From d44fb55aa49dc3076f59434db5cec254c1d39a4f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 23 Feb 2013 13:41:49 +0100 Subject: [PATCH] add isl_set_lower_bound_val and isl_set_upper_bound_val Signed-off-by: Sven Verdoolaege --- doc/user.pod | 10 +++++++++- include/isl/set.h | 4 ++++ isl_map.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/doc/user.pod b/doc/user.pod index b696ac09..ab1081e7 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -2329,6 +2329,10 @@ dimension has the fixed given value. __isl_give isl_set *isl_set_lower_bound_si( __isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value); + __isl_give isl_set *isl_set_lower_bound_val( + __isl_take isl_set *set, + enum isl_dim_type type, unsigned pos, + __isl_take isl_val *value); __isl_give isl_map *isl_map_lower_bound_si( __isl_take isl_map *map, enum isl_dim_type type, unsigned pos, int value); @@ -2339,12 +2343,16 @@ dimension has the fixed given value. __isl_give isl_set *isl_set_upper_bound_si( __isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value); + __isl_give isl_set *isl_set_upper_bound_val( + __isl_take isl_set *set, + enum isl_dim_type type, unsigned pos, + __isl_take isl_val *value); __isl_give isl_map *isl_map_upper_bound_si( __isl_take isl_map *map, enum isl_dim_type type, unsigned pos, int value); Intersect the set or relation with the half-space where the given -dimension has a value bounded by the fixed given value. +dimension has a value bounded by the fixed given integer value. __isl_give isl_set *isl_set_equate(__isl_take isl_set *set, enum isl_dim_type type1, int pos1, diff --git a/include/isl/set.h b/include/isl/set.h index d9af196e..31d4e351 100644 --- a/include/isl/set.h +++ b/include/isl/set.h @@ -171,10 +171,14 @@ __isl_give isl_set *isl_set_lower_bound_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value); __isl_give isl_set *isl_set_lower_bound(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, isl_int value); +__isl_give isl_set *isl_set_lower_bound_val(__isl_take isl_set *set, + enum isl_dim_type type, unsigned pos, __isl_take isl_val *value); __isl_give isl_set *isl_set_upper_bound_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value); __isl_give isl_set *isl_set_upper_bound(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, isl_int value); +__isl_give isl_set *isl_set_upper_bound_val(__isl_take isl_set *set, + enum isl_dim_type type, unsigned pos, __isl_take isl_val *value); __isl_give isl_set *isl_set_equate(__isl_take isl_set *set, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2); diff --git a/isl_map.c b/isl_map.c index f71cda17..f5e95d16 100644 --- a/isl_map.c +++ b/isl_map.c @@ -5755,6 +5755,46 @@ __isl_give isl_set *isl_set_upper_bound(__isl_take isl_set *set, return isl_map_upper_bound(set, type, pos, value); } +/* Force the values of the variable at position "pos" of type "type" of "set" + * to be no smaller than "value". + */ +__isl_give isl_set *isl_set_lower_bound_val(__isl_take isl_set *set, + enum isl_dim_type type, unsigned pos, __isl_take isl_val *value) +{ + if (!value) + goto error; + if (!isl_val_is_int(value)) + isl_die(isl_set_get_ctx(set), isl_error_invalid, + "expecting integer value", goto error); + set = isl_set_lower_bound(set, type, pos, value->n); + isl_val_free(value); + return set; +error: + isl_val_free(value); + isl_set_free(set); + return NULL; +} + +/* Force the values of the variable at position "pos" of type "type" of "set" + * to be no greater than "value". + */ +__isl_give isl_set *isl_set_upper_bound_val(__isl_take isl_set *set, + enum isl_dim_type type, unsigned pos, __isl_take isl_val *value) +{ + if (!value) + goto error; + if (!isl_val_is_int(value)) + isl_die(isl_set_get_ctx(set), isl_error_invalid, + "expecting integer value", goto error); + set = isl_set_upper_bound(set, type, pos, value->n); + isl_val_free(value); + return set; +error: + isl_val_free(value); + isl_set_free(set); + return NULL; +} + struct isl_set *isl_set_lower_bound_dim(struct isl_set *set, unsigned dim, isl_int value) { -- 2.11.4.GIT