Polly 20.0.0git
isl_pw_fix_templ.c
Go to the documentation of this file.
1#include <isl_pw_macro.h>
2
3/* Fix the value of the given parameter or domain dimension of "pw"
4 * to be equal to "value".
5 */
7 unsigned pos, int value)
8{
9 int i;
10 isl_size n;
11
12 n = FN(PW,n_piece)(pw);
13 if (n < 0)
14 return FN(PW,free)(pw);
15
16 if (type == isl_dim_out)
17 isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
18 "cannot fix output dimension", return FN(PW,free)(pw));
19
20 if (type == isl_dim_in)
22
23 for (i = n - 1; i >= 0; --i) {
25
26 domain = FN(PW,take_domain_at)(pw, i);
28 pw = FN(PW,restore_domain_at)(pw, i, domain);
29 pw = FN(PW,exploit_equalities_and_remove_if_empty)(pw, i);
30 }
31
32 return pw;
33}
34
35/* Fix the value of the variable at position "pos" of type "type" of "pw"
36 * to be equal to "v".
37 */
39 enum isl_dim_type type, unsigned pos, __isl_take isl_val *v)
40{
41 int i;
42 isl_size n;
43
44 if (!v)
45 return FN(PW,free)(pw);
46 if (!isl_val_is_int(v))
47 isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
48 "expecting integer value", goto error);
49
50 n = FN(PW,n_piece)(pw);
51 if (n < 0)
52 goto error;
53
54 if (type == isl_dim_in)
56
57 for (i = 0; i < n; ++i) {
59
60 domain = FN(PW,take_domain_at)(pw, i);
61 domain = isl_set_fix(domain, type, pos, v->n);
62 pw = FN(PW,restore_domain_at)(pw, i, domain);
63 pw = FN(PW,exploit_equalities_and_remove_if_empty)(pw, i);
64 }
65
66 isl_val_free(v);
67 return pw;
68error:
69 isl_val_free(v);
70 return FN(PW,free)(pw);
71}
#define FN(TYPE, NAME)
#define __isl_take
Definition: ctx.h:22
#define __isl_give
Definition: ctx.h:19
#define isl_die(ctx, errno, msg, code)
Definition: ctx.h:137
@ isl_error_invalid
Definition: ctx.h:80
int isl_size
Definition: ctx.h:96
#define PW
Definition: isl_aff.c:4582
__isl_give isl_set * isl_set_fix(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, isl_int value)
Definition: isl_map.c:6660
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_map.c:70
enum isl_fold type
Definition: isl_test.c:4017
struct isl_set isl_set
Definition: map_type.h:26
__isl_give isl_set * isl_set_fix_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value)
Definition: isl_map.c:6634
isl_dim_type
Definition: space_type.h:13
@ isl_dim_in
Definition: space_type.h:16
@ isl_dim_set
Definition: space_type.h:18
@ isl_dim_out
Definition: space_type.h:17
static Signature domain
__isl_null isl_val * isl_val_free(__isl_take isl_val *v)
Definition: isl_val.c:263
__isl_export isl_bool isl_val_is_int(__isl_keep isl_val *v)
Definition: isl_val.c:1141
n
Definition: youcefn.c:8