Merge branch 'maint'
[platform/upstream/isl.git] / isl_options.c
1 /*
2  * Copyright 2008-2009 Katholieke Universiteit Leuven
3  *
4  * Use of this software is governed by the GNU LGPLv2.1 license
5  *
6  * Written by Sven Verdoolaege, K.U.Leuven, Departement
7  * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8  */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14 #include <isl/ctx.h>
15 #include <isl/options.h>
16 #include <isl/version.h>
17
18 struct isl_arg_choice isl_lp_solver_choice[] = {
19         {"tab",         ISL_LP_TAB},
20 #ifdef ISL_PIPLIB
21         {"pip",         ISL_LP_PIP},
22 #endif
23         {0}
24 };
25
26 struct isl_arg_choice isl_ilp_solver_choice[] = {
27         {"gbr",         ISL_ILP_GBR},
28 #ifdef ISL_PIPLIB
29         {"pip",         ISL_ILP_PIP},
30 #endif
31         {0}
32 };
33
34 struct isl_arg_choice isl_pip_solver_choice[] = {
35         {"tab",         ISL_PIP_TAB},
36 #ifdef ISL_PIPLIB
37         {"pip",         ISL_PIP_PIP},
38 #endif
39         {0}
40 };
41
42 struct isl_arg_choice isl_pip_context_choice[] = {
43         {"gbr",         ISL_CONTEXT_GBR},
44         {"lexmin",      ISL_CONTEXT_LEXMIN},
45         {0}
46 };
47
48 struct isl_arg_choice isl_gbr_choice[] = {
49         {"never",       ISL_GBR_NEVER},
50         {"once",        ISL_GBR_ONCE},
51         {"always",      ISL_GBR_ALWAYS},
52         {0}
53 };
54
55 struct isl_arg_choice isl_closure_choice[] = {
56         {"isl",         ISL_CLOSURE_ISL},
57         {"box",         ISL_CLOSURE_BOX},
58         {0}
59 };
60
61 static struct isl_arg_choice bound[] = {
62         {"bernstein",   ISL_BOUND_BERNSTEIN},
63         {"range",       ISL_BOUND_RANGE},
64         {0}
65 };
66
67 static struct isl_arg_flags bernstein_recurse[] = {
68         {"none",        ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS, 0},
69         {"factors",     ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
70                         ISL_BERNSTEIN_FACTORS},
71         {"intervals",   ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
72                         ISL_BERNSTEIN_INTERVALS},
73         {"full",        ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
74                         ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS},
75         {0}
76 };
77
78 static struct isl_arg_choice convex[] = {
79         {"wrap",        ISL_CONVEX_HULL_WRAP},
80         {"fm",          ISL_CONVEX_HULL_FM},
81         {0}
82 };
83
84 static void print_version(void)
85 {
86         printf("%s", isl_version());
87 }
88
89 struct isl_arg isl_options_arg[] = {
90 ISL_ARG_CHOICE(struct isl_options, lp_solver, 0, "lp-solver", \
91         isl_lp_solver_choice,   ISL_LP_TAB, "lp solver to use")
92 ISL_ARG_CHOICE(struct isl_options, ilp_solver, 0, "ilp-solver", \
93         isl_ilp_solver_choice,  ISL_ILP_GBR, "ilp solver to use")
94 ISL_ARG_CHOICE(struct isl_options, pip, 0, "pip", \
95         isl_pip_solver_choice,  ISL_PIP_TAB, "pip solver to use")
96 ISL_ARG_CHOICE(struct isl_options, context, 0, "context", \
97         isl_pip_context_choice, ISL_CONTEXT_GBR,
98         "how to handle the pip context tableau")
99 ISL_ARG_CHOICE(struct isl_options, gbr, 0, "gbr", \
100         isl_gbr_choice, ISL_GBR_ONCE,
101         "how often to use generalized basis reduction")
102 ISL_ARG_CHOICE(struct isl_options, closure, 0, "closure", \
103         isl_closure_choice,     ISL_CLOSURE_ISL,
104         "closure operation to use")
105 ISL_ARG_BOOL(struct isl_options, gbr_only_first, 0, "gbr-only-first", 0,
106         "only perform basis reduction in first direction")
107 ISL_ARG_CHOICE(struct isl_options, bound, 0, "bound", bound,
108         ISL_BOUND_BERNSTEIN, "algorithm to use for computing bounds")
109 ISL_ARG_FLAGS(struct isl_options, bernstein_recurse, 0,
110         "bernstein-recurse", bernstein_recurse, ISL_BERNSTEIN_FACTORS, NULL)
111 ISL_ARG_BOOL(struct isl_options, bernstein_triangulate, 0,
112         "bernstein-triangulate", 1,
113         "triangulate domains during Bernstein expansion")
114 ISL_ARG_BOOL(struct isl_options, pip_symmetry, 0, "pip-symmetry", 1,
115         "detect simple symmetries in PIP input")
116 ISL_ARG_CHOICE(struct isl_options, convex, 0, "convex-hull", \
117         convex, ISL_CONVEX_HULL_WRAP, "convex hull algorithm to use")
118 ISL_ARG_BOOL(struct isl_options, schedule_parametric, 0,
119         "schedule-parametric", 1, "construct possibly parametric schedules")
120 ISL_ARG_BOOL(struct isl_options, schedule_outer_zero_distance, 0,
121         "schedule-outer-zero-distance", 0,
122         "try to construct schedules with outer zero distances over "
123         "proximity dependences")
124 ISL_ARG_BOOL(struct isl_options, schedule_split_parallel, 0,
125         "schedule-split-parallel", 1,
126         "split non-tilable bands with parallel schedules")
127 ISL_ARG_VERSION(print_version)
128 ISL_ARG_END
129 };
130
131 ISL_ARG_DEF(isl_options, struct isl_options, isl_options_arg)