isl_multi_templ.c: extract out isl_multi_zero_templ.c
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 30 Apr 2018 12:48:21 +0000 (30 14:48 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 13 Aug 2018 14:30:58 +0000 (13 16:30 +0200)
This makes the function isl_multi_*_zero opt-in rather than opt-out.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
Makefile.am
isl_aff.c
isl_multi_templ.c
isl_multi_zero_templ.c [new file with mode: 0644]
isl_val.c

index 44b76b9..8c579e7 100644 (file)
@@ -470,6 +470,7 @@ EXTRA_DIST = \
        isl_multi_intersect.c \
        isl_multi_identity_templ.c \
        isl_multi_move_dims_templ.c \
+       isl_multi_zero_templ.c \
        print_templ.c \
        print_templ_yaml.c \
        isl_power_templ.c \
index ab7bff9..9301f5e 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -3824,6 +3824,7 @@ error:
 #include <isl_multi_gist.c>
 #include <isl_multi_identity_templ.c>
 #include <isl_multi_move_dims_templ.c>
+#include <isl_multi_zero_templ.c>
 
 /* Construct an isl_multi_aff living in "space" that corresponds
  * to the affine transformation matrix "mat".
@@ -6173,6 +6174,7 @@ error:
 #include <isl_multi_align_set.c>
 #include <isl_multi_intersect.c>
 #include <isl_multi_move_dims_templ.c>
+#include <isl_multi_zero_templ.c>
 
 /* Does "mpa" have a non-trivial explicit domain?
  *
@@ -7914,7 +7916,6 @@ error:
 
 #define NO_PRODUCT
 #define NO_SPLICE
-#define NO_ZERO
 
 #include <isl_multi_explicit_domain.c>
 #include <isl_multi_union_pw_aff_explicit_domain.c>
index 1fc8045..bcce2aa 100644 (file)
@@ -593,43 +593,6 @@ error:
        return NULL;
 }
 
-#ifndef NO_ZERO
-/* Construct a multi expression in the given space with value zero in
- * each of the output dimensions.
- */
-__isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space)
-{
-       int n;
-       MULTI(BASE) *multi;
-
-       if (!space)
-               return NULL;
-
-       n = isl_space_dim(space , isl_dim_out);
-       multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
-
-       if (!n)
-               isl_space_free(space);
-       else {
-               int i;
-               isl_local_space *ls;
-               EL *el;
-
-               space = isl_space_domain(space);
-               ls = isl_local_space_from_space(space);
-               el = FN(EL,zero_on_domain)(ls);
-
-               for (i = 0; i < n; ++i)
-                       multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
-                                                           FN(EL,copy)(el));
-
-               FN(EL,free)(el);
-       }
-
-       return multi;
-}
-#endif
-
 __isl_give MULTI(BASE) *FN(MULTI(BASE),drop_dims)(
        __isl_take MULTI(BASE) *multi,
        enum isl_dim_type type, unsigned first, unsigned n)
diff --git a/isl_multi_zero_templ.c b/isl_multi_zero_templ.c
new file mode 100644 (file)
index 0000000..a056145
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012      Ecole Normale Superieure
+ *
+ * Use of this software is governed by the MIT license
+ *
+ * Written by Sven Verdoolaege,
+ * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
+ */
+
+#include <isl/space.h>
+#include <isl/local_space.h>
+
+#include <isl_multi_macro.h>
+
+/* Construct a multi expression in the given space with value zero in
+ * each of the output dimensions.
+ */
+__isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space)
+{
+       int n;
+       MULTI(BASE) *multi;
+
+       if (!space)
+               return NULL;
+
+       n = isl_space_dim(space , isl_dim_out);
+       multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
+
+       if (!n)
+               isl_space_free(space);
+       else {
+               int i;
+               isl_local_space *ls;
+               EL *el;
+
+               space = isl_space_domain(space);
+               ls = isl_local_space_from_space(space);
+               el = FN(EL,zero_on_domain)(ls);
+
+               for (i = 0; i < n; ++i)
+                       multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
+                                                           FN(EL,copy)(el));
+
+               FN(EL,free)(el);
+       }
+
+       return multi;
+}
index 0fe1d44..3f8fbb5 100644 (file)
--- a/isl_val.c
+++ b/isl_val.c
@@ -1671,6 +1671,7 @@ isl_stat isl_val_check_match_domain_space(__isl_keep isl_val *v,
 #include <isl_multi_no_explicit_domain.c>
 #include <isl_multi_templ.c>
 #include <isl_multi_dims.c>
+#include <isl_multi_zero_templ.c>
 
 /* Apply "fn" to each of the elements of "mv" with as second argument "v".
  */