add isl_multi_val
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 30 Apr 2013 19:20:16 +0000 (21:20 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 28 May 2013 16:15:04 +0000 (18:15 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/val.h
isl_multi_templ.c
isl_val.c
isl_val_private.h

index 30b0120..e6195ff 100644 (file)
@@ -890,6 +890,10 @@ of the original object.
        __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
                __isl_keep isl_union_pw_qpolynomial_fold *upwf);
 
+       #include <isl/val.h>
+       __isl_give isl_space *isl_multi_val_get_space(
+               __isl_keep isl_multi_val *mv);
+
        #include <isl/aff.h>
        __isl_give isl_space *isl_aff_get_domain_space(
                __isl_keep isl_aff *aff);
@@ -3313,6 +3317,88 @@ Lists can be printed using
                __isl_take isl_printer *p,
                __isl_keep isl_set_list *list);
 
+=head2 Multiple Values
+
+An C<isl_multi_val> object represents a sequence of zero or more values,
+living in a set space.
+
+An C<isl_multi_val> can be constructed from an C<isl_val_list>
+using the following function
+
+       #include <isl/val.h>
+       __isl_give isl_multi_val *isl_multi_val_from_val_list(
+               __isl_take isl_space *space,
+               __isl_take isl_val_list *list);
+
+The zero multiple value (with value zero for each set dimension)
+can be created using the following function.
+
+       #include <isl/val.h>
+       __isl_give isl_multi_val *isl_multi_val_zero(
+               __isl_take isl_space *space);
+
+Multiple values can be copied and freed using
+
+       #include <isl/val.h>
+       __isl_give isl_multi_val *isl_multi_val_copy(
+               __isl_keep isl_multi_val *mv);
+       void *isl_multi_val_free(__isl_take isl_multi_val *mv);
+
+They can be inspected using
+
+       #include <isl/val.h>
+       isl_ctx *isl_multi_val_get_ctx(
+               __isl_keep isl_multi_val *mv);
+       unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
+               enum isl_dim_type type);
+       __isl_give isl_val *isl_multi_val_get_val(
+               __isl_keep isl_multi_val *mv, int pos);
+       const char *isl_multi_val_get_tuple_name(
+               __isl_keep isl_multi_val *mv,
+               enum isl_dim_type type);
+
+They can be modified using
+
+       #include <isl/val.h>
+       __isl_give isl_multi_val *isl_multi_val_set_val(
+               __isl_take isl_multi_val *mv, int pos,
+               __isl_take isl_val *val);
+       __isl_give isl_multi_val *isl_multi_val_set_dim_name(
+               __isl_take isl_multi_val *mv,
+               enum isl_dim_type type, unsigned pos, const char *s);
+       __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
+               __isl_take isl_multi_val *mv,
+               enum isl_dim_type type, const char *s);
+       __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
+               __isl_take isl_multi_val *mv,
+               enum isl_dim_type type, __isl_take isl_id *id);
+
+       __isl_give isl_multi_val *isl_multi_val_insert_dims(
+               __isl_take isl_multi_val *mv,
+               enum isl_dim_type type, unsigned first, unsigned n);
+       __isl_give isl_multi_val *isl_multi_val_add_dims(
+               __isl_take isl_multi_val *mv,
+               enum isl_dim_type type, unsigned n);
+       __isl_give isl_multi_val *isl_multi_val_drop_dims(
+               __isl_take isl_multi_val *mv,
+               enum isl_dim_type type, unsigned first, unsigned n);
+
+Operations include
+
+       #include <isl/val.h>
+       __isl_give isl_multi_val *isl_multi_val_align_params(
+               __isl_take isl_multi_val *mv,
+               __isl_take isl_space *model);
+       __isl_give isl_multi_val *isl_multi_val_range_splice(
+               __isl_take isl_multi_val *mv1, unsigned pos,
+               __isl_take isl_multi_val *mv2);
+       __isl_give isl_multi_val *isl_multi_val_range_product(
+               __isl_take isl_multi_val *mv1,
+               __isl_take isl_multi_val *mv2);
+       __isl_give isl_multi_val *isl_multi_val_flat_range_product(
+               __isl_take isl_multi_val *mv1,
+               __isl_take isl_multi_aff *mv2);
+
 =head2 Vectors
 
 Vectors can be created, copied and freed using the following functions.
index 161602a..44162a4 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <isl/ctx.h>
 #include <isl/list.h>
+#include <isl/multi.h>
 #include <isl/printer.h>
 
 #if defined(__cplusplus)
@@ -14,6 +15,11 @@ typedef struct isl_val isl_val;
 
 ISL_DECLARE_LIST(val)
 
+struct isl_multi_val;
+typedef struct isl_multi_val isl_multi_val;
+
+ISL_DECLARE_MULTI(val)
+
 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
index ddbfc01..8e3c9d3 100644 (file)
@@ -397,6 +397,7 @@ error:
        return NULL;
 }
 
+#ifndef NO_GIST
 static __isl_give MULTI(BASE) *FN(MULTI(BASE),align_params_multi_set_and)(
        __isl_take MULTI(BASE) *multi, __isl_take isl_set *set,
        __isl_give MULTI(BASE) *(*fn)(__isl_take MULTI(BASE) *multi,
@@ -460,6 +461,7 @@ __isl_give MULTI(BASE) *FN(MULTI(BASE),gist_params)(
        dom_context = isl_set_intersect_params(dom_context, context);
        return FN(MULTI(BASE),gist)(multi, dom_context);
 }
+#endif
 
 __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),LIST(BASE))(
        __isl_take isl_space *space, __isl_take LIST(EL) *list)
@@ -493,6 +495,7 @@ error:
        return NULL;
 }
 
+#ifndef NO_IDENTITY
 /* Create a multi expression in the given space that maps each
  * input dimension to the corresponding output dimension.
  */
@@ -539,6 +542,7 @@ error:
        isl_space_free(space);
        return NULL;
 }
+#endif
 
 /* Construct a multi expression in the given space with value zero in
  * each of the output dimensions.
@@ -575,6 +579,7 @@ __isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space)
        return multi;
 }
 
+#ifndef NO_FROM_BASE
 __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el)
 {
        MULTI(BASE) *multi;
@@ -584,6 +589,7 @@ __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el)
 
        return multi;
 }
+#endif
 
 __isl_give MULTI(BASE) *FN(MULTI(BASE),drop_dims)(
        __isl_take MULTI(BASE) *multi,
index fb4b857..4af87de 100644 (file)
--- a/isl_val.c
+++ b/isl_val.c
@@ -1254,3 +1254,118 @@ __isl_give isl_printer *isl_printer_print_val(__isl_take isl_printer *p,
 
        return p;
 }
+
+/* Insert "n" dimensions of type "type" at position "first".
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * does not do anything.
+ */
+__isl_give isl_val *isl_val_insert_dims(__isl_take isl_val *v,
+       enum isl_dim_type type, unsigned first, unsigned n)
+{
+       return v;
+}
+
+/* Drop the the "n" first dimensions of type "type" at position "first".
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * does not do anything.
+ */
+__isl_give isl_val *isl_val_drop_dims(__isl_take isl_val *v,
+       enum isl_dim_type type, unsigned first, unsigned n)
+{
+       return v;
+}
+
+/* Change the name of the dimension of type "type" at position "pos" to "s".
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * does not do anything.
+ */
+__isl_give isl_val *isl_val_set_dim_name(__isl_take isl_val *v,
+       enum isl_dim_type type, unsigned pos, const char *s)
+{
+       return v;
+}
+
+/* Reset the domain space of "v" to "space".
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * does not do anything, apart from error handling and cleaning up memory.
+ */
+__isl_give isl_val *isl_val_reset_domain_space(__isl_take isl_val *v,
+       __isl_take isl_space *space)
+{
+       if (!space)
+               return isl_val_free(v);
+       isl_space_free(space);
+       return v;
+}
+
+/* Reorder the dimensions of the domain of "v" according
+ * to the given reordering.
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * does not do anything, apart from error handling and cleaning up memory.
+ */
+__isl_give isl_val *isl_val_realign_domain(__isl_take isl_val *v,
+       __isl_take isl_reordering *r)
+{
+       if (!r)
+               return isl_val_free(v);
+       isl_reordering_free(r);
+       return v;
+}
+
+/* Return an isl_val that is zero on "ls".
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * simply returns a zero isl_val in the same context as "ls".
+ */
+__isl_give isl_val *isl_val_zero_on_domain(__isl_take isl_local_space *ls)
+{
+       isl_ctx *ctx;
+
+       if (!ls)
+               return NULL;
+       ctx = isl_local_space_get_ctx(ls);
+       isl_local_space_free(ls);
+       return isl_val_zero(ctx);
+}
+
+/* Check that the domain space of "v" matches "space".
+ *
+ * Return 0 on success and -1 on error.
+ *
+ * This function is only meant to be used in the generic isl_multi_*
+ * functions which have to deal with base objects that have an associated
+ * space.  Since an isl_val does not have an associated space, this function
+ * simply returns 0, except if "v" or "space" are NULL.
+ */
+int isl_val_check_match_domain_space(__isl_keep isl_val *v,
+       __isl_keep isl_space *space)
+{
+       if (!v || !space)
+               return -1;
+       return 0;
+}
+
+#undef BASE
+#define BASE val
+
+#define NO_GIST
+#define NO_IDENTITY
+#define NO_FROM_BASE
+#include <isl_multi_templ.c>
index 8f2ce83..32d59b4 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <isl/int.h>
 #include <isl/val.h>
+#include <isl/local_space.h>
+#include <isl_reordering.h>
 
 /* Represents a "value", which may be an integer value, a rational value,
  * plus or minus infinity or "not a number".
@@ -32,4 +34,24 @@ __isl_give isl_val *isl_val_rat_from_isl_int(isl_ctx *ctx,
        isl_int n, isl_int d);
 __isl_give isl_val *isl_val_cow(__isl_take isl_val *val);
 
+__isl_give isl_val *isl_val_insert_dims(__isl_take isl_val *v,
+       enum isl_dim_type type, unsigned first, unsigned n);
+__isl_give isl_val *isl_val_drop_dims(__isl_take isl_val *v,
+       enum isl_dim_type type, unsigned first, unsigned n);
+__isl_give isl_val *isl_val_set_dim_name(__isl_take isl_val *v,
+       enum isl_dim_type type, unsigned pos, const char *s);
+__isl_give isl_val *isl_val_reset_domain_space(__isl_take isl_val *v,
+       __isl_take isl_space *space);
+__isl_give isl_val *isl_val_realign_domain(__isl_take isl_val *v,
+       __isl_take isl_reordering *r);
+__isl_give isl_val *isl_val_zero_on_domain(__isl_take isl_local_space *ls);
+
+int isl_val_check_match_domain_space(__isl_keep isl_val *v,
+       __isl_keep isl_space *space);
+
+#undef BASE
+#define BASE val
+
+#include <isl_multi_templ.h>
+
 #endif