From 303faf2984bf54cdedca8d984cf9c848b556415e Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 14 Aug 2012 09:39:18 +0200 Subject: [PATCH] add isl_basic_map_order_ge Signed-off-by: Sven Verdoolaege --- doc/user.pod | 4 ++++ include/isl/map.h | 2 ++ isl_map.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index add08a62..1f27e609 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -2089,6 +2089,10 @@ dimensions are equal to each other. Intersect the relation with the hyperplane where the given dimensions have opposite values. + __isl_give isl_basic_map *isl_basic_map_order_ge( + __isl_take isl_basic_map *bmap, + enum isl_dim_type type1, int pos1, + enum isl_dim_type type2, int pos2); __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2); diff --git a/include/isl/map.h b/include/isl/map.h index 7f866446..621e2d19 100644 --- a/include/isl/map.h +++ b/include/isl/map.h @@ -432,6 +432,8 @@ struct isl_map *isl_map_remove_inputs(struct isl_map *map, __isl_give isl_basic_map *isl_basic_map_equate(__isl_take isl_basic_map *bmap, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2); +__isl_give isl_basic_map *isl_basic_map_order_ge(__isl_take isl_basic_map *bmap, + enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2); __isl_give isl_map *isl_map_equate(__isl_take isl_map *map, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2); __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map, diff --git a/isl_map.c b/isl_map.c index a43f5af1..9a5f5ea1 100644 --- a/isl_map.c +++ b/isl_map.c @@ -10458,6 +10458,37 @@ error: } /* Add a constraint imposing that the value of the first dimension is + * greater than or equal to that of the second. + */ +__isl_give isl_basic_map *isl_basic_map_order_ge(__isl_take isl_basic_map *bmap, + enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2) +{ + isl_constraint *c; + isl_local_space *ls; + + if (!bmap) + return NULL; + + if (pos1 >= isl_basic_map_dim(bmap, type1)) + isl_die(bmap->ctx, isl_error_invalid, + "index out of bounds", return isl_basic_map_free(bmap)); + if (pos2 >= isl_basic_map_dim(bmap, type2)) + isl_die(bmap->ctx, isl_error_invalid, + "index out of bounds", return isl_basic_map_free(bmap)); + + if (type1 == type2 && pos1 == pos2) + return bmap; + + ls = isl_local_space_from_space(isl_basic_map_get_space(bmap)); + c = isl_inequality_alloc(ls); + c = isl_constraint_set_coefficient_si(c, type1, pos1, 1); + c = isl_constraint_set_coefficient_si(c, type2, pos2, -1); + bmap = isl_basic_map_add_constraint(bmap, c); + + return bmap; +} + +/* Add a constraint imposing that the value of the first dimension is * greater than that of the second. */ __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map, -- 2.11.4.GIT