isl_map_union_disjoint: check spaces before handling special cases
[isl.git] / isl_options.c
blobefeb261d1b92c69f961c3523f0054f37a611abb2
1 /*
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 */
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
14 #include <isl/ctx.h>
15 #include <isl_options_private.h>
16 #include <isl/ast_build.h>
17 #include <isl/schedule.h>
18 #include <isl/version.h>
20 struct isl_arg_choice isl_pip_context_choice[] = {
21 {"gbr", ISL_CONTEXT_GBR},
22 {"lexmin", ISL_CONTEXT_LEXMIN},
23 {0}
26 struct isl_arg_choice isl_gbr_choice[] = {
27 {"never", ISL_GBR_NEVER},
28 {"once", ISL_GBR_ONCE},
29 {"always", ISL_GBR_ALWAYS},
30 {0}
33 struct isl_arg_choice isl_closure_choice[] = {
34 {"isl", ISL_CLOSURE_ISL},
35 {"box", ISL_CLOSURE_BOX},
36 {0}
39 static struct isl_arg_choice bound[] = {
40 {"bernstein", ISL_BOUND_BERNSTEIN},
41 {"range", ISL_BOUND_RANGE},
42 {0}
45 static struct isl_arg_choice on_error[] = {
46 {"warn", ISL_ON_ERROR_WARN},
47 {"continue", ISL_ON_ERROR_CONTINUE},
48 {"abort", ISL_ON_ERROR_ABORT},
49 {0}
52 static struct isl_arg_choice isl_schedule_algorithm_choice[] = {
53 {"isl", ISL_SCHEDULE_ALGORITHM_ISL},
54 {"feautrier", ISL_SCHEDULE_ALGORITHM_FEAUTRIER},
55 {0}
58 static struct isl_arg_flags bernstein_recurse[] = {
59 {"none", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS, 0},
60 {"factors", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
61 ISL_BERNSTEIN_FACTORS},
62 {"intervals", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
63 ISL_BERNSTEIN_INTERVALS},
64 {"full", ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS,
65 ISL_BERNSTEIN_FACTORS | ISL_BERNSTEIN_INTERVALS},
66 {0}
69 static struct isl_arg_choice convex[] = {
70 {"wrap", ISL_CONVEX_HULL_WRAP},
71 {"fm", ISL_CONVEX_HULL_FM},
72 {0}
75 static struct isl_arg_choice fuse[] = {
76 {"max", ISL_SCHEDULE_FUSE_MAX},
77 {"min", ISL_SCHEDULE_FUSE_MIN},
78 {0}
81 static struct isl_arg_choice separation_bounds[] = {
82 {"explicit", ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT},
83 {"implicit", ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT},
84 {0}
87 static void print_version(void)
89 printf("%s", isl_version());
92 ISL_ARGS_START(struct isl_options, isl_options_args)
93 ISL_ARG_CHOICE(struct isl_options, context, 0, "context", \
94 isl_pip_context_choice, ISL_CONTEXT_GBR,
95 "how to handle the pip context tableau")
96 ISL_ARG_CHOICE(struct isl_options, gbr, 0, "gbr", \
97 isl_gbr_choice, ISL_GBR_ALWAYS,
98 "how often to use generalized basis reduction")
99 ISL_ARG_CHOICE(struct isl_options, closure, 0, "closure", \
100 isl_closure_choice, ISL_CLOSURE_ISL,
101 "closure operation to use")
102 ISL_ARG_BOOL(struct isl_options, gbr_only_first, 0, "gbr-only-first", 0,
103 "only perform basis reduction in first direction")
104 ISL_ARG_CHOICE(struct isl_options, bound, 0, "bound", bound,
105 ISL_BOUND_BERNSTEIN, "algorithm to use for computing bounds")
106 ISL_ARG_CHOICE(struct isl_options, on_error, 0, "on-error", on_error,
107 ISL_ON_ERROR_WARN, "how to react if an error is detected")
108 ISL_ARG_FLAGS(struct isl_options, bernstein_recurse, 0,
109 "bernstein-recurse", bernstein_recurse, ISL_BERNSTEIN_FACTORS, NULL)
110 ISL_ARG_BOOL(struct isl_options, bernstein_triangulate, 0,
111 "bernstein-triangulate", 1,
112 "triangulate domains during Bernstein expansion")
113 ISL_ARG_BOOL(struct isl_options, pip_symmetry, 0, "pip-symmetry", 1,
114 "detect simple symmetries in PIP input")
115 ISL_ARG_CHOICE(struct isl_options, convex, 0, "convex-hull", \
116 convex, ISL_CONVEX_HULL_WRAP, "convex hull algorithm to use")
117 ISL_ARG_BOOL(struct isl_options, coalesce_bounded_wrapping, 0,
118 "coalesce-bounded-wrapping", 1, "bound wrapping during coalescing")
119 ISL_ARG_INT(struct isl_options, schedule_max_coefficient, 0,
120 "schedule-max-coefficient", "limit", -1, "Only consider schedules "
121 "where the coefficients of the variable and parameter dimensions "
122 "do not exceed <limit>. A value of -1 allows arbitrary coefficients.")
123 ISL_ARG_INT(struct isl_options, schedule_max_constant_term, 0,
124 "schedule-max-constant-term", "limit", -1, "Only consider schedules "
125 "where the coefficients of the constant dimension do not exceed "
126 "<limit>. A value of -1 allows arbitrary coefficients.")
127 ISL_ARG_BOOL(struct isl_options, schedule_parametric, 0,
128 "schedule-parametric", 1, "construct possibly parametric schedules")
129 ISL_ARG_BOOL(struct isl_options, schedule_outer_coincidence, 0,
130 "schedule-outer-coincidence", 0,
131 "try to construct schedules where the outer member of each band "
132 "satisfies the coincidence constraints")
133 ISL_ARG_BOOL(struct isl_options, schedule_maximize_band_depth, 0,
134 "schedule-maximize-band-depth", 0,
135 "maximize the number of scheduling dimensions in a band")
136 ISL_ARG_BOOL(struct isl_options, schedule_split_scaled, 0,
137 "schedule-split-scaled", 1,
138 "split non-tilable bands with scaled schedules")
139 ISL_ARG_BOOL(struct isl_options, schedule_separate_components, 0,
140 "schedule-separate-components", 1,
141 "separate components in dependence graph")
142 ISL_ARG_CHOICE(struct isl_options, schedule_algorithm, 0,
143 "schedule-algorithm", isl_schedule_algorithm_choice,
144 ISL_SCHEDULE_ALGORITHM_ISL, "scheduling algorithm to use")
145 ISL_ARG_CHOICE(struct isl_options, schedule_fuse, 0, "schedule-fuse", fuse,
146 ISL_SCHEDULE_FUSE_MAX, "level of fusion during scheduling")
147 ISL_ARG_BOOL(struct isl_options, tile_scale_tile_loops, 0,
148 "tile-scale-tile-loops", 1, "scale tile loops")
149 ISL_ARG_BOOL(struct isl_options, tile_shift_point_loops, 0,
150 "tile-shift-point-loops", 1, "shift point loops to start at zero")
151 ISL_ARG_STR(struct isl_options, ast_iterator_type, 0,
152 "ast-iterator-type", "type", "int",
153 "type used for iterators during printing of AST")
154 ISL_ARG_BOOL(struct isl_options, ast_build_atomic_upper_bound, 0,
155 "ast-build-atomic-upper-bound", 1, "generate atomic upper bounds")
156 ISL_ARG_BOOL(struct isl_options, ast_build_prefer_pdiv, 0,
157 "ast-build-prefer-pdiv", 1, "prefer pdiv operation over fdiv")
158 ISL_ARG_BOOL(struct isl_options, ast_build_exploit_nested_bounds, 0,
159 "ast-build-exploit-nested-bounds", 1,
160 "simplify conditions based on bounds of nested for loops")
161 ISL_ARG_BOOL(struct isl_options, ast_build_group_coscheduled, 0,
162 "ast-build-group-coscheduled", 0,
163 "keep coscheduled domain elements together")
164 ISL_ARG_CHOICE(struct isl_options, ast_build_separation_bounds, 0,
165 "ast-build-separation-bounds", separation_bounds,
166 ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT,
167 "bounds to use during separation")
168 ISL_ARG_BOOL(struct isl_options, ast_build_scale_strides, 0,
169 "ast-build-scale-strides", 1,
170 "allow iterators of strided loops to be scaled down")
171 ISL_ARG_BOOL(struct isl_options, ast_build_allow_else, 0,
172 "ast-build-allow-else", 1, "generate if statements with else branches")
173 ISL_ARG_BOOL(struct isl_options, ast_build_allow_or, 0,
174 "ast-build-allow-or", 1, "generate if conditions with disjunctions")
175 ISL_ARG_BOOL(struct isl_options, print_stats, 0, "print-stats", 0,
176 "print statistics for every isl_ctx")
177 ISL_ARG_ULONG(struct isl_options, max_operations, 0,
178 "max-operations", 0, "default number of maximal operations per isl_ctx")
179 ISL_ARG_VERSION(print_version)
180 ISL_ARGS_END
182 ISL_ARG_DEF(isl_options, struct isl_options, isl_options_args)
184 ISL_ARG_CTX_DEF(isl_options, struct isl_options, isl_options_args)
186 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
187 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args, bound)
189 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
190 on_error)
191 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
192 on_error)
194 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
195 coalesce_bounded_wrapping)
196 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
197 coalesce_bounded_wrapping)
199 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
200 gbr_only_first)
201 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
202 gbr_only_first)
204 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
205 schedule_max_coefficient)
206 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
207 schedule_max_coefficient)
209 ISL_CTX_SET_INT_DEF(isl_options, struct isl_options, isl_options_args,
210 schedule_max_constant_term)
211 ISL_CTX_GET_INT_DEF(isl_options, struct isl_options, isl_options_args,
212 schedule_max_constant_term)
214 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
215 schedule_maximize_band_depth)
216 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
217 schedule_maximize_band_depth)
219 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
220 schedule_split_scaled)
221 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
222 schedule_split_scaled)
224 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
225 schedule_separate_components)
226 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
227 schedule_separate_components)
229 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
230 schedule_outer_coincidence)
231 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
232 schedule_outer_coincidence)
234 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
235 schedule_algorithm)
236 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
237 schedule_algorithm)
239 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
240 schedule_fuse)
241 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
242 schedule_fuse)
244 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
245 tile_scale_tile_loops)
246 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
247 tile_scale_tile_loops)
249 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
250 tile_shift_point_loops)
251 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
252 tile_shift_point_loops)
254 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
255 ast_build_atomic_upper_bound)
256 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
257 ast_build_atomic_upper_bound)
259 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
260 ast_build_prefer_pdiv)
261 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
262 ast_build_prefer_pdiv)
264 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
265 ast_build_exploit_nested_bounds)
266 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
267 ast_build_exploit_nested_bounds)
269 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
270 ast_build_group_coscheduled)
271 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
272 ast_build_group_coscheduled)
274 ISL_CTX_SET_STR_DEF(isl_options, struct isl_options, isl_options_args,
275 ast_iterator_type)
276 ISL_CTX_GET_STR_DEF(isl_options, struct isl_options, isl_options_args,
277 ast_iterator_type)
279 ISL_CTX_SET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
280 ast_build_separation_bounds)
281 ISL_CTX_GET_CHOICE_DEF(isl_options, struct isl_options, isl_options_args,
282 ast_build_separation_bounds)
284 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
285 ast_build_scale_strides)
286 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
287 ast_build_scale_strides)
289 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
290 ast_build_allow_else)
291 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
292 ast_build_allow_else)
294 ISL_CTX_SET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
295 ast_build_allow_or)
296 ISL_CTX_GET_BOOL_DEF(isl_options, struct isl_options, isl_options_args,
297 ast_build_allow_or)