X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_constraint.c;h=7f19658a93acc84d0e3782d04cfcfa43c7b7d271;hb=c3ba286dbe6bfca510479ac71bef0d6d744f35fc;hp=923cf59228ddbcf3612855f60065966204325329;hpb=44d79a0484a9e0cbb0f40221b8a42dec5fa6c133;p=platform%2Fupstream%2Fisl.git diff --git a/isl_constraint.c b/isl_constraint.c index 923cf59..7f19658 100644 --- a/isl_constraint.c +++ b/isl_constraint.c @@ -2,7 +2,7 @@ * Copyright 2008-2009 Katholieke Universiteit Leuven * Copyright 2010 INRIA Saclay * - * Use of this software is governed by the GNU LGPLv2.1 license + * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, K.U.Leuven, Departement * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium @@ -181,6 +181,18 @@ void *isl_constraint_free(struct isl_constraint *c) return NULL; } +/* Return the number of constraints in "bset", i.e., the + * number of times isl_basic_set_foreach_constraint will + * call the callback. + */ +int isl_basic_set_n_constraint(__isl_keep isl_basic_set *bset) +{ + if (!bset) + return -1; + + return bset->n_eq + bset->n_ineq; +} + int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap, int (*fn)(__isl_take isl_constraint *c, void *user), void *user) { @@ -291,6 +303,12 @@ __isl_give isl_space *isl_constraint_get_space( return constraint ? isl_local_space_get_space(constraint->ls) : NULL; } +__isl_give isl_local_space *isl_constraint_get_local_space( + __isl_keep isl_constraint *constraint) +{ + return constraint ? isl_local_space_copy(constraint->ls) : NULL; +} + int isl_constraint_dim(struct isl_constraint *constraint, enum isl_dim_type type) { @@ -337,6 +355,40 @@ error: return -1; } +/* Does the given constraint represent a lower bound on the given + * dimension? + */ +int isl_constraint_is_lower_bound(__isl_keep isl_constraint *constraint, + enum isl_dim_type type, unsigned pos) +{ + if (!constraint) + return -1; + + if (pos >= isl_local_space_dim(constraint->ls, type)) + isl_die(isl_constraint_get_ctx(constraint), isl_error_invalid, + "position out of bounds", return -1); + + pos += isl_local_space_offset(constraint->ls, type); + return isl_int_is_pos(constraint->v->el[pos]); +} + +/* Does the given constraint represent an upper bound on the given + * dimension? + */ +int isl_constraint_is_upper_bound(__isl_keep isl_constraint *constraint, + enum isl_dim_type type, unsigned pos) +{ + if (!constraint) + return -1; + + if (pos >= isl_local_space_dim(constraint->ls, type)) + isl_die(isl_constraint_get_ctx(constraint), isl_error_invalid, + "position out of bounds", return -1); + + pos += isl_local_space_offset(constraint->ls, type); + return isl_int_is_neg(constraint->v->el[pos]); +} + const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint, enum isl_dim_type type, unsigned pos) {