and isl_pw_aff_tdiv_q and isl_pw_aff_tdiv_r
[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 MIT 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_private.h>
16 #include <isl/schedule.h>
17 #include <isl/version.h>
18
19 struct isl_arg_choice isl_lp_solver_choice[] = {
20         {"tab",         ISL_LP_TAB},
21 #ifdef ISL_PIPLIB
22         {"pip",         ISL_LP_PIP},
23 #endif
24         {0}
25 };
26
27 struct isl_arg_choice isl_ilp_solver_choice[] = {
28         {"gbr",         ISL_ILP_GBR},
29 #ifdef ISL_PIPLIB
30         {"pip",         ISL_ILP_PIP},
31 #endif
32         {0}
33 };
34
35 struct isl_arg_choice isl_pip_solver_choice[] = {
36         {"tab",         ISL_PIP_TAB},
37 #ifdef ISL_PIPLIB
38         {"pip",         ISL_PIP_PIP},
39 #endif
40         {0}
41 };
42
43 struct isl_arg_choice isl_pip_context_choice[] = {
44         {"gbr",         ISL_CONTEXT_GBR},
45         {"lexmin",      ISL_CONTEXT_LEXMIN},
46         {0}
47 };
48
49 struct isl_arg_choice isl_gbr_choice[] = {
50         {"never",       ISL_GBR_NEVER},
51         {"once",        ISL_GBR_ONCE},
52         {"always",      ISL_GBR_ALWAYS},
53         {0}
54 };
55
56 struct isl_arg_choice isl_closure_choice[] = {
57         {"isl",         ISL_CLOSURE_ISL},
58         {"box",         ISL_CLOSURE_BOX},
59         {0}
60 };
61
62 static struct isl_arg_choice bound[] = {
63         {"bernstein",   ISL_BOUND_BERNSTEIN},
64         {"range",       ISL_BOUND_RANGE},
65         {0}
66 };
67
68 static struct isl_arg_choice on_error[] = {
69         {"warn",        ISL_ON_ERROR_WARN},
70         {"continue",    ISL_ON_ERROR_CONTINUE},
71         {"abort",       ISL_ON_ERROR_ABORT},
72         {0}
73 };
74
75 static struct isl_arg_choice isl_schedule_algorithm_choice[] = {
76         {"isl",         ISL_SCHEDULE_ALGORITHM_ISL},
77         {"feautrier",   ISL_SCHEDULE_ALGORITHM_FEAUTRIER},
78         {0}
79 };
80
81 static struct isl_arg_flags bernstein_recurse[] = {
82         {"none",        ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS, 0},
83         {"factors",     ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
84                         ISL_BERNSTEIN_FACTORS},
85         {"intervals",   ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
86                         ISL_BERNSTEIN_INTERVALS},
87         {"full",        ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
88                         ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS},
89         {0}
90 };
91
92 static struct isl_arg_choice convex[] = {
93         {"wrap",        ISL_CONVEX_HULL_WRAP},
94         {"fm",          ISL_CONVEX_HULL_FM},
95         {0}
96 };
97
98 static struct isl_arg_choice fuse[] = {
99         {"max",         ISL_SCHEDULE_FUSE_MAX},
100         {"min",         ISL_SCHEDULE_FUSE_MIN},
101         {0}
102 };
103
104 static void print_version(void)
105 {
106         printf("%s", isl_version());
107 }
108
109 ISL_ARGS_START(struct isl_options, isl_options_args)
110 ISL_ARG_CHOICE(struct isl_options, lp_solver, 0, "lp-solver", \
111         isl_lp_solver_choice,   ISL_LP_TAB, "lp solver to use")
112 ISL_ARG_CHOICE(struct isl_options, ilp_solver, 0, "ilp-solver", \
113         isl_ilp_solver_choice,  ISL_ILP_GBR, "ilp solver to use")
114 ISL_ARG_CHOICE(struct isl_options, pip, 0, "pip", \
115         isl_pip_solver_choice,  ISL_PIP_TAB, "pip solver to use")
116 ISL_ARG_CHOICE(struct isl_options, context, 0, "context", \
117         isl_pip_context_choice, ISL_CONTEXT_GBR,
118         "how to handle the pip context tableau")
119 ISL_ARG_CHOICE(struct isl_options, gbr, 0, "gbr", \
120         isl_gbr_choice, ISL_GBR_ALWAYS,
121         "how often to use generalized basis reduction")
122 ISL_ARG_CHOICE(struct isl_options, closure, 0, "closure", \
123         isl_closure_choice,     ISL_CLOSURE_ISL,
124         "closure operation to use")
125 ISL_ARG_BOOL(struct isl_options, gbr_only_first, 0, "gbr-only-first", 0,
126         "only perform basis reduction in first direction")
127 ISL_ARG_CHOICE(struct isl_options, bound, 0, "bound", bound,
128         ISL_BOUND_BERNSTEIN, "algorithm to use for computing bounds")
129 ISL_ARG_CHOICE(struct isl_options, on_error, 0, "on-error", on_error,
130         ISL_ON_ERROR_WARN, "how to react if an error is detected")
131 ISL_ARG_FLAGS(struct isl_options, bernstein_recurse, 0,
132         "bernstein-recurse", bernstein_recurse, ISL_BERNSTEIN_FACTORS, NULL)
133 ISL_ARG_BOOL(struct isl_options, bernstein_triangulate, 0,
134         "bernstein-triangulate", 1,
135         "triangulate domains during Bernstein expansion")
136 ISL_ARG_BOOL(struct isl_options, pip_symmetry, 0, "pip-symmetry", 1,
137         "detect simple symmetries in PIP input")
138 ISL_ARG_CHOICE(struct isl_options, convex, 0, "convex-hull", \
139         convex, ISL_CONVEX_HULL_WRAP, "convex hull algorithm to use")
140 ISL_ARG_BOOL(struct isl_options, coalesce_bounded_wrapping, 0,
141         "coalesce-bounded-wrapping", 1, "bound wrapping during coalescing")
142 ISL_ARG_INT(struct isl_options, schedule_max_coefficient, 0,
143         "schedule-max-coefficient", "limit", -1, "Only consider schedules "
144         "where the coefficients of the variable and parameter dimensions "
145         "do not exceed <limit>. A value of -1 allows arbitrary coefficients.")
146 ISL_ARG_INT(struct isl_options, schedule_max_constant_term, 0,
147         "schedule-max-constant-term", "limit", -1, "Only consider schedules "
148         "where the coefficients of the constant dimension do not exceed "
149         "<limit>. A value of -1 allows arbitrary coefficients.")
150 ISL_ARG_BOOL(struct isl_options, schedule_parametric, 0,
151         "schedule-parametric", 1, "construct possibly parametric schedules")
152 ISL_ARG_BOOL(struct isl_options, schedule_outer_zero_distance, 0,
153         "schedule-outer-zero-distance", 0,
154         "try to construct schedules with outer zero distances over "
155         "proximity dependences")
156 ISL_ARG_BOOL(struct isl_options, schedule_maximize_band_depth, 0,
157         "schedule-maximize-band-depth", 0,
158         "maximize the number of scheduling dimensions in a band")
159 ISL_ARG_BOOL(struct isl_options, schedule_split_scaled, 0,
160         "schedule-split-scaled", 1,
161         "split non-tilable bands with scaled schedules")
162 ISL_ARG_BOOL(struct isl_options, schedule_separate_components, 0,
163         "schedule-separate-components", 1,
164         "separate components in dependence graph")
165 ISL_ARG_CHOICE(struct isl_options, schedule_algorithm, 0,
166         "schedule-algorithm", isl_schedule_algorithm_choice,
167         ISL_SCHEDULE_ALGORITHM_ISL, "scheduling algorithm to use")
168 ISL_ARG_CHOICE(struct isl_options, schedule_fuse, 0, "schedule-fuse", fuse,
169         ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling")
170 ISL_ARG_BOOL(struct isl_options, tile_scale_tile_loops, 0,
171         "tile-scale-tile-loops", 1, "scale tile loops")
172 ISL_ARG_VERSION(print_version)
173 ISL_ARGS_END
174
175 ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
176
177 ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
178
179 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
180 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
181
182 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
183         on_error)
184 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
185         on_error)
186
187 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
188         coalesce_bounded_wrapping)
189 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
190         coalesce_bounded_wrapping)
191
192 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
193         gbr_only_first)
194 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
195         gbr_only_first)
196
197 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
198         schedule_max_coefficient)
199 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
200         schedule_max_coefficient)
201
202 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
203         schedule_max_constant_term)
204 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
205         schedule_max_constant_term)
206
207 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
208         schedule_maximize_band_depth)
209 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
210         schedule_maximize_band_depth)
211
212 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
213         schedule_split_scaled)
214 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
215         schedule_split_scaled)
216
217 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
218         schedule_separate_components)
219 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
220         schedule_separate_components)
221
222 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
223         schedule_outer_zero_distance)
224 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
225         schedule_outer_zero_distance)
226
227 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
228         schedule_algorithm)
229 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
230         schedule_algorithm)
231
232 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
233         schedule_fuse)
234 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
235         schedule_fuse)
236
237 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
238         tile_scale_tile_loops)
239 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
240         tile_scale_tile_loops)