isl_qpolynomial_move_dims: plug memory leak and fix reordering of divs
[isl.git] / include / isl_constraint.h
blobb7322430c204f66edf0246e4335e5b169f02f4ed
1 /*
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 */
10 #ifndef ISL_CONSTRAINT_H
11 #define ISL_CONSTRAINT_H
13 #include "isl_div.h"
14 #include "isl_set.h"
16 #if defined(__cplusplus)
17 extern "C" {
18 #endif
20 struct isl_constraint {
21 int ref;
22 struct isl_ctx *ctx;
24 struct isl_basic_map *bmap;
25 isl_int **line;
27 typedef struct isl_constraint isl_constraint;
29 __isl_give isl_constraint *isl_equality_alloc(__isl_take isl_dim *dim);
30 __isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_dim *dim);
31 struct isl_constraint *isl_basic_set_constraint(struct isl_basic_set *bset,
32 isl_int **line);
34 struct isl_constraint *isl_constraint_cow(struct isl_constraint *c);
35 struct isl_constraint *isl_constraint_copy(struct isl_constraint *c);
36 void isl_constraint_free(struct isl_constraint *c);
38 __isl_give isl_constraint *isl_basic_map_first_constraint(
39 __isl_take isl_basic_map *bmap);
40 __isl_give isl_constraint *isl_basic_set_first_constraint(
41 __isl_take isl_basic_set *bset);
42 struct isl_constraint *isl_constraint_next(struct isl_constraint *c);
43 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
44 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
45 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
46 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
47 int isl_constraint_is_equal(struct isl_constraint *constraint1,
48 struct isl_constraint *constraint2);
50 int isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set *bset,
51 enum isl_dim_type type, unsigned pos,
52 int (*fn)(__isl_take isl_constraint *lower,
53 __isl_take isl_constraint *upper,
54 __isl_take isl_basic_set *bset, void *user), void *user);
56 __isl_give isl_basic_map *isl_basic_map_add_constraint(
57 __isl_take isl_basic_map *bmap, __isl_take isl_constraint *constraint);
58 __isl_give isl_basic_set *isl_basic_set_add_constraint(
59 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
61 int isl_basic_set_has_defining_equality(
62 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
63 struct isl_constraint **constraint);
64 int isl_basic_set_has_defining_inequalities(
65 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
66 struct isl_constraint **lower,
67 struct isl_constraint **upper);
69 int isl_constraint_dim(struct isl_constraint *constraint,
70 enum isl_dim_type type);
72 void isl_constraint_get_constant(__isl_keep isl_constraint *constraint,
73 isl_int *v);
74 void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint,
75 enum isl_dim_type type, int pos, isl_int *v);
76 void isl_constraint_set_constant(__isl_keep isl_constraint *constraint, isl_int v);
77 void isl_constraint_set_coefficient(__isl_keep isl_constraint *constraint,
78 enum isl_dim_type type, int pos, isl_int v);
80 __isl_give isl_div *isl_constraint_div(__isl_keep isl_constraint *constraint,
81 int pos);
82 struct isl_constraint *isl_constraint_add_div(struct isl_constraint *constraint,
83 struct isl_div *div, int *pos);
85 void isl_constraint_clear(struct isl_constraint *constraint);
86 struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint);
88 int isl_constraint_is_equality(__isl_keep isl_constraint *constraint);
89 int isl_constraint_is_div_constraint(__isl_keep isl_constraint *constraint);
91 __isl_give isl_basic_map *isl_basic_map_from_constraint(
92 __isl_take isl_constraint *constraint);
93 struct isl_basic_set *isl_basic_set_from_constraint(
94 struct isl_constraint *constraint);
96 #if defined(__cplusplus)
98 #endif
100 #endif