add isl_basic_set_add_div_constraints
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Sun, 7 Apr 2024 15:52:30 +0000 (7 17:52 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Sun, 7 Apr 2024 15:52:30 +0000 (7 17:52 +0200)
This will be used in an upcoming commit.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
isl_map.c
isl_map_private.h

index 88477c2..b3f24ae 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -6162,6 +6162,23 @@ __isl_give isl_basic_map *isl_basic_map_add_div_constraints(
        return bmap;
 }
 
+/* For the div d = floor(f/m) at position "pos", add the constraints
+ *
+ *             f - m d >= 0
+ *             -(f-(m-1)) + m d >= 0
+ *
+ * Note that the second constraint is the negation of
+ *
+ *             f - m d >= m
+ */
+__isl_give isl_basic_set *isl_basic_set_add_div_constraints(
+       __isl_take isl_basic_set *bset, unsigned pos)
+{
+       isl_basic_map *bmap = bset_to_bmap(bset);
+       bmap = isl_basic_map_add_div_constraints(bmap, pos);
+       return bset_from_bmap(bmap);
+}
+
 /* For each known div d = floor(f/m), add the constraints
  *
  *             f - m d >= 0
index 970cfeb..839633d 100644 (file)
@@ -374,6 +374,8 @@ __isl_give isl_basic_map *isl_basic_map_add_div_constraint(
        __isl_take isl_basic_map *bmap, unsigned div, int sign);
 __isl_give isl_basic_map *isl_basic_map_add_div_constraints(
        __isl_take isl_basic_map *bmap, unsigned div);
+__isl_give isl_basic_set *isl_basic_set_add_div_constraints(
+       __isl_take isl_basic_set *bset, unsigned pos);
 __isl_give isl_basic_map *isl_basic_map_add_known_div_constraints(
        __isl_take isl_basic_map *bmap);
 __isl_give isl_basic_map *isl_basic_map_drop_redundant_divs(