link against isl libraries first
[pet.git] / options.c
blob39525ade2b819aa3a9894583ce95dd8ceda41751
1 /*
2 * Copyright 2011 Leiden University. All rights reserved.
3 * Copyright 2013-2014 Ecole Normale Superieure. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY LEIDEN UNIVERSITY ''AS IS'' AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LEIDEN UNIVERSITY OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * The views and conclusions contained in the software and documentation
30 * are those of the authors and should not be interpreted as
31 * representing official policies, either expressed or implied, of
32 * Leiden University.
33 */
35 #include <pet.h>
36 #include "options.h"
37 #include "version.h"
39 struct isl_arg_choice pet_signed_overflow[] = {
40 {"avoid", PET_OVERFLOW_AVOID},
41 {"ignore", PET_OVERFLOW_IGNORE},
42 {0}
45 ISL_ARGS_START(struct pet_options, pet_options_args)
46 ISL_ARG_BOOL(struct pet_options, autodetect, 0, "autodetect", 0, NULL)
47 ISL_ARG_BOOL(struct pet_options, detect_conditional_assignment,
48 0, "detect-conditional-assignment", 1, NULL)
49 ISL_ARG_BOOL(struct pet_options, encapsulate_dynamic_control,
50 0, "encapsulate-dynamic-control", 0,
51 "encapsulate all dynamic control in macro statements")
52 ISL_ARG_BOOL(struct pet_options, pencil, 0, "pencil", 1,
53 "support pencil builtins and pragmas")
54 ISL_ARG_CHOICE(struct pet_options, signed_overflow, 0,
55 "signed-overflow", pet_signed_overflow, PET_OVERFLOW_AVOID,
56 "how to handle signed overflows")
57 ISL_ARG_STR_LIST(struct pet_options, n_path, paths, 'I', "include-path",
58 "path", NULL)
59 ISL_ARG_STR_LIST(struct pet_options, n_define, defines, 'D', NULL,
60 "macro[=defn]", NULL)
61 ISL_ARG_VERSION(&pet_print_version)
62 ISL_ARGS_END
64 ISL_ARG_DEF(pet_options, struct pet_options, pet_options_args)
65 ISL_ARG_CTX_DEF(pet_options, struct pet_options, pet_options_args)
67 ISL_CTX_SET_BOOL_DEF(pet_options, struct pet_options, pet_options_args,
68 autodetect)
69 ISL_CTX_GET_BOOL_DEF(pet_options, struct pet_options, pet_options_args,
70 autodetect)
72 ISL_CTX_SET_BOOL_DEF(pet_options, struct pet_options, pet_options_args,
73 detect_conditional_assignment)
74 ISL_CTX_GET_BOOL_DEF(pet_options, struct pet_options, pet_options_args,
75 detect_conditional_assignment)
77 ISL_CTX_SET_BOOL_DEF(pet_options, struct pet_options, pet_options_args,
78 encapsulate_dynamic_control)
79 ISL_CTX_GET_BOOL_DEF(pet_options, struct pet_options, pet_options_args,
80 encapsulate_dynamic_control)
82 ISL_CTX_SET_CHOICE_DEF(pet_options, struct pet_options, pet_options_args,
83 signed_overflow)
84 ISL_CTX_GET_CHOICE_DEF(pet_options, struct pet_options, pet_options_args,
85 signed_overflow)
87 /* Create an isl_ctx that references the pet options.
89 isl_ctx *isl_ctx_alloc_with_pet_options()
91 struct pet_options *options;
93 options = pet_options_new_with_defaults();
94 return isl_ctx_alloc_with_options(&pet_options_args, options);