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
10 #ifndef ISL_CONSTRAINT_H
11 #define ISL_CONSTRAINT_H
13 #include <isl/local_space.h>
14 #include <isl/space.h>
15 #include <isl/aff_type.h>
16 #include <isl/set_type.h>
19 #include <isl/printer.h>
21 #if defined(__cplusplus)
25 struct isl_constraint
;
26 typedef struct isl_constraint isl_constraint
;
28 ISL_DECLARE_LIST(constraint
)
30 isl_ctx
*isl_constraint_get_ctx(__isl_keep isl_constraint
*c
);
32 __isl_give isl_constraint
*isl_equality_alloc(__isl_take isl_local_space
*ls
);
33 __isl_give isl_constraint
*isl_inequality_alloc(__isl_take isl_local_space
*ls
);
35 struct isl_constraint
*isl_constraint_cow(struct isl_constraint
*c
);
36 struct isl_constraint
*isl_constraint_copy(struct isl_constraint
*c
);
37 __isl_null isl_constraint
*isl_constraint_free(__isl_take isl_constraint
*c
);
39 int isl_basic_map_n_constraint(__isl_keep isl_basic_map
*bmap
);
40 int isl_basic_set_n_constraint(__isl_keep isl_basic_set
*bset
);
41 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map
*bmap
,
42 int (*fn
)(__isl_take isl_constraint
*c
, void *user
), void *user
);
43 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set
*bset
,
44 int (*fn
)(__isl_take isl_constraint
*c
, void *user
), void *user
);
45 __isl_give isl_constraint_list
*isl_basic_map_get_constraint_list(
46 __isl_keep isl_basic_map
*bmap
);
47 __isl_give isl_constraint_list
*isl_basic_set_get_constraint_list(
48 __isl_keep isl_basic_set
*bset
);
49 int isl_constraint_is_equal(struct isl_constraint
*constraint1
,
50 struct isl_constraint
*constraint2
);
52 int isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set
*bset
,
53 enum isl_dim_type type
, unsigned pos
,
54 int (*fn
)(__isl_take isl_constraint
*lower
,
55 __isl_take isl_constraint
*upper
,
56 __isl_take isl_basic_set
*bset
, void *user
), void *user
);
58 __isl_give isl_basic_map
*isl_basic_map_add_constraint(
59 __isl_take isl_basic_map
*bmap
, __isl_take isl_constraint
*constraint
);
60 __isl_give isl_basic_set
*isl_basic_set_add_constraint(
61 __isl_take isl_basic_set
*bset
, __isl_take isl_constraint
*constraint
);
62 __isl_give isl_map
*isl_map_add_constraint(__isl_take isl_map
*map
,
63 __isl_take isl_constraint
*constraint
);
64 __isl_give isl_set
*isl_set_add_constraint(__isl_take isl_set
*set
,
65 __isl_take isl_constraint
*constraint
);
67 int isl_basic_map_has_defining_equality(
68 __isl_keep isl_basic_map
*bmap
, enum isl_dim_type type
, int pos
,
69 __isl_give isl_constraint
**c
);
70 int isl_basic_set_has_defining_equality(
71 struct isl_basic_set
*bset
, enum isl_dim_type type
, int pos
,
72 struct isl_constraint
**constraint
);
73 int isl_basic_set_has_defining_inequalities(
74 struct isl_basic_set
*bset
, enum isl_dim_type type
, int pos
,
75 struct isl_constraint
**lower
,
76 struct isl_constraint
**upper
);
78 __isl_give isl_space
*isl_constraint_get_space(
79 __isl_keep isl_constraint
*constraint
);
80 __isl_give isl_local_space
*isl_constraint_get_local_space(
81 __isl_keep isl_constraint
*constraint
);
82 int isl_constraint_dim(struct isl_constraint
*constraint
,
83 enum isl_dim_type type
);
85 int isl_constraint_involves_dims(__isl_keep isl_constraint
*constraint
,
86 enum isl_dim_type type
, unsigned first
, unsigned n
);
88 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint
*constraint
,
89 enum isl_dim_type type
, unsigned pos
);
90 __isl_give isl_val
*isl_constraint_get_constant_val(
91 __isl_keep isl_constraint
*constraint
);
92 __isl_give isl_val
*isl_constraint_get_coefficient_val(
93 __isl_keep isl_constraint
*constraint
, enum isl_dim_type type
, int pos
);
94 __isl_give isl_constraint
*isl_constraint_set_constant_si(
95 __isl_take isl_constraint
*constraint
, int v
);
96 __isl_give isl_constraint
*isl_constraint_set_constant_val(
97 __isl_take isl_constraint
*constraint
, __isl_take isl_val
*v
);
98 __isl_give isl_constraint
*isl_constraint_set_coefficient_si(
99 __isl_take isl_constraint
*constraint
,
100 enum isl_dim_type type
, int pos
, int v
);
101 __isl_give isl_constraint
*isl_constraint_set_coefficient_val(
102 __isl_take isl_constraint
*constraint
,
103 enum isl_dim_type type
, int pos
, __isl_take isl_val
*v
);
105 __isl_give isl_aff
*isl_constraint_get_div(__isl_keep isl_constraint
*constraint
,
108 struct isl_constraint
*isl_constraint_negate(struct isl_constraint
*constraint
);
110 int isl_constraint_is_equality(__isl_keep isl_constraint
*constraint
);
111 int isl_constraint_is_div_constraint(__isl_keep isl_constraint
*constraint
);
113 int isl_constraint_is_lower_bound(__isl_keep isl_constraint
*constraint
,
114 enum isl_dim_type type
, unsigned pos
);
115 int isl_constraint_is_upper_bound(__isl_keep isl_constraint
*constraint
,
116 enum isl_dim_type type
, unsigned pos
);
118 __isl_give isl_basic_map
*isl_basic_map_from_constraint(
119 __isl_take isl_constraint
*constraint
);
120 struct isl_basic_set
*isl_basic_set_from_constraint(
121 struct isl_constraint
*constraint
);
123 __isl_give isl_aff
*isl_constraint_get_bound(
124 __isl_keep isl_constraint
*constraint
, enum isl_dim_type type
, int pos
);
125 __isl_give isl_aff
*isl_constraint_get_aff(
126 __isl_keep isl_constraint
*constraint
);
127 __isl_give isl_constraint
*isl_equality_from_aff(__isl_take isl_aff
*aff
);
128 __isl_give isl_constraint
*isl_inequality_from_aff(__isl_take isl_aff
*aff
);
130 __isl_give isl_basic_set
*isl_basic_set_drop_constraint(
131 __isl_take isl_basic_set
*bset
, __isl_take isl_constraint
*constraint
);
133 int isl_constraint_plain_cmp(__isl_keep isl_constraint
*c1
,
134 __isl_keep isl_constraint
*c2
);
135 int isl_constraint_cmp_last_non_zero(__isl_keep isl_constraint
*c1
,
136 __isl_keep isl_constraint
*c2
);
138 __isl_give isl_printer
*isl_printer_print_constraint(__isl_take isl_printer
*p
,
139 __isl_keep isl_constraint
*c
);
140 void isl_constraint_dump(__isl_keep isl_constraint
*c
);
142 #if defined(__cplusplus)