hide isl_options structure
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 11 Nov 2011 10:32:49 +0000 (11:32 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 13 Nov 2011 17:18:45 +0000 (18:18 +0100)
We also add some getters and setters for options that are known to
be used from outside of isl.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
23 files changed:
Makefile.am
basis_reduction_templ.c
bound.c
cat.c
closure.c
doc/user.pod
include/isl/ctx.h
include/isl/options.h
include/isl/schedule.h
isl_bernstein.c
isl_bound.c
isl_convex_hull.c
isl_ctx.c
isl_lp.c
isl_map.c
isl_options.c
isl_options_private.h [new file with mode: 0644]
isl_sample.c
isl_schedule.c
isl_tab_pip.c
isl_test.c
isl_transitive_closure.c
pip.c

index 6575477..5a8d307 100644 (file)
@@ -92,6 +92,7 @@ libisl_la_SOURCES = \
        isl_id_private.h \
        isl_obj.c \
        isl_options.c \
+       isl_options_private.h \
        isl_output.c \
        isl_qsort.c \
        isl_qsort.h \
index 2e4034f..f4c50ed 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <isl_ctx_private.h>
 #include <isl_map_private.h>
+#include <isl_options_private.h>
 #include "isl_basis_reduction.h"
 
 static void save_alpha(GBR_LP *lp, int first, int n, GBR_type *alpha)
diff --git a/bound.c b/bound.c
index 3c1cbea..a0772b7 100644 (file)
--- a/bound.c
+++ b/bound.c
@@ -2,6 +2,7 @@
 #include <isl/stream.h>
 #include <isl_polynomial_private.h>
 #include <isl_scan.h>
+#include <isl/options.h>
 
 struct bound_options {
        struct isl_options      *isl;
diff --git a/cat.c b/cat.c
index fea6228..6313142 100644 (file)
--- a/cat.c
+++ b/cat.c
@@ -2,6 +2,7 @@
 #include <isl/obj.h>
 #include <isl/printer.h>
 #include <isl/stream.h>
+#include <isl/options.h>
 
 struct isl_arg_choice cat_format[] = {
        {"isl",         ISL_FORMAT_ISL},
index fc50a78..a0faa15 100644 (file)
--- a/closure.c
+++ b/closure.c
@@ -1,5 +1,6 @@
 #include <assert.h>
 #include <isl/map.h>
+#include <isl/options.h>
 
 int main(int argc, char **argv)
 {
index ca66e19..82643c1 100644 (file)
@@ -4065,6 +4065,25 @@ A representation of the band can be printed using
                __isl_take isl_printer *p,
                __isl_keep isl_band *band);
 
+=head3 Options
+
+       #include <isl/schedule.h>
+       int isl_options_set_schedule_outer_zero_distance(
+               isl_ctx *ctx, int val);
+       int isl_options_get_schedule_outer_zero_distance(
+               isl_ctx *ctx);
+
+=over
+
+=item * schedule_outer_zero_distance
+
+It this option is set, then we try to construct schedules
+where the outermost scheduling dimension in each band
+results in a zero dependence distance over the proximity
+dependences.
+
+=back
+
 =head2 Parametric Vertex Enumeration
 
 The parametric vertex enumeration described in this section
index 3ddc451..43e0fc6 100644 (file)
@@ -14,8 +14,8 @@
 #include <stdlib.h>
 
 #include <isl/int.h>
-#include <isl/options.h>
 #include <isl/blk.h>
+#include <isl/arg.h>
 #include <isl/hash.h>
 #include <isl/config.h>
 
@@ -161,6 +161,56 @@ st *isl_ctx_peek_ ## prefix(isl_ctx *ctx)                          \
        return (st *)isl_ctx_peek_options(ctx, &(args));                \
 }
 
+#define ISL_CTX_GET_BOOL_DEF(prefix,st,args,field)                     \
+int prefix ## _get_ ## field(isl_ctx *ctx)                             \
+{                                                                      \
+       st *options;                                                    \
+       options = isl_ctx_peek_ ## prefix(ctx);                         \
+       if (!options)                                                   \
+               isl_die(ctx, isl_error_invalid,                         \
+                       "isl_ctx does not reference " #prefix,          \
+                       return -1);                                     \
+       return options->field;                                          \
+}
+
+#define ISL_CTX_SET_BOOL_DEF(prefix,st,args,field)                     \
+int prefix ## _set_ ## field(isl_ctx *ctx, int val)                    \
+{                                                                      \
+       st *options;                                                    \
+       options = isl_ctx_peek_ ## prefix(ctx);                         \
+       if (!options)                                                   \
+               isl_die(ctx, isl_error_invalid,                         \
+                       "isl_ctx does not reference " #prefix,          \
+                       return -1);                                     \
+       options->field = val;                                           \
+       return 0;                                                       \
+}
+
+#define ISL_CTX_GET_CHOICE_DEF(prefix,st,args,field)                   \
+int prefix ## _get_ ## field(isl_ctx *ctx)                             \
+{                                                                      \
+       st *options;                                                    \
+       options = isl_ctx_peek_ ## prefix(ctx);                         \
+       if (!options)                                                   \
+               isl_die(ctx, isl_error_invalid,                         \
+                       "isl_ctx does not reference " #prefix,          \
+                       return -1);                                     \
+       return options->field;                                          \
+}
+
+#define ISL_CTX_SET_CHOICE_DEF(prefix,st,args,field)                   \
+int prefix ## _set_ ## field(isl_ctx *ctx, int val)                    \
+{                                                                      \
+       st *options;                                                    \
+       options = isl_ctx_peek_ ## prefix(ctx);                         \
+       if (!options)                                                   \
+               isl_die(ctx, isl_error_invalid,                         \
+                       "isl_ctx does not reference " #prefix,          \
+                       return -1);                                     \
+       options->field = val;                                           \
+       return 0;                                                       \
+}
+
 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
 void isl_ctx_reset_error(isl_ctx *ctx);
 void isl_ctx_set_error(isl_ctx *ctx, enum isl_error error);
index 8ef0f7f..41616ad 100644 (file)
 #define ISL_OPTIONS_H
 
 #include <isl/arg.h>
+#include <isl/ctx.h>
 
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-struct isl_options {
-       #define                 ISL_LP_TAB      0
-       #define                 ISL_LP_PIP      1
-       unsigned                lp_solver;
+struct isl_options;
 
-       #define                 ISL_ILP_GBR     0
-       #define                 ISL_ILP_PIP     1
-       unsigned                ilp_solver;
-
-       #define                 ISL_PIP_TAB     0
-       #define                 ISL_PIP_PIP     1
-       unsigned                pip;
-
-       #define                 ISL_CONTEXT_GBR         0
-       #define                 ISL_CONTEXT_LEXMIN      1
-       unsigned                context;
-
-       #define                 ISL_GBR_NEVER   0
-       #define                 ISL_GBR_ONCE    1
-       #define                 ISL_GBR_ALWAYS  2
-       unsigned                gbr;
-       unsigned                gbr_only_first;
-
-       #define                 ISL_CLOSURE_ISL         0
-       #define                 ISL_CLOSURE_BOX         1
-       unsigned                closure;
-
-       #define                 ISL_BOUND_BERNSTEIN     0
-       #define                 ISL_BOUND_RANGE         1
-       int                     bound;
-
-       #define                 ISL_BERNSTEIN_FACTORS   1
-       #define                 ISL_BERNSTEIN_INTERVALS 2
-       int                     bernstein_recurse;
-
-       int                     bernstein_triangulate;
-
-       int                     pip_symmetry;
-
-       #define                 ISL_CONVEX_HULL_WRAP    0
-       #define                 ISL_CONVEX_HULL_FM      1
-       int                     convex;
+ISL_ARG_DECL(isl_options, struct isl_options, isl_options_args)
 
-       int                     schedule_parametric;
-       int                     schedule_outer_zero_distance;
-       int                     schedule_maximize_band_depth;
-       int                     schedule_split_parallel;
-};
+#define                        ISL_BOUND_BERNSTEIN     0
+#define                        ISL_BOUND_RANGE         1
+int isl_options_set_bound(isl_ctx *ctx, int val);
+int isl_options_get_bound(isl_ctx *ctx);
 
-ISL_ARG_DECL(isl_options, struct isl_options, isl_options_args)
+int isl_options_set_gbr_only_first(isl_ctx *ctx, int val);
+int isl_options_get_gbr_only_first(isl_ctx *ctx);
 
 #if defined(__cplusplus)
 }
index 20cb40b..bbac080 100644 (file)
@@ -12,6 +12,9 @@ extern "C" {
 struct isl_schedule;
 typedef struct isl_schedule isl_schedule;
 
+int isl_options_set_schedule_outer_zero_distance(isl_ctx *ctx, int val);
+int isl_options_get_schedule_outer_zero_distance(isl_ctx *ctx);
+
 __isl_give isl_schedule *isl_union_set_compute_schedule(
        __isl_take isl_union_set *domain,
        __isl_take isl_union_map *validity,
index 43045fa..0e528e5 100644 (file)
@@ -21,6 +21,7 @@
 #include <isl_factorization.h>
 #include <isl_vertices_private.h>
 #include <isl_polynomial_private.h>
+#include <isl_options_private.h>
 #include <isl_bernstein.h>
 
 struct bernstein_data {
index a2fd067..d9c10bc 100644 (file)
@@ -14,6 +14,7 @@
 #include <isl_bernstein.h>
 #include <isl_range.h>
 #include <isl_polynomial_private.h>
+#include <isl_options_private.h>
 
 /* Compute a bound on the polynomial defined over the parametric polytope
  * using either range propagation or bernstein expansion and
index 20c0e2f..a6e26b8 100644 (file)
@@ -14,6 +14,7 @@
 #include <isl_mat_private.h>
 #include <isl/set.h>
 #include <isl/seq.h>
+#include <isl_options_private.h>
 #include "isl_equalities.h"
 #include "isl_tab.h"
 
index 14910b8..bea6efb 100644 (file)
--- a/isl_ctx.c
+++ b/isl_ctx.c
@@ -9,6 +9,7 @@
 
 #include <isl_ctx_private.h>
 #include <isl/vec.h>
+#include <isl/options.h>
 
 static struct isl_options *find_nested_options(struct isl_args *args,
        void *opt, struct isl_args *wanted)
index 7ad0939..d2e35a5 100644 (file)
--- a/isl_lp.c
+++ b/isl_lp.c
@@ -13,6 +13,7 @@
 #include "isl_lp_piplib.h"
 #include <isl/seq.h>
 #include "isl_tab.h"
+#include <isl_options_private.h>
 
 enum isl_lp_result isl_tab_solve_lp(struct isl_basic_map *bmap, int maximize,
                                      isl_int *f, isl_int denom, isl_int *opt,
index 69a41d6..3eaba90 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -30,6 +30,7 @@
 #include <isl_dim_map.h>
 #include <isl_local_space_private.h>
 #include <isl_aff_private.h>
+#include <isl_options_private.h>
 
 static unsigned n(__isl_keep isl_space *dim, enum isl_dim_type type)
 {
index 520a875..9ea5829 100644 (file)
@@ -12,7 +12,7 @@
 #include <string.h>
 
 #include <isl/ctx.h>
-#include <isl/options.h>
+#include <isl_options_private.h>
 #include <isl/version.h>
 
 struct isl_arg_choice isl_lp_solver_choice[] = {
@@ -131,3 +131,18 @@ ISL_ARG_VERSION(print_version)
 ISL_ARGS_END
 
 ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
+
+ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
+
+ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
+ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
+
+ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
+       gbr_only_first)
+ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
+       gbr_only_first)
+
+ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
+       schedule_outer_zero_distance)
+ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
+       schedule_outer_zero_distance)
diff --git a/isl_options_private.h b/isl_options_private.h
new file mode 100644 (file)
index 0000000..0c9137c
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef ISL_OPTIONS_PRIVATE_H
+#define ISL_OPTIONS_PRIVATE_H
+
+#include <isl/options.h>
+
+struct isl_options {
+       #define                 ISL_LP_TAB      0
+       #define                 ISL_LP_PIP      1
+       unsigned                lp_solver;
+
+       #define                 ISL_ILP_GBR     0
+       #define                 ISL_ILP_PIP     1
+       unsigned                ilp_solver;
+
+       #define                 ISL_PIP_TAB     0
+       #define                 ISL_PIP_PIP     1
+       unsigned                pip;
+
+       #define                 ISL_CONTEXT_GBR         0
+       #define                 ISL_CONTEXT_LEXMIN      1
+       unsigned                context;
+
+       #define                 ISL_GBR_NEVER   0
+       #define                 ISL_GBR_ONCE    1
+       #define                 ISL_GBR_ALWAYS  2
+       unsigned                gbr;
+       unsigned                gbr_only_first;
+
+       #define                 ISL_CLOSURE_ISL         0
+       #define                 ISL_CLOSURE_BOX         1
+       unsigned                closure;
+
+       int                     bound;
+
+       #define                 ISL_BERNSTEIN_FACTORS   1
+       #define                 ISL_BERNSTEIN_INTERVALS 2
+       int                     bernstein_recurse;
+
+       int                     bernstein_triangulate;
+
+       int                     pip_symmetry;
+
+       #define                 ISL_CONVEX_HULL_WRAP    0
+       #define                 ISL_CONVEX_HULL_FM      1
+       int                     convex;
+
+       int                     schedule_parametric;
+       int                     schedule_outer_zero_distance;
+       int                     schedule_maximize_band_depth;
+       int                     schedule_split_parallel;
+};
+
+#endif
index c83fe57..ec63745 100644 (file)
@@ -19,6 +19,7 @@
 #include "isl_basis_reduction.h"
 #include <isl_factorization.h>
 #include <isl_point_private.h>
+#include <isl_options_private.h>
 
 static struct isl_vec *empty_sample(struct isl_basic_set *bset)
 {
index b279281..cc8da96 100644 (file)
@@ -24,6 +24,7 @@
 #include <isl_schedule_private.h>
 #include <isl_band_private.h>
 #include <isl_list_private.h>
+#include <isl_options_private.h>
 
 /*
  * The scheduling algorithm implemented in this file was inspired by
index 4d33b3b..9759dcf 100644 (file)
@@ -17,6 +17,7 @@
 #include "isl_sample.h"
 #include <isl_mat_private.h>
 #include <isl_aff_private.h>
+#include <isl_options_private.h>
 #include <isl_config.h>
 
 /*
index eb8b151..ce28f67 100644 (file)
@@ -20,6 +20,7 @@
 #include <isl/union_map.h>
 #include <isl_factorization.h>
 #include <isl/schedule.h>
+#include <isl_options_private.h>
 
 static char *srcdir;
 
index ef3e591..20e020e 100644 (file)
@@ -16,6 +16,7 @@
 #include <isl/lp.h>
 #include <isl/union_map.h>
 #include <isl_mat_private.h>
+#include <isl_options_private.h>
 
 int isl_map_is_transitively_closed(__isl_keep isl_map *map)
 {
diff --git a/pip.c b/pip.c
index 2770d1b..2baf9e2 100644 (file)
--- a/pip.c
+++ b/pip.c
@@ -20,6 +20,7 @@
 #include <isl/ilp.h>
 #include <isl/printer.h>
 #include <isl_point_private.h>
+#include <isl/options.h>
 
 /* The input of this program is the same as that of the "example" program
  * from the PipLib distribution, except that the "big parameter column"