isl_union_templ.c: extract out isl_union_sub_templ.c
authorSven Verdoolaege <sven@cerebras.net>
Mon, 25 Jul 2022 09:58:38 +0000 (25 11:58 +0200)
committerSven Verdoolaege <sven@cerebras.net>
Fri, 11 Nov 2022 09:27:41 +0000 (11 10:27 +0100)
This makes this implementation of the isl_union_*_sub function opt-in
rather than opt-out.

Signed-off-by: Sven Verdoolaege <sven@cerebras.net>
Makefile.am
isl_aff.c
isl_fold.c
isl_polynomial.c
isl_union_sub_templ.c [new file with mode: 0644]
isl_union_templ.c

index 77d3656..1c5b270 100644 (file)
@@ -647,6 +647,7 @@ EXTRA_DIST = \
        isl_union_map_lex_templ.c \
        isl_union_neg.c \
        isl_union_pw_templ.c \
+       isl_union_sub_templ.c \
        libisl-gdb.py \
        doc/CodingStyle \
        doc/SubmittingPatches \
index 9ad4fed..8f0d94a 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -2813,6 +2813,7 @@ static __isl_give isl_aff *isl_aff_zero_in_space(__isl_take isl_space *space)
 
 #include <isl_union_single.c>
 #include <isl_union_neg.c>
+#include <isl_union_sub_templ.c>
 
 #undef BASE
 #define BASE aff
@@ -4621,6 +4622,7 @@ __isl_give isl_set *isl_multi_aff_lex_gt_set(__isl_take isl_multi_aff *ma1,
 #include <isl_union_multi.c>
 #include "isl_union_locals_templ.c"
 #include <isl_union_neg.c>
+#include <isl_union_sub_templ.c>
 
 #undef BASE
 #define BASE multi_aff
index 6c977e1..33ea278 100644 (file)
@@ -964,8 +964,6 @@ static __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_zero_in_space(
 #undef BASE
 #define BASE pw_qpolynomial_fold
 
-#define NO_SUB
-
 #include <isl_union_single.c>
 #include <isl_union_eval.c>
 
index 436f4f5..7b4eae0 100644 (file)
@@ -3128,6 +3128,7 @@ static __isl_give isl_qpolynomial *isl_qpolynomial_zero_in_space(
 #include <isl_union_single.c>
 #include <isl_union_eval.c>
 #include <isl_union_neg.c>
+#include <isl_union_sub_templ.c>
 
 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp)
 {
diff --git a/isl_union_sub_templ.c b/isl_union_sub_templ.c
new file mode 100644 (file)
index 0000000..0def716
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010      INRIA Saclay
+ *
+ * Use of this software is governed by the MIT license
+ *
+ * Written by Sven Verdoolaege,
+ * INRIA Saclay - Ile-de-France, Parc Club Orsay Universite,
+ * ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France
+ */
+
+#include "isl_union_macro.h"
+
+/* Subtract "u2" from "u1" and return the result.
+ *
+ * If the base expressions have a default zero value, then
+ * reuse isl_union_*_add to ensure the result
+ * is computed on the union of the domains of "u1" and "u2".
+ * Otherwise, compute the result directly on their shared domain.
+ */
+__isl_give UNION *FN(UNION,sub)(__isl_take UNION *u1, __isl_take UNION *u2)
+{
+#if DEFAULT_IS_ZERO
+       return FN(UNION,add)(u1, FN(UNION,neg)(u2));
+#else
+       return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
+#endif
+}
index 784e8c3..5b9352e 100644 (file)
@@ -647,24 +647,6 @@ __isl_give UNION *FN(UNION,add)(__isl_take UNION *u1, __isl_take UNION *u2)
 #endif
 }
 
-#ifndef NO_SUB
-/* Subtract "u2" from "u1" and return the result.
- *
- * If the base expressions have a default zero value, then
- * reuse isl_union_*_add to ensure the result
- * is computed on the union of the domains of "u1" and "u2".
- * Otherwise, compute the result directly on their shared domain.
- */
-__isl_give UNION *FN(UNION,sub)(__isl_take UNION *u1, __isl_take UNION *u2)
-{
-#if DEFAULT_IS_ZERO
-       return FN(UNION,add)(u1, FN(UNION,neg)(u2));
-#else
-       return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
-#endif
-}
-#endif
-
 S(UNION,any_set_data) {
        isl_set *set;
        __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);