/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_pw_templ.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2010-2011 INRIA Saclay |
3 | | * Copyright 2011 Sven Verdoolaege |
4 | | * Copyright 2012-2014 Ecole Normale Superieure |
5 | | * |
6 | | * Use of this software is governed by the MIT license |
7 | | * |
8 | | * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, |
9 | | * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, |
10 | | * 91893 Orsay, France |
11 | | * and Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France |
12 | | */ |
13 | | |
14 | | #include <isl/id.h> |
15 | | #include <isl/aff.h> |
16 | | #include <isl_sort.h> |
17 | | #include <isl_val_private.h> |
18 | | |
19 | | #include <isl_pw_macro.h> |
20 | | |
21 | | #ifdef HAS_TYPE |
22 | | __isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim, |
23 | | enum isl_fold type, int n) |
24 | | #else |
25 | | __isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim, int n) |
26 | | #endif |
27 | 283k | { |
28 | 283k | isl_ctx *ctx; |
29 | 283k | struct PW *pw; |
30 | 283k | |
31 | 283k | if (!dim) |
32 | 0 | return NULL; |
33 | 283k | ctx = isl_space_get_ctx(dim); |
34 | 283k | isl_assert(ctx, n >= 0, goto error); |
35 | 283k | pw = isl_alloc(ctx, struct PW, |
36 | 283k | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); |
37 | 283k | if (!pw) |
38 | 0 | goto error; |
39 | 283k | |
40 | 283k | pw->ref = 1; |
41 | | #ifdef HAS_TYPE |
42 | | pw->type = type; |
43 | | #endif |
44 | | pw->size = n; |
45 | 283k | pw->n = 0; |
46 | 283k | pw->dim = dim; |
47 | 283k | return pw; |
48 | 283k | error: |
49 | 0 | isl_space_free(dim); |
50 | 0 | return NULL; |
51 | 283k | } Line | Count | Source | 27 | 248k | { | 28 | 248k | isl_ctx *ctx; | 29 | 248k | struct PW *pw; | 30 | 248k | | 31 | 248k | if (!dim) | 32 | 0 | return NULL; | 33 | 248k | ctx = isl_space_get_ctx(dim); | 34 | 248k | isl_assert(ctx, n >= 0, goto error); | 35 | 248k | pw = isl_alloc(ctx, struct PW, | 36 | 248k | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 37 | 248k | if (!pw) | 38 | 0 | goto error; | 39 | 248k | | 40 | 248k | pw->ref = 1; | 41 | | #ifdef HAS_TYPE | 42 | | pw->type = type; | 43 | | #endif | 44 | | pw->size = n; | 45 | 248k | pw->n = 0; | 46 | 248k | pw->dim = dim; | 47 | 248k | return pw; | 48 | 248k | error: | 49 | 0 | isl_space_free(dim); | 50 | 0 | return NULL; | 51 | 248k | } |
isl_pw_multi_aff_alloc_size Line | Count | Source | 27 | 34.4k | { | 28 | 34.4k | isl_ctx *ctx; | 29 | 34.4k | struct PW *pw; | 30 | 34.4k | | 31 | 34.4k | if (!dim) | 32 | 0 | return NULL; | 33 | 34.4k | ctx = isl_space_get_ctx(dim); | 34 | 34.4k | isl_assert(ctx, n >= 0, goto error); | 35 | 34.4k | pw = isl_alloc(ctx, struct PW, | 36 | 34.4k | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 37 | 34.4k | if (!pw) | 38 | 0 | goto error; | 39 | 34.4k | | 40 | 34.4k | pw->ref = 1; | 41 | | #ifdef HAS_TYPE | 42 | | pw->type = type; | 43 | | #endif | 44 | | pw->size = n; | 45 | 34.4k | pw->n = 0; | 46 | 34.4k | pw->dim = dim; | 47 | 34.4k | return pw; | 48 | 34.4k | error: | 49 | 0 | isl_space_free(dim); | 50 | 0 | return NULL; | 51 | 34.4k | } |
isl_pw_qpolynomial_fold_alloc_size Line | Count | Source | 27 | 35 | { | 28 | 35 | isl_ctx *ctx; | 29 | 35 | struct PW *pw; | 30 | 35 | | 31 | 35 | if (!dim) | 32 | 0 | return NULL; | 33 | 35 | ctx = isl_space_get_ctx(dim); | 34 | 35 | isl_assert(ctx, n >= 0, goto error); | 35 | 35 | pw = isl_alloc(ctx, struct PW, | 36 | 35 | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 37 | 35 | if (!pw) | 38 | 0 | goto error; | 39 | 35 | | 40 | 35 | pw->ref = 1; | 41 | 35 | #ifdef HAS_TYPE | 42 | 35 | pw->type = type; | 43 | 35 | #endif | 44 | 35 | pw->size = n; | 45 | 35 | pw->n = 0; | 46 | 35 | pw->dim = dim; | 47 | 35 | return pw; | 48 | 35 | error: | 49 | 0 | isl_space_free(dim); | 50 | 0 | return NULL; | 51 | 35 | } |
isl_pw_qpolynomial_alloc_size Line | Count | Source | 27 | 104 | { | 28 | 104 | isl_ctx *ctx; | 29 | 104 | struct PW *pw; | 30 | 104 | | 31 | 104 | if (!dim) | 32 | 0 | return NULL; | 33 | 104 | ctx = isl_space_get_ctx(dim); | 34 | 104 | isl_assert(ctx, n >= 0, goto error); | 35 | 104 | pw = isl_alloc(ctx, struct PW, | 36 | 104 | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 37 | 104 | if (!pw) | 38 | 0 | goto error; | 39 | 104 | | 40 | 104 | pw->ref = 1; | 41 | | #ifdef HAS_TYPE | 42 | | pw->type = type; | 43 | | #endif | 44 | | pw->size = n; | 45 | 104 | pw->n = 0; | 46 | 104 | pw->dim = dim; | 47 | 104 | return pw; | 48 | 104 | error: | 49 | 0 | isl_space_free(dim); | 50 | 0 | return NULL; | 51 | 104 | } |
|
52 | | |
53 | | #ifdef HAS_TYPE |
54 | | __isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim, enum isl_fold type) |
55 | 16 | { |
56 | 16 | return FN(PW,alloc_size)(dim, type, 0); |
57 | 16 | } |
58 | | #else |
59 | | __isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim) |
60 | 7.98k | { |
61 | 7.98k | return FN(PW,alloc_size)(dim, 0); |
62 | 7.98k | } Line | Count | Source | 60 | 3.37k | { | 61 | 3.37k | return FN(PW,alloc_size)(dim, 0); | 62 | 3.37k | } |
Line | Count | Source | 60 | 4.60k | { | 61 | 4.60k | return FN(PW,alloc_size)(dim, 0); | 62 | 4.60k | } |
Line | Count | Source | 60 | 2 | { | 61 | 2 | return FN(PW,alloc_size)(dim, 0); | 62 | 2 | } |
|
63 | | #endif |
64 | | |
65 | | __isl_give PW *FN(PW,add_piece)(__isl_take PW *pw, |
66 | | __isl_take isl_set *set, __isl_take EL *el) |
67 | 285k | { |
68 | 285k | isl_ctx *ctx; |
69 | 285k | isl_space *el_dim = NULL; |
70 | 285k | |
71 | 285k | if (!pw || !set || !el) |
72 | 0 | goto error; |
73 | 285k | |
74 | 285k | if (isl_set_plain_is_empty(set) || FN284k (EL,EL_IS_ZERO)(el)284k ) { |
75 | 790 | isl_set_free(set); |
76 | 790 | FN(EL,free)(el); |
77 | 790 | return pw; |
78 | 790 | } |
79 | 284k | |
80 | 284k | ctx = isl_set_get_ctx(set); |
81 | | #ifdef HAS_TYPE |
82 | 18 | if (pw->type != el->type) |
83 | 0 | isl_die(ctx, isl_error_invalid, "fold types don't match", |
84 | | goto error); |
85 | | #endif |
86 | 284k | el_dim = 18 FN(EL,get_space(el)); |
87 | 284k | isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error); |
88 | 284k | isl_assert(ctx, pw->n < pw->size, goto error); |
89 | 284k | |
90 | 284k | pw->p[pw->n].set = set; |
91 | 284k | pw->p[pw->n].FIELD = el; |
92 | 284k | pw->n++; |
93 | 284k | |
94 | 284k | isl_space_free(el_dim); |
95 | 284k | return pw; |
96 | 284k | error: |
97 | 0 | isl_space_free(el_dim); |
98 | 0 | FN(PW,free)(pw); |
99 | 0 | isl_set_free(set); |
100 | 0 | FN(EL,free)(el); |
101 | 0 | return NULL; |
102 | 284k | } Line | Count | Source | 67 | 250k | { | 68 | 250k | isl_ctx *ctx; | 69 | 250k | isl_space *el_dim = NULL; | 70 | 250k | | 71 | 250k | if (!pw || !set || !el) | 72 | 0 | goto error; | 73 | 250k | | 74 | 250k | if (isl_set_plain_is_empty(set) || FN250k (EL,EL_IS_ZERO)(el)250k ) { | 75 | 391 | isl_set_free(set); | 76 | 391 | FN(EL,free)(el); | 77 | 391 | return pw; | 78 | 391 | } | 79 | 250k | | 80 | 250k | ctx = isl_set_get_ctx(set); | 81 | | #ifdef HAS_TYPE | 82 | | if (pw->type != el->type) | 83 | | isl_die(ctx, isl_error_invalid, "fold types don't match", | 84 | | goto error); | 85 | | #endif | 86 | 250k | el_dim = FN(EL,get_space(el)); | 87 | 250k | isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error); | 88 | 250k | isl_assert(ctx, pw->n < pw->size, goto error); | 89 | 250k | | 90 | 250k | pw->p[pw->n].set = set; | 91 | 250k | pw->p[pw->n].FIELD = el; | 92 | 250k | pw->n++; | 93 | 250k | | 94 | 250k | isl_space_free(el_dim); | 95 | 250k | return pw; | 96 | 250k | error: | 97 | 0 | isl_space_free(el_dim); | 98 | 0 | FN(PW,free)(pw); | 99 | 0 | isl_set_free(set); | 100 | 0 | FN(EL,free)(el); | 101 | 0 | return NULL; | 102 | 250k | } |
isl_pw_multi_aff_add_piece Line | Count | Source | 67 | 34.4k | { | 68 | 34.4k | isl_ctx *ctx; | 69 | 34.4k | isl_space *el_dim = NULL; | 70 | 34.4k | | 71 | 34.4k | if (!pw || !set || !el) | 72 | 0 | goto error; | 73 | 34.4k | | 74 | 34.4k | if (isl_set_plain_is_empty(set) || FN34.0k (EL,EL_IS_ZERO)(el)34.0k ) { | 75 | 340 | isl_set_free(set); | 76 | 340 | FN(EL,free)(el); | 77 | 340 | return pw; | 78 | 340 | } | 79 | 34.0k | | 80 | 34.0k | ctx = isl_set_get_ctx(set); | 81 | | #ifdef HAS_TYPE | 82 | | if (pw->type != el->type) | 83 | | isl_die(ctx, isl_error_invalid, "fold types don't match", | 84 | | goto error); | 85 | | #endif | 86 | 34.0k | el_dim = FN(EL,get_space(el)); | 87 | 34.0k | isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error); | 88 | 34.0k | isl_assert(ctx, pw->n < pw->size, goto error); | 89 | 34.0k | | 90 | 34.0k | pw->p[pw->n].set = set; | 91 | 34.0k | pw->p[pw->n].FIELD = el; | 92 | 34.0k | pw->n++; | 93 | 34.0k | | 94 | 34.0k | isl_space_free(el_dim); | 95 | 34.0k | return pw; | 96 | 34.0k | error: | 97 | 0 | isl_space_free(el_dim); | 98 | 0 | FN(PW,free)(pw); | 99 | 0 | isl_set_free(set); | 100 | 0 | FN(EL,free)(el); | 101 | 0 | return NULL; | 102 | 34.0k | } |
isl_pw_qpolynomial_fold_add_piece Line | Count | Source | 67 | 24 | { | 68 | 24 | isl_ctx *ctx; | 69 | 24 | isl_space *el_dim = NULL; | 70 | 24 | | 71 | 24 | if (!pw || !set || !el) | 72 | 0 | goto error; | 73 | 24 | | 74 | 24 | if (isl_set_plain_is_empty(set) || FN18 (EL,EL_IS_ZERO)(el)18 ) { | 75 | 6 | isl_set_free(set); | 76 | 6 | FN(EL,free)(el); | 77 | 6 | return pw; | 78 | 6 | } | 79 | 18 | | 80 | 18 | ctx = isl_set_get_ctx(set); | 81 | 18 | #ifdef HAS_TYPE | 82 | 18 | if (pw->type != el->type) | 83 | 18 | isl_die0 (ctx, isl_error_invalid, "fold types don't match", | 84 | 18 | goto error); | 85 | 18 | #endif | 86 | 18 | el_dim = FN(EL,get_space(el)); | 87 | 18 | isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error); | 88 | 18 | isl_assert(ctx, pw->n < pw->size, goto error); | 89 | 18 | | 90 | 18 | pw->p[pw->n].set = set; | 91 | 18 | pw->p[pw->n].FIELD = el; | 92 | 18 | pw->n++; | 93 | 18 | | 94 | 18 | isl_space_free(el_dim); | 95 | 18 | return pw; | 96 | 18 | error: | 97 | 0 | isl_space_free(el_dim); | 98 | 0 | FN(PW,free)(pw); | 99 | 0 | isl_set_free(set); | 100 | 0 | FN(EL,free)(el); | 101 | 0 | return NULL; | 102 | 18 | } |
isl_pw_qpolynomial_add_piece Line | Count | Source | 67 | 151 | { | 68 | 151 | isl_ctx *ctx; | 69 | 151 | isl_space *el_dim = NULL; | 70 | 151 | | 71 | 151 | if (!pw || !set || !el) | 72 | 0 | goto error; | 73 | 151 | | 74 | 151 | if (isl_set_plain_is_empty(set) || FN107 (EL,EL_IS_ZERO)(el)107 ) { | 75 | 53 | isl_set_free(set); | 76 | 53 | FN(EL,free)(el); | 77 | 53 | return pw; | 78 | 53 | } | 79 | 98 | | 80 | 98 | ctx = isl_set_get_ctx(set); | 81 | | #ifdef HAS_TYPE | 82 | | if (pw->type != el->type) | 83 | | isl_die(ctx, isl_error_invalid, "fold types don't match", | 84 | | goto error); | 85 | | #endif | 86 | 98 | el_dim = FN(EL,get_space(el)); | 87 | 98 | isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error); | 88 | 98 | isl_assert(ctx, pw->n < pw->size, goto error); | 89 | 98 | | 90 | 98 | pw->p[pw->n].set = set; | 91 | 98 | pw->p[pw->n].FIELD = el; | 92 | 98 | pw->n++; | 93 | 98 | | 94 | 98 | isl_space_free(el_dim); | 95 | 98 | return pw; | 96 | 98 | error: | 97 | 0 | isl_space_free(el_dim); | 98 | 0 | FN(PW,free)(pw); | 99 | 0 | isl_set_free(set); | 100 | 0 | FN(EL,free)(el); | 101 | 0 | return NULL; | 102 | 98 | } |
|
103 | | |
104 | | /* Does the space of "set" correspond to that of the domain of "el". |
105 | | */ |
106 | | static isl_bool FN(PW,compatible_domain)(__isl_keep EL *el, |
107 | | __isl_keep isl_set *set) |
108 | 108k | { |
109 | 108k | isl_bool ok; |
110 | 108k | isl_space *el_space, *set_space; |
111 | 108k | |
112 | 108k | if (!set || !el108k ) |
113 | 3 | return isl_bool_error; |
114 | 108k | set_space = isl_set_get_space(set); |
115 | 108k | el_space = FN(EL,get_space)(el); |
116 | 108k | ok = isl_space_is_domain_internal(set_space, el_space); |
117 | 108k | isl_space_free(el_space); |
118 | 108k | isl_space_free(set_space); |
119 | 108k | return ok; |
120 | 108k | } isl_aff.c:isl_pw_aff_compatible_domain Line | Count | Source | 108 | 82.7k | { | 109 | 82.7k | isl_bool ok; | 110 | 82.7k | isl_space *el_space, *set_space; | 111 | 82.7k | | 112 | 82.7k | if (!set || !el82.7k ) | 113 | 3 | return isl_bool_error; | 114 | 82.7k | set_space = isl_set_get_space(set); | 115 | 82.7k | el_space = FN(EL,get_space)(el); | 116 | 82.7k | ok = isl_space_is_domain_internal(set_space, el_space); | 117 | 82.7k | isl_space_free(el_space); | 118 | 82.7k | isl_space_free(set_space); | 119 | 82.7k | return ok; | 120 | 82.7k | } |
isl_aff.c:isl_pw_multi_aff_compatible_domain Line | Count | Source | 108 | 25.3k | { | 109 | 25.3k | isl_bool ok; | 110 | 25.3k | isl_space *el_space, *set_space; | 111 | 25.3k | | 112 | 25.3k | if (!set || !el) | 113 | 0 | return isl_bool_error; | 114 | 25.3k | set_space = isl_set_get_space(set); | 115 | 25.3k | el_space = FN(EL,get_space)(el); | 116 | 25.3k | ok = isl_space_is_domain_internal(set_space, el_space); | 117 | 25.3k | isl_space_free(el_space); | 118 | 25.3k | isl_space_free(set_space); | 119 | 25.3k | return ok; | 120 | 25.3k | } |
isl_fold.c:isl_pw_qpolynomial_fold_compatible_domain Line | Count | Source | 108 | 12 | { | 109 | 12 | isl_bool ok; | 110 | 12 | isl_space *el_space, *set_space; | 111 | 12 | | 112 | 12 | if (!set || !el) | 113 | 0 | return isl_bool_error; | 114 | 12 | set_space = isl_set_get_space(set); | 115 | 12 | el_space = FN(EL,get_space)(el); | 116 | 12 | ok = isl_space_is_domain_internal(set_space, el_space); | 117 | 12 | isl_space_free(el_space); | 118 | 12 | isl_space_free(set_space); | 119 | 12 | return ok; | 120 | 12 | } |
isl_polynomial.c:isl_pw_qpolynomial_compatible_domain Line | Count | Source | 108 | 33 | { | 109 | 33 | isl_bool ok; | 110 | 33 | isl_space *el_space, *set_space; | 111 | 33 | | 112 | 33 | if (!set || !el) | 113 | 0 | return isl_bool_error; | 114 | 33 | set_space = isl_set_get_space(set); | 115 | 33 | el_space = FN(EL,get_space)(el); | 116 | 33 | ok = isl_space_is_domain_internal(set_space, el_space); | 117 | 33 | isl_space_free(el_space); | 118 | 33 | isl_space_free(set_space); | 119 | 33 | return ok; | 120 | 33 | } |
|
121 | | |
122 | | /* Check that the space of "set" corresponds to that of the domain of "el". |
123 | | */ |
124 | | static isl_stat FN(PW,check_compatible_domain)(__isl_keep EL *el, |
125 | | __isl_keep isl_set *set) |
126 | 108k | { |
127 | 108k | isl_bool ok; |
128 | 108k | |
129 | 108k | ok = FN(PW,compatible_domain)(el, set); |
130 | 108k | if (ok < 0) |
131 | 3 | return isl_stat_error; |
132 | 108k | if (!ok) |
133 | 108k | isl_die0 (isl_set_get_ctx(set), isl_error_invalid, |
134 | 108k | "incompatible spaces", return isl_stat_error); |
135 | 108k | |
136 | 108k | return isl_stat_ok; |
137 | 108k | } isl_aff.c:isl_pw_aff_check_compatible_domain Line | Count | Source | 126 | 82.7k | { | 127 | 82.7k | isl_bool ok; | 128 | 82.7k | | 129 | 82.7k | ok = FN(PW,compatible_domain)(el, set); | 130 | 82.7k | if (ok < 0) | 131 | 3 | return isl_stat_error; | 132 | 82.7k | if (!ok) | 133 | 82.7k | isl_die0 (isl_set_get_ctx(set), isl_error_invalid, | 134 | 82.7k | "incompatible spaces", return isl_stat_error); | 135 | 82.7k | | 136 | 82.7k | return isl_stat_ok; | 137 | 82.7k | } |
isl_aff.c:isl_pw_multi_aff_check_compatible_domain Line | Count | Source | 126 | 25.3k | { | 127 | 25.3k | isl_bool ok; | 128 | 25.3k | | 129 | 25.3k | ok = FN(PW,compatible_domain)(el, set); | 130 | 25.3k | if (ok < 0) | 131 | 0 | return isl_stat_error; | 132 | 25.3k | if (!ok) | 133 | 25.3k | isl_die0 (isl_set_get_ctx(set), isl_error_invalid, | 134 | 25.3k | "incompatible spaces", return isl_stat_error); | 135 | 25.3k | | 136 | 25.3k | return isl_stat_ok; | 137 | 25.3k | } |
isl_fold.c:isl_pw_qpolynomial_fold_check_compatible_domain Line | Count | Source | 126 | 12 | { | 127 | 12 | isl_bool ok; | 128 | 12 | | 129 | 12 | ok = FN(PW,compatible_domain)(el, set); | 130 | 12 | if (ok < 0) | 131 | 0 | return isl_stat_error; | 132 | 12 | if (!ok) | 133 | 12 | isl_die0 (isl_set_get_ctx(set), isl_error_invalid, | 134 | 12 | "incompatible spaces", return isl_stat_error); | 135 | 12 | | 136 | 12 | return isl_stat_ok; | 137 | 12 | } |
isl_polynomial.c:isl_pw_qpolynomial_check_compatible_domain Line | Count | Source | 126 | 33 | { | 127 | 33 | isl_bool ok; | 128 | 33 | | 129 | 33 | ok = FN(PW,compatible_domain)(el, set); | 130 | 33 | if (ok < 0) | 131 | 0 | return isl_stat_error; | 132 | 33 | if (!ok) | 133 | 33 | isl_die0 (isl_set_get_ctx(set), isl_error_invalid, | 134 | 33 | "incompatible spaces", return isl_stat_error); | 135 | 33 | | 136 | 33 | return isl_stat_ok; | 137 | 33 | } |
|
138 | | |
139 | | #ifdef HAS_TYPE |
140 | | __isl_give PW *FN(PW,alloc)(enum isl_fold type, |
141 | | __isl_take isl_set *set, __isl_take EL *el) |
142 | | #else |
143 | | __isl_give PW *FN(PW,alloc)(__isl_take isl_set *set, __isl_take EL *el) |
144 | | #endif |
145 | 108k | { |
146 | 108k | PW *pw; |
147 | 108k | |
148 | 108k | if (FN(PW,check_compatible_domain)(el, set) < 0) |
149 | 3 | goto error; |
150 | 12 | |
151 | | #ifdef HAS_TYPE |
152 | 12 | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1); |
153 | | #else |
154 | 108k | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1); |
155 | | #endif |
156 | | |
157 | 108k | return FN(PW,add_piece)(pw, set, el); |
158 | 108k | error: |
159 | 3 | isl_set_free(set); |
160 | 3 | FN(EL,free)(el); |
161 | 3 | return NULL; |
162 | 108k | } Line | Count | Source | 145 | 82.7k | { | 146 | 82.7k | PW *pw; | 147 | 82.7k | | 148 | 82.7k | if (FN(PW,check_compatible_domain)(el, set) < 0) | 149 | 3 | goto error; | 150 | 82.7k | | 151 | | #ifdef HAS_TYPE | 152 | | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1); | 153 | | #else | 154 | 82.7k | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1); | 155 | 82.7k | #endif | 156 | 82.7k | | 157 | 82.7k | return FN(PW,add_piece)(pw, set, el); | 158 | 82.7k | error: | 159 | 3 | isl_set_free(set); | 160 | 3 | FN(EL,free)(el); | 161 | 3 | return NULL; | 162 | 82.7k | } |
Line | Count | Source | 145 | 25.3k | { | 146 | 25.3k | PW *pw; | 147 | 25.3k | | 148 | 25.3k | if (FN(PW,check_compatible_domain)(el, set) < 0) | 149 | 0 | goto error; | 150 | 25.3k | | 151 | | #ifdef HAS_TYPE | 152 | | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1); | 153 | | #else | 154 | 25.3k | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1); | 155 | 25.3k | #endif | 156 | 25.3k | | 157 | 25.3k | return FN(PW,add_piece)(pw, set, el); | 158 | 25.3k | error: | 159 | 0 | isl_set_free(set); | 160 | 0 | FN(EL,free)(el); | 161 | 0 | return NULL; | 162 | 25.3k | } |
isl_pw_qpolynomial_fold_alloc Line | Count | Source | 145 | 12 | { | 146 | 12 | PW *pw; | 147 | 12 | | 148 | 12 | if (FN(PW,check_compatible_domain)(el, set) < 0) | 149 | 0 | goto error; | 150 | 12 | | 151 | 12 | #ifdef HAS_TYPE | 152 | 12 | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1); | 153 | | #else | 154 | | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1); | 155 | | #endif | 156 | | | 157 | 12 | return FN(PW,add_piece)(pw, set, el); | 158 | 12 | error: | 159 | 0 | isl_set_free(set); | 160 | 0 | FN(EL,free)(el); | 161 | 0 | return NULL; | 162 | 12 | } |
Line | Count | Source | 145 | 33 | { | 146 | 33 | PW *pw; | 147 | 33 | | 148 | 33 | if (FN(PW,check_compatible_domain)(el, set) < 0) | 149 | 0 | goto error; | 150 | 33 | | 151 | | #ifdef HAS_TYPE | 152 | | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1); | 153 | | #else | 154 | 33 | pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1); | 155 | 33 | #endif | 156 | 33 | | 157 | 33 | return FN(PW,add_piece)(pw, set, el); | 158 | 33 | error: | 159 | 0 | isl_set_free(set); | 160 | 0 | FN(EL,free)(el); | 161 | 0 | return NULL; | 162 | 33 | } |
|
163 | | |
164 | | __isl_give PW *FN(PW,dup)(__isl_keep PW *pw) |
165 | 69.4k | { |
166 | 69.4k | int i; |
167 | 69.4k | PW *dup; |
168 | 69.4k | |
169 | 69.4k | if (!pw) |
170 | 0 | return NULL; |
171 | 0 | |
172 | | #ifdef HAS_TYPE |
173 | 0 | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n); |
174 | | #else |
175 | 69.4k | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n); |
176 | | #endif |
177 | 69.4k | if (!dup) |
178 | 0 | return NULL; |
179 | 69.4k | |
180 | 140k | for (i = 0; 69.4k i < pw->n; ++i71.5k ) |
181 | 71.5k | dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set), |
182 | 71.5k | FN(EL,copy)(pw->p[i].FIELD)); |
183 | 69.4k | |
184 | 69.4k | return dup; |
185 | 69.4k | } Line | Count | Source | 165 | 67.9k | { | 166 | 67.9k | int i; | 167 | 67.9k | PW *dup; | 168 | 67.9k | | 169 | 67.9k | if (!pw) | 170 | 0 | return NULL; | 171 | 67.9k | | 172 | | #ifdef HAS_TYPE | 173 | | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n); | 174 | | #else | 175 | 67.9k | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n); | 176 | 67.9k | #endif | 177 | 67.9k | if (!dup) | 178 | 0 | return NULL; | 179 | 67.9k | | 180 | 137k | for (i = 0; 67.9k i < pw->n; ++i70.0k ) | 181 | 70.0k | dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set), | 182 | 70.0k | FN(EL,copy)(pw->p[i].FIELD)); | 183 | 67.9k | | 184 | 67.9k | return dup; | 185 | 67.9k | } |
Line | Count | Source | 165 | 1.48k | { | 166 | 1.48k | int i; | 167 | 1.48k | PW *dup; | 168 | 1.48k | | 169 | 1.48k | if (!pw) | 170 | 0 | return NULL; | 171 | 1.48k | | 172 | | #ifdef HAS_TYPE | 173 | | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n); | 174 | | #else | 175 | 1.48k | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n); | 176 | 1.48k | #endif | 177 | 1.48k | if (!dup) | 178 | 0 | return NULL; | 179 | 1.48k | | 180 | 2.99k | for (i = 0; 1.48k i < pw->n; ++i1.51k ) | 181 | 1.51k | dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set), | 182 | 1.51k | FN(EL,copy)(pw->p[i].FIELD)); | 183 | 1.48k | | 184 | 1.48k | return dup; | 185 | 1.48k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_dup Line | Count | Source | 165 | 1 | { | 166 | 1 | int i; | 167 | 1 | PW *dup; | 168 | 1 | | 169 | 1 | if (!pw) | 170 | 0 | return NULL; | 171 | 1 | | 172 | | #ifdef HAS_TYPE | 173 | | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n); | 174 | | #else | 175 | 1 | dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n); | 176 | 1 | #endif | 177 | 1 | if (!dup) | 178 | 0 | return NULL; | 179 | 1 | | 180 | 2 | for (i = 0; 1 i < pw->n; ++i1 ) | 181 | 1 | dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set), | 182 | 1 | FN(EL,copy)(pw->p[i].FIELD)); | 183 | 1 | | 184 | 1 | return dup; | 185 | 1 | } |
|
186 | | |
187 | | __isl_give PW *FN(PW,cow)(__isl_take PW *pw) |
188 | 200k | { |
189 | 200k | if (!pw) |
190 | 0 | return NULL; |
191 | 200k | |
192 | 200k | if (pw->ref == 1) |
193 | 131k | return pw; |
194 | 69.4k | pw->ref--; |
195 | 69.4k | return FN(PW,dup)(pw); |
196 | 69.4k | } Line | Count | Source | 188 | 189k | { | 189 | 189k | if (!pw) | 190 | 0 | return NULL; | 191 | 189k | | 192 | 189k | if (pw->ref == 1) | 193 | 121k | return pw; | 194 | 67.9k | pw->ref--; | 195 | 67.9k | return FN(PW,dup)(pw); | 196 | 67.9k | } |
Line | Count | Source | 188 | 11.3k | { | 189 | 11.3k | if (!pw) | 190 | 0 | return NULL; | 191 | 11.3k | | 192 | 11.3k | if (pw->ref == 1) | 193 | 9.82k | return pw; | 194 | 1.48k | pw->ref--; | 195 | 1.48k | return FN(PW,dup)(pw); | 196 | 1.48k | } |
isl_pw_qpolynomial_fold_cow Line | Count | Source | 188 | 7 | { | 189 | 7 | if (!pw) | 190 | 0 | return NULL; | 191 | 7 | | 192 | 7 | if (pw->ref == 1) | 193 | 7 | return pw; | 194 | 0 | pw->ref--; | 195 | 0 | return FN(PW,dup)(pw); | 196 | 0 | } |
Line | Count | Source | 188 | 51 | { | 189 | 51 | if (!pw) | 190 | 0 | return NULL; | 191 | 51 | | 192 | 51 | if (pw->ref == 1) | 193 | 50 | return pw; | 194 | 1 | pw->ref--; | 195 | 1 | return FN(PW,dup)(pw); | 196 | 1 | } |
|
197 | | |
198 | | __isl_give PW *FN(PW,copy)(__isl_keep PW *pw) |
199 | 484k | { |
200 | 484k | if (!pw) |
201 | 48.0k | return NULL; |
202 | 436k | |
203 | 436k | pw->ref++; |
204 | 436k | return pw; |
205 | 436k | } Line | Count | Source | 199 | 439k | { | 200 | 439k | if (!pw) | 201 | 48.0k | return NULL; | 202 | 391k | | 203 | 391k | pw->ref++; | 204 | 391k | return pw; | 205 | 391k | } |
Line | Count | Source | 199 | 44.8k | { | 200 | 44.8k | if (!pw) | 201 | 9 | return NULL; | 202 | 44.8k | | 203 | 44.8k | pw->ref++; | 204 | 44.8k | return pw; | 205 | 44.8k | } |
isl_pw_qpolynomial_fold_copy Line | Count | Source | 199 | 2 | { | 200 | 2 | if (!pw) | 201 | 0 | return NULL; | 202 | 2 | | 203 | 2 | pw->ref++; | 204 | 2 | return pw; | 205 | 2 | } |
|
206 | | |
207 | | __isl_null PW *FN(PW,free)(__isl_take PW *pw) |
208 | 697k | { |
209 | 697k | int i; |
210 | 697k | |
211 | 697k | if (!pw) |
212 | 47.6k | return NULL; |
213 | 650k | if (--pw->ref > 0) |
214 | 367k | return NULL; |
215 | 282k | |
216 | 567k | for (i = 0; 282k i < pw->n; ++i284k ) { |
217 | 284k | isl_set_free(pw->p[i].set); |
218 | 284k | FN(EL,free)(pw->p[i].FIELD); |
219 | 284k | } |
220 | 282k | isl_space_free(pw->dim); |
221 | 282k | free(pw); |
222 | 282k | |
223 | 282k | return NULL; |
224 | 282k | } Line | Count | Source | 208 | 619k | { | 209 | 619k | int i; | 210 | 619k | | 211 | 619k | if (!pw) | 212 | 47.6k | return NULL; | 213 | 572k | if (--pw->ref > 0) | 214 | 323k | return NULL; | 215 | 248k | | 216 | 498k | for (i = 0; 248k i < pw->n; ++i250k ) { | 217 | 250k | isl_set_free(pw->p[i].set); | 218 | 250k | FN(EL,free)(pw->p[i].FIELD); | 219 | 250k | } | 220 | 248k | isl_space_free(pw->dim); | 221 | 248k | free(pw); | 222 | 248k | | 223 | 248k | return NULL; | 224 | 248k | } |
Line | Count | Source | 208 | 77.7k | { | 209 | 77.7k | int i; | 210 | 77.7k | | 211 | 77.7k | if (!pw) | 212 | 3 | return NULL; | 213 | 77.7k | if (--pw->ref > 0) | 214 | 43.3k | return NULL; | 215 | 34.4k | | 216 | 68.4k | for (i = 0; 34.4k i < pw->n; ++i34.0k ) { | 217 | 34.0k | isl_set_free(pw->p[i].set); | 218 | 34.0k | FN(EL,free)(pw->p[i].FIELD); | 219 | 34.0k | } | 220 | 34.4k | isl_space_free(pw->dim); | 221 | 34.4k | free(pw); | 222 | 34.4k | | 223 | 34.4k | return NULL; | 224 | 34.4k | } |
isl_pw_qpolynomial_fold_free Line | Count | Source | 208 | 37 | { | 209 | 37 | int i; | 210 | 37 | | 211 | 37 | if (!pw) | 212 | 0 | return NULL; | 213 | 37 | if (--pw->ref > 0) | 214 | 2 | return NULL; | 215 | 35 | | 216 | 53 | for (i = 0; 35 i < pw->n; ++i18 ) { | 217 | 18 | isl_set_free(pw->p[i].set); | 218 | 18 | FN(EL,free)(pw->p[i].FIELD); | 219 | 18 | } | 220 | 35 | isl_space_free(pw->dim); | 221 | 35 | free(pw); | 222 | 35 | | 223 | 35 | return NULL; | 224 | 35 | } |
Line | Count | Source | 208 | 113 | { | 209 | 113 | int i; | 210 | 113 | | 211 | 113 | if (!pw) | 212 | 0 | return NULL; | 213 | 113 | if (--pw->ref > 0) | 214 | 9 | return NULL; | 215 | 104 | | 216 | 202 | for (i = 0; 104 i < pw->n; ++i98 ) { | 217 | 98 | isl_set_free(pw->p[i].set); | 218 | 98 | FN(EL,free)(pw->p[i].FIELD); | 219 | 98 | } | 220 | 104 | isl_space_free(pw->dim); | 221 | 104 | free(pw); | 222 | 104 | | 223 | 104 | return NULL; | 224 | 104 | } |
|
225 | | |
226 | | const char *FN(PW,get_dim_name)(__isl_keep PW *pw, enum isl_dim_type type, |
227 | | unsigned pos) |
228 | 0 | { |
229 | 0 | return pw ? isl_space_get_dim_name(pw->dim, type, pos) : NULL; |
230 | 0 | } Unexecuted instantiation: isl_pw_aff_get_dim_name Unexecuted instantiation: isl_pw_multi_aff_get_dim_name Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_name Unexecuted instantiation: isl_pw_qpolynomial_get_dim_name |
231 | | |
232 | | isl_bool FN(PW,has_dim_id)(__isl_keep PW *pw, enum isl_dim_type type, |
233 | | unsigned pos) |
234 | 0 | { |
235 | 0 | return pw ? isl_space_has_dim_id(pw->dim, type, pos) : isl_bool_error; |
236 | 0 | } Unexecuted instantiation: isl_pw_aff_has_dim_id Unexecuted instantiation: isl_pw_multi_aff_has_dim_id Unexecuted instantiation: isl_pw_qpolynomial_fold_has_dim_id Unexecuted instantiation: isl_pw_qpolynomial_has_dim_id |
237 | | |
238 | | __isl_give isl_id *FN(PW,get_dim_id)(__isl_keep PW *pw, enum isl_dim_type type, |
239 | | unsigned pos) |
240 | 16 | { |
241 | 16 | return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL; |
242 | 16 | } Line | Count | Source | 240 | 16 | { | 241 | 16 | return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL; | 242 | 16 | } |
Unexecuted instantiation: isl_pw_multi_aff_get_dim_id Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_id Unexecuted instantiation: isl_pw_qpolynomial_get_dim_id |
243 | | |
244 | | isl_bool FN(PW,has_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type) |
245 | 0 | { |
246 | 0 | return pw ? isl_space_has_tuple_name(pw->dim, type) : isl_bool_error; |
247 | 0 | } Unexecuted instantiation: isl_pw_aff_has_tuple_name Unexecuted instantiation: isl_pw_multi_aff_has_tuple_name Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_name Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_name |
248 | | |
249 | | const char *FN(PW,get_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type) |
250 | 0 | { |
251 | 0 | return pw ? isl_space_get_tuple_name(pw->dim, type) : NULL; |
252 | 0 | } Unexecuted instantiation: isl_pw_aff_get_tuple_name Unexecuted instantiation: isl_pw_multi_aff_get_tuple_name Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_name Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_name |
253 | | |
254 | | isl_bool FN(PW,has_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type) |
255 | 0 | { |
256 | 0 | return pw ? isl_space_has_tuple_id(pw->dim, type) : isl_bool_error; |
257 | 0 | } Unexecuted instantiation: isl_pw_aff_has_tuple_id Unexecuted instantiation: isl_pw_multi_aff_has_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_id |
258 | | |
259 | | __isl_give isl_id *FN(PW,get_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type) |
260 | 348 | { |
261 | 348 | return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL; |
262 | 348 | } Unexecuted instantiation: isl_pw_aff_get_tuple_id isl_pw_multi_aff_get_tuple_id Line | Count | Source | 260 | 348 | { | 261 | 348 | return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL; | 262 | 348 | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_id |
263 | | |
264 | | isl_bool FN(PW,IS_ZERO)(__isl_keep PW *pw) |
265 | 73.2k | { |
266 | 73.2k | if (!pw) |
267 | 0 | return isl_bool_error; |
268 | 73.2k | |
269 | 73.2k | return pw->n == 0; |
270 | 73.2k | } Line | Count | Source | 265 | 46.5k | { | 266 | 46.5k | if (!pw) | 267 | 0 | return isl_bool_error; | 268 | 46.5k | | 269 | 46.5k | return pw->n == 0; | 270 | 46.5k | } |
isl_pw_multi_aff_is_empty Line | Count | Source | 265 | 26.5k | { | 266 | 26.5k | if (!pw) | 267 | 0 | return isl_bool_error; | 268 | 26.5k | | 269 | 26.5k | return pw->n == 0; | 270 | 26.5k | } |
isl_pw_qpolynomial_fold_is_zero Line | Count | Source | 265 | 26 | { | 266 | 26 | if (!pw) | 267 | 0 | return isl_bool_error; | 268 | 26 | | 269 | 26 | return pw->n == 0; | 270 | 26 | } |
isl_pw_qpolynomial_is_zero Line | Count | Source | 265 | 102 | { | 266 | 102 | if (!pw) | 267 | 0 | return isl_bool_error; | 268 | 102 | | 269 | 102 | return pw->n == 0; | 270 | 102 | } |
|
271 | | |
272 | | #ifndef NO_REALIGN |
273 | | __isl_give PW *FN(PW,realign_domain)(__isl_take PW *pw, |
274 | | __isl_take isl_reordering *exp) |
275 | 9.71k | { |
276 | 9.71k | int i; |
277 | 9.71k | |
278 | 9.71k | pw = FN(PW,cow)(pw); |
279 | 9.71k | if (!pw || !exp) |
280 | 0 | goto error; |
281 | 9.71k | |
282 | 19.9k | for (i = 0; 9.71k i < pw->n; ++i10.2k ) { |
283 | 10.2k | pw->p[i].set = isl_set_realign(pw->p[i].set, |
284 | 10.2k | isl_reordering_copy(exp)); |
285 | 10.2k | if (!pw->p[i].set) |
286 | 0 | goto error; |
287 | 10.2k | pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD, |
288 | 10.2k | isl_reordering_copy(exp)); |
289 | 10.2k | if (!pw->p[i].FIELD) |
290 | 10.2k | goto error0 ; |
291 | 10.2k | } |
292 | 9.71k | |
293 | 9.71k | pw = FN(PW,reset_domain_space)(pw, isl_reordering_get_space(exp)); |
294 | 9.71k | |
295 | 9.71k | isl_reordering_free(exp); |
296 | 9.71k | return pw; |
297 | 9.71k | error: |
298 | 0 | isl_reordering_free(exp); |
299 | 0 | FN(PW,free)(pw); |
300 | 0 | return NULL; |
301 | 9.71k | } isl_pw_aff_realign_domain Line | Count | Source | 275 | 9.70k | { | 276 | 9.70k | int i; | 277 | 9.70k | | 278 | 9.70k | pw = FN(PW,cow)(pw); | 279 | 9.70k | if (!pw || !exp) | 280 | 0 | goto error; | 281 | 9.70k | | 282 | 19.9k | for (i = 0; 9.70k i < pw->n; ++i10.2k ) { | 283 | 10.2k | pw->p[i].set = isl_set_realign(pw->p[i].set, | 284 | 10.2k | isl_reordering_copy(exp)); | 285 | 10.2k | if (!pw->p[i].set) | 286 | 0 | goto error; | 287 | 10.2k | pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD, | 288 | 10.2k | isl_reordering_copy(exp)); | 289 | 10.2k | if (!pw->p[i].FIELD) | 290 | 10.2k | goto error0 ; | 291 | 10.2k | } | 292 | 9.70k | | 293 | 9.70k | pw = FN(PW,reset_domain_space)(pw, isl_reordering_get_space(exp)); | 294 | 9.70k | | 295 | 9.70k | isl_reordering_free(exp); | 296 | 9.70k | return pw; | 297 | 9.70k | error: | 298 | 0 | isl_reordering_free(exp); | 299 | 0 | FN(PW,free)(pw); | 300 | 0 | return NULL; | 301 | 9.70k | } |
isl_pw_multi_aff_realign_domain Line | Count | Source | 275 | 7 | { | 276 | 7 | int i; | 277 | 7 | | 278 | 7 | pw = FN(PW,cow)(pw); | 279 | 7 | if (!pw || !exp) | 280 | 0 | goto error; | 281 | 7 | | 282 | 14 | for (i = 0; 7 i < pw->n; ++i7 ) { | 283 | 7 | pw->p[i].set = isl_set_realign(pw->p[i].set, | 284 | 7 | isl_reordering_copy(exp)); | 285 | 7 | if (!pw->p[i].set) | 286 | 0 | goto error; | 287 | 7 | pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD, | 288 | 7 | isl_reordering_copy(exp)); | 289 | 7 | if (!pw->p[i].FIELD) | 290 | 7 | goto error0 ; | 291 | 7 | } | 292 | 7 | | 293 | 7 | pw = FN(PW,reset_domain_space)(pw, isl_reordering_get_space(exp)); | 294 | 7 | | 295 | 7 | isl_reordering_free(exp); | 296 | 7 | return pw; | 297 | 7 | error: | 298 | 0 | isl_reordering_free(exp); | 299 | 0 | FN(PW,free)(pw); | 300 | 0 | return NULL; | 301 | 7 | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_realign_domain Unexecuted instantiation: isl_pw_qpolynomial_realign_domain |
302 | | |
303 | | /* Check that "pw" has only named parameters, reporting an error |
304 | | * if it does not. |
305 | | */ |
306 | | isl_stat FN(PW,check_named_params)(__isl_keep PW *pw) |
307 | 67.0k | { |
308 | 67.0k | return isl_space_check_named_params(FN(PW,peek_space)(pw)); |
309 | 67.0k | } isl_pw_aff_check_named_params Line | Count | Source | 307 | 46.8k | { | 308 | 46.8k | return isl_space_check_named_params(FN(PW,peek_space)(pw)); | 309 | 46.8k | } |
isl_pw_multi_aff_check_named_params Line | Count | Source | 307 | 20.1k | { | 308 | 20.1k | return isl_space_check_named_params(FN(PW,peek_space)(pw)); | 309 | 20.1k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_check_named_params isl_pw_qpolynomial_check_named_params Line | Count | Source | 307 | 5 | { | 308 | 5 | return isl_space_check_named_params(FN(PW,peek_space)(pw)); | 309 | 5 | } |
|
310 | | |
311 | | /* Align the parameters of "pw" to those of "model". |
312 | | */ |
313 | | __isl_give PW *FN(PW,align_params)(__isl_take PW *pw, __isl_take isl_space *model) |
314 | 56.7k | { |
315 | 56.7k | isl_ctx *ctx; |
316 | 56.7k | isl_bool equal_params; |
317 | 56.7k | |
318 | 56.7k | if (!pw || !model) |
319 | 0 | goto error; |
320 | 56.7k | |
321 | 56.7k | ctx = isl_space_get_ctx(model); |
322 | 56.7k | if (!isl_space_has_named_params(model)) |
323 | 56.7k | isl_die0 (ctx, isl_error_invalid, |
324 | 56.7k | "model has unnamed parameters", goto error); |
325 | 56.7k | if (FN(PW,check_named_params)(pw) < 0) |
326 | 0 | goto error; |
327 | 56.7k | equal_params = isl_space_has_equal_params(pw->dim, model); |
328 | 56.7k | if (equal_params < 0) |
329 | 0 | goto error; |
330 | 56.7k | if (!equal_params) { |
331 | 9.35k | isl_reordering *exp; |
332 | 9.35k | |
333 | 9.35k | exp = isl_parameter_alignment_reordering(pw->dim, model); |
334 | 9.35k | exp = isl_reordering_extend_space(exp, |
335 | 9.35k | FN(PW,get_domain_space)(pw)); |
336 | 9.35k | pw = FN(PW,realign_domain)(pw, exp); |
337 | 9.35k | } |
338 | 56.7k | |
339 | 56.7k | isl_space_free(model); |
340 | 56.7k | return pw; |
341 | 56.7k | error: |
342 | 0 | isl_space_free(model); |
343 | 0 | FN(PW,free)(pw); |
344 | 0 | return NULL; |
345 | 56.7k | } Line | Count | Source | 314 | 36.5k | { | 315 | 36.5k | isl_ctx *ctx; | 316 | 36.5k | isl_bool equal_params; | 317 | 36.5k | | 318 | 36.5k | if (!pw || !model) | 319 | 0 | goto error; | 320 | 36.5k | | 321 | 36.5k | ctx = isl_space_get_ctx(model); | 322 | 36.5k | if (!isl_space_has_named_params(model)) | 323 | 36.5k | isl_die0 (ctx, isl_error_invalid, | 324 | 36.5k | "model has unnamed parameters", goto error); | 325 | 36.5k | if (FN(PW,check_named_params)(pw) < 0) | 326 | 0 | goto error; | 327 | 36.5k | equal_params = isl_space_has_equal_params(pw->dim, model); | 328 | 36.5k | if (equal_params < 0) | 329 | 0 | goto error; | 330 | 36.5k | if (!equal_params) { | 331 | 9.35k | isl_reordering *exp; | 332 | 9.35k | | 333 | 9.35k | exp = isl_parameter_alignment_reordering(pw->dim, model); | 334 | 9.35k | exp = isl_reordering_extend_space(exp, | 335 | 9.35k | FN(PW,get_domain_space)(pw)); | 336 | 9.35k | pw = FN(PW,realign_domain)(pw, exp); | 337 | 9.35k | } | 338 | 36.5k | | 339 | 36.5k | isl_space_free(model); | 340 | 36.5k | return pw; | 341 | 36.5k | error: | 342 | 0 | isl_space_free(model); | 343 | 0 | FN(PW,free)(pw); | 344 | 0 | return NULL; | 345 | 36.5k | } |
isl_pw_multi_aff_align_params Line | Count | Source | 314 | 20.1k | { | 315 | 20.1k | isl_ctx *ctx; | 316 | 20.1k | isl_bool equal_params; | 317 | 20.1k | | 318 | 20.1k | if (!pw || !model) | 319 | 0 | goto error; | 320 | 20.1k | | 321 | 20.1k | ctx = isl_space_get_ctx(model); | 322 | 20.1k | if (!isl_space_has_named_params(model)) | 323 | 20.1k | isl_die0 (ctx, isl_error_invalid, | 324 | 20.1k | "model has unnamed parameters", goto error); | 325 | 20.1k | if (FN(PW,check_named_params)(pw) < 0) | 326 | 0 | goto error; | 327 | 20.1k | equal_params = isl_space_has_equal_params(pw->dim, model); | 328 | 20.1k | if (equal_params < 0) | 329 | 0 | goto error; | 330 | 20.1k | if (!equal_params) { | 331 | 5 | isl_reordering *exp; | 332 | 5 | | 333 | 5 | exp = isl_parameter_alignment_reordering(pw->dim, model); | 334 | 5 | exp = isl_reordering_extend_space(exp, | 335 | 5 | FN(PW,get_domain_space)(pw)); | 336 | 5 | pw = FN(PW,realign_domain)(pw, exp); | 337 | 5 | } | 338 | 20.1k | | 339 | 20.1k | isl_space_free(model); | 340 | 20.1k | return pw; | 341 | 20.1k | error: | 342 | 0 | isl_space_free(model); | 343 | 0 | FN(PW,free)(pw); | 344 | 0 | return NULL; | 345 | 20.1k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_align_params isl_pw_qpolynomial_align_params Line | Count | Source | 314 | 5 | { | 315 | 5 | isl_ctx *ctx; | 316 | 5 | isl_bool equal_params; | 317 | 5 | | 318 | 5 | if (!pw || !model) | 319 | 0 | goto error; | 320 | 5 | | 321 | 5 | ctx = isl_space_get_ctx(model); | 322 | 5 | if (!isl_space_has_named_params(model)) | 323 | 5 | isl_die0 (ctx, isl_error_invalid, | 324 | 5 | "model has unnamed parameters", goto error); | 325 | 5 | if (FN(PW,check_named_params)(pw) < 0) | 326 | 0 | goto error; | 327 | 5 | equal_params = isl_space_has_equal_params(pw->dim, model); | 328 | 5 | if (equal_params < 0) | 329 | 0 | goto error; | 330 | 5 | if (!equal_params) { | 331 | 0 | isl_reordering *exp; | 332 | 0 |
| 333 | 0 | exp = isl_parameter_alignment_reordering(pw->dim, model); | 334 | 0 | exp = isl_reordering_extend_space(exp, | 335 | 0 | FN(PW,get_domain_space)(pw)); | 336 | 0 | pw = FN(PW,realign_domain)(pw, exp); | 337 | 0 | } | 338 | 5 | | 339 | 5 | isl_space_free(model); | 340 | 5 | return pw; | 341 | 5 | error: | 342 | 0 | isl_space_free(model); | 343 | 0 | FN(PW,free)(pw); | 344 | 0 | return NULL; | 345 | 5 | } |
|
346 | | |
347 | | static __isl_give PW *FN(PW,align_params_pw_pw_and)(__isl_take PW *pw1, |
348 | | __isl_take PW *pw2, |
349 | | __isl_give PW *(*fn)(__isl_take PW *pw1, __isl_take PW *pw2)) |
350 | 89.8k | { |
351 | 89.8k | isl_bool equal_params; |
352 | 89.8k | |
353 | 89.8k | if (!pw1 || !pw289.8k ) |
354 | 3 | goto error; |
355 | 89.8k | equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim); |
356 | 89.8k | if (equal_params < 0) |
357 | 0 | goto error; |
358 | 89.8k | if (equal_params) |
359 | 86.2k | return fn(pw1, pw2); |
360 | 3.59k | if (FN(PW,check_named_params)(pw1) < 0 || |
361 | 3.59k | FN(PW,check_named_params)(pw2) < 0) |
362 | 0 | goto error; |
363 | 3.59k | pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2)); |
364 | 3.59k | pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1)); |
365 | 3.59k | return fn(pw1, pw2); |
366 | 3.59k | error: |
367 | 3 | FN(PW,free)(pw1); |
368 | 3 | FN(PW,free)(pw2); |
369 | 3 | return NULL; |
370 | 3.59k | } isl_aff.c:isl_pw_aff_align_params_pw_pw_and Line | Count | Source | 350 | 83.4k | { | 351 | 83.4k | isl_bool equal_params; | 352 | 83.4k | | 353 | 83.4k | if (!pw1 || !pw283.4k ) | 354 | 3 | goto error; | 355 | 83.4k | equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim); | 356 | 83.4k | if (equal_params < 0) | 357 | 0 | goto error; | 358 | 83.4k | if (equal_params) | 359 | 79.8k | return fn(pw1, pw2); | 360 | 3.59k | if (FN(PW,check_named_params)(pw1) < 0 || | 361 | 3.59k | FN(PW,check_named_params)(pw2) < 0) | 362 | 0 | goto error; | 363 | 3.59k | pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2)); | 364 | 3.59k | pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1)); | 365 | 3.59k | return fn(pw1, pw2); | 366 | 3.59k | error: | 367 | 3 | FN(PW,free)(pw1); | 368 | 3 | FN(PW,free)(pw2); | 369 | 3 | return NULL; | 370 | 3.59k | } |
isl_aff.c:isl_pw_multi_aff_align_params_pw_pw_and Line | Count | Source | 350 | 6.37k | { | 351 | 6.37k | isl_bool equal_params; | 352 | 6.37k | | 353 | 6.37k | if (!pw1 || !pw2) | 354 | 0 | goto error; | 355 | 6.37k | equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim); | 356 | 6.37k | if (equal_params < 0) | 357 | 0 | goto error; | 358 | 6.37k | if (equal_params) | 359 | 6.37k | return fn(pw1, pw2); | 360 | 0 | if (FN(PW,check_named_params)(pw1) < 0 || | 361 | 0 | FN(PW,check_named_params)(pw2) < 0) | 362 | 0 | goto error; | 363 | 0 | pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2)); | 364 | 0 | pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1)); | 365 | 0 | return fn(pw1, pw2); | 366 | 0 | error: | 367 | 0 | FN(PW,free)(pw1); | 368 | 0 | FN(PW,free)(pw2); | 369 | 0 | return NULL; | 370 | 0 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_pw_and isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_pw_and Line | Count | Source | 350 | 26 | { | 351 | 26 | isl_bool equal_params; | 352 | 26 | | 353 | 26 | if (!pw1 || !pw2) | 354 | 0 | goto error; | 355 | 26 | equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim); | 356 | 26 | if (equal_params < 0) | 357 | 0 | goto error; | 358 | 26 | if (equal_params) | 359 | 26 | return fn(pw1, pw2); | 360 | 0 | if (FN(PW,check_named_params)(pw1) < 0 || | 361 | 0 | FN(PW,check_named_params)(pw2) < 0) | 362 | 0 | goto error; | 363 | 0 | pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2)); | 364 | 0 | pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1)); | 365 | 0 | return fn(pw1, pw2); | 366 | 0 | error: | 367 | 0 | FN(PW,free)(pw1); | 368 | 0 | FN(PW,free)(pw2); | 369 | 0 | return NULL; | 370 | 0 | } |
|
371 | | |
372 | | static __isl_give PW *FN(PW,align_params_pw_set_and)(__isl_take PW *pw, |
373 | | __isl_take isl_set *set, |
374 | | __isl_give PW *(*fn)(__isl_take PW *pw, __isl_take isl_set *set)) |
375 | 59.2k | { |
376 | 59.2k | isl_ctx *ctx; |
377 | 59.2k | isl_bool aligned; |
378 | 59.2k | |
379 | 59.2k | if (!pw || !set) |
380 | 0 | goto error; |
381 | 59.2k | aligned = isl_set_space_has_equal_params(set, pw->dim); |
382 | 59.2k | if (aligned < 0) |
383 | 0 | goto error; |
384 | 59.2k | if (aligned) |
385 | 59.2k | return fn(pw, set); |
386 | 2 | ctx = FN(PW,get_ctx)(pw); |
387 | 2 | if (FN(PW,check_named_params)(pw) < 0) |
388 | 0 | goto error; |
389 | 2 | if (!isl_space_has_named_params(set->dim)) |
390 | 2 | isl_die0 (ctx, isl_error_invalid, |
391 | 2 | "unaligned unnamed parameters", goto error); |
392 | 2 | pw = FN(PW,align_params)(pw, isl_set_get_space(set)); |
393 | 2 | set = isl_set_align_params(set, FN(PW,get_space)(pw)); |
394 | 2 | return fn(pw, set); |
395 | 2 | error: |
396 | 0 | FN(PW,free)(pw); |
397 | 0 | isl_set_free(set); |
398 | 0 | return NULL; |
399 | 2 | } isl_aff.c:isl_pw_aff_align_params_pw_set_and Line | Count | Source | 375 | 53.8k | { | 376 | 53.8k | isl_ctx *ctx; | 377 | 53.8k | isl_bool aligned; | 378 | 53.8k | | 379 | 53.8k | if (!pw || !set) | 380 | 0 | goto error; | 381 | 53.8k | aligned = isl_set_space_has_equal_params(set, pw->dim); | 382 | 53.8k | if (aligned < 0) | 383 | 0 | goto error; | 384 | 53.8k | if (aligned) | 385 | 53.8k | return fn(pw, set); | 386 | 2 | ctx = FN(PW,get_ctx)(pw); | 387 | 2 | if (FN(PW,check_named_params)(pw) < 0) | 388 | 0 | goto error; | 389 | 2 | if (!isl_space_has_named_params(set->dim)) | 390 | 2 | isl_die0 (ctx, isl_error_invalid, | 391 | 2 | "unaligned unnamed parameters", goto error); | 392 | 2 | pw = FN(PW,align_params)(pw, isl_set_get_space(set)); | 393 | 2 | set = isl_set_align_params(set, FN(PW,get_space)(pw)); | 394 | 2 | return fn(pw, set); | 395 | 2 | error: | 396 | 0 | FN(PW,free)(pw); | 397 | 0 | isl_set_free(set); | 398 | 0 | return NULL; | 399 | 2 | } |
isl_aff.c:isl_pw_multi_aff_align_params_pw_set_and Line | Count | Source | 375 | 5.36k | { | 376 | 5.36k | isl_ctx *ctx; | 377 | 5.36k | isl_bool aligned; | 378 | 5.36k | | 379 | 5.36k | if (!pw || !set) | 380 | 0 | goto error; | 381 | 5.36k | aligned = isl_set_space_has_equal_params(set, pw->dim); | 382 | 5.36k | if (aligned < 0) | 383 | 0 | goto error; | 384 | 5.36k | if (aligned) | 385 | 5.36k | return fn(pw, set); | 386 | 0 | ctx = FN(PW,get_ctx)(pw); | 387 | 0 | if (FN(PW,check_named_params)(pw) < 0) | 388 | 0 | goto error; | 389 | 0 | if (!isl_space_has_named_params(set->dim)) | 390 | 0 | isl_die(ctx, isl_error_invalid, | 391 | 0 | "unaligned unnamed parameters", goto error); | 392 | 0 | pw = FN(PW,align_params)(pw, isl_set_get_space(set)); | 393 | 0 | set = isl_set_align_params(set, FN(PW,get_space)(pw)); | 394 | 0 | return fn(pw, set); | 395 | 0 | error: | 396 | 0 | FN(PW,free)(pw); | 397 | 0 | isl_set_free(set); | 398 | 0 | return NULL; | 399 | 0 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_set_and isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_set_and Line | Count | Source | 375 | 39 | { | 376 | 39 | isl_ctx *ctx; | 377 | 39 | isl_bool aligned; | 378 | 39 | | 379 | 39 | if (!pw || !set) | 380 | 0 | goto error; | 381 | 39 | aligned = isl_set_space_has_equal_params(set, pw->dim); | 382 | 39 | if (aligned < 0) | 383 | 0 | goto error; | 384 | 39 | if (aligned) | 385 | 39 | return fn(pw, set); | 386 | 0 | ctx = FN(PW,get_ctx)(pw); | 387 | 0 | if (FN(PW,check_named_params)(pw) < 0) | 388 | 0 | goto error; | 389 | 0 | if (!isl_space_has_named_params(set->dim)) | 390 | 0 | isl_die(ctx, isl_error_invalid, | 391 | 0 | "unaligned unnamed parameters", goto error); | 392 | 0 | pw = FN(PW,align_params)(pw, isl_set_get_space(set)); | 393 | 0 | set = isl_set_align_params(set, FN(PW,get_space)(pw)); | 394 | 0 | return fn(pw, set); | 395 | 0 | error: | 396 | 0 | FN(PW,free)(pw); | 397 | 0 | isl_set_free(set); | 398 | 0 | return NULL; | 399 | 0 | } |
|
400 | | #endif |
401 | | |
402 | | static __isl_give PW *FN(PW,union_add_aligned)(__isl_take PW *pw1, |
403 | | __isl_take PW *pw2) |
404 | 3.87k | { |
405 | 3.87k | int i, j, n; |
406 | 3.87k | struct PW *res; |
407 | 3.87k | isl_ctx *ctx; |
408 | 3.87k | isl_set *set; |
409 | 3.87k | |
410 | 3.87k | if (!pw1 || !pw2) |
411 | 0 | goto error; |
412 | 3.87k | |
413 | 3.87k | ctx = isl_space_get_ctx(pw1->dim); |
414 | | #ifdef HAS_TYPE |
415 | 0 | if (pw1->type != pw2->type) |
416 | 0 | isl_die(ctx, isl_error_invalid, |
417 | | "fold types don't match", goto error); |
418 | | #endif |
419 | 3.87k | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); |
420 | 0 |
|
421 | 3.87k | if (FN(PW,IS_ZERO)(pw1)) { |
422 | 3.52k | FN(PW,free)(pw1); |
423 | 3.52k | return pw2; |
424 | 3.52k | } |
425 | 348 | |
426 | 348 | if (FN(PW,IS_ZERO)(pw2)) { |
427 | 191 | FN(PW,free)(pw2); |
428 | 191 | return pw1; |
429 | 191 | } |
430 | 157 | |
431 | 157 | n = (pw1->n + 1) * (pw2->n + 1); |
432 | | #ifdef HAS_TYPE |
433 | 0 | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n); |
434 | | #else |
435 | 157 | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n); |
436 | | #endif |
437 | | |
438 | 349 | for (i = 0; i < pw1->n; ++i192 ) { |
439 | 192 | set = isl_set_copy(pw1->p[i].set); |
440 | 386 | for (j = 0; j < pw2->n; ++j194 ) { |
441 | 194 | struct isl_set *common; |
442 | 194 | EL *sum; |
443 | 194 | common = isl_set_intersect(isl_set_copy(pw1->p[i].set), |
444 | 194 | isl_set_copy(pw2->p[j].set)); |
445 | 194 | if (isl_set_plain_is_empty(common)) { |
446 | 168 | isl_set_free(common); |
447 | 168 | continue; |
448 | 168 | } |
449 | 26 | set = isl_set_subtract(set, |
450 | 26 | isl_set_copy(pw2->p[j].set)); |
451 | 26 | |
452 | 26 | sum = FN(EL,add_on_domain)(common, |
453 | 26 | FN(EL,copy)(pw1->p[i].FIELD), |
454 | 26 | FN(EL,copy)(pw2->p[j].FIELD)); |
455 | 26 | |
456 | 26 | res = FN(PW,add_piece)(res, common, sum); |
457 | 26 | } |
458 | 192 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD)); |
459 | 192 | } |
460 | 157 | |
461 | 315 | for (j = 0; j < pw2->n; ++j158 ) { |
462 | 158 | set = isl_set_copy(pw2->p[j].set); |
463 | 352 | for (i = 0; i < pw1->n; ++i194 ) |
464 | 194 | set = isl_set_subtract(set, |
465 | 194 | isl_set_copy(pw1->p[i].set)); |
466 | 158 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD)); |
467 | 158 | } |
468 | 157 | |
469 | 157 | FN(PW,free)(pw1); |
470 | 157 | FN(PW,free)(pw2); |
471 | 157 | |
472 | 157 | return res; |
473 | 157 | error: |
474 | 0 | FN(PW,free)(pw1); |
475 | 0 | FN(PW,free)(pw2); |
476 | 0 | return NULL; |
477 | 157 | } isl_aff.c:isl_pw_aff_union_add_aligned Line | Count | Source | 404 | 3.45k | { | 405 | 3.45k | int i, j, n; | 406 | 3.45k | struct PW *res; | 407 | 3.45k | isl_ctx *ctx; | 408 | 3.45k | isl_set *set; | 409 | 3.45k | | 410 | 3.45k | if (!pw1 || !pw2) | 411 | 0 | goto error; | 412 | 3.45k | | 413 | 3.45k | ctx = isl_space_get_ctx(pw1->dim); | 414 | | #ifdef HAS_TYPE | 415 | | if (pw1->type != pw2->type) | 416 | | isl_die(ctx, isl_error_invalid, | 417 | | "fold types don't match", goto error); | 418 | | #endif | 419 | 3.45k | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); | 420 | 3.45k | | 421 | 3.45k | if (FN(PW,IS_ZERO)(pw1)) { | 422 | 3.37k | FN(PW,free)(pw1); | 423 | 3.37k | return pw2; | 424 | 3.37k | } | 425 | 84 | | 426 | 84 | if (FN(PW,IS_ZERO)(pw2)) { | 427 | 0 | FN(PW,free)(pw2); | 428 | 0 | return pw1; | 429 | 0 | } | 430 | 84 | | 431 | 84 | n = (pw1->n + 1) * (pw2->n + 1); | 432 | | #ifdef HAS_TYPE | 433 | | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n); | 434 | | #else | 435 | 84 | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n); | 436 | 84 | #endif | 437 | 84 | | 438 | 169 | for (i = 0; i < pw1->n; ++i85 ) { | 439 | 85 | set = isl_set_copy(pw1->p[i].set); | 440 | 170 | for (j = 0; j < pw2->n; ++j85 ) { | 441 | 85 | struct isl_set *common; | 442 | 85 | EL *sum; | 443 | 85 | common = isl_set_intersect(isl_set_copy(pw1->p[i].set), | 444 | 85 | isl_set_copy(pw2->p[j].set)); | 445 | 85 | if (isl_set_plain_is_empty(common)) { | 446 | 83 | isl_set_free(common); | 447 | 83 | continue; | 448 | 83 | } | 449 | 2 | set = isl_set_subtract(set, | 450 | 2 | isl_set_copy(pw2->p[j].set)); | 451 | 2 | | 452 | 2 | sum = FN(EL,add_on_domain)(common, | 453 | 2 | FN(EL,copy)(pw1->p[i].FIELD), | 454 | 2 | FN(EL,copy)(pw2->p[j].FIELD)); | 455 | 2 | | 456 | 2 | res = FN(PW,add_piece)(res, common, sum); | 457 | 2 | } | 458 | 85 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD)); | 459 | 85 | } | 460 | 84 | | 461 | 168 | for (j = 0; j < pw2->n; ++j84 ) { | 462 | 84 | set = isl_set_copy(pw2->p[j].set); | 463 | 169 | for (i = 0; i < pw1->n; ++i85 ) | 464 | 85 | set = isl_set_subtract(set, | 465 | 85 | isl_set_copy(pw1->p[i].set)); | 466 | 84 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD)); | 467 | 84 | } | 468 | 84 | | 469 | 84 | FN(PW,free)(pw1); | 470 | 84 | FN(PW,free)(pw2); | 471 | 84 | | 472 | 84 | return res; | 473 | 84 | error: | 474 | 0 | FN(PW,free)(pw1); | 475 | 0 | FN(PW,free)(pw2); | 476 | 0 | return NULL; | 477 | 84 | } |
isl_aff.c:isl_pw_multi_aff_union_add_aligned Line | Count | Source | 404 | 388 | { | 405 | 388 | int i, j, n; | 406 | 388 | struct PW *res; | 407 | 388 | isl_ctx *ctx; | 408 | 388 | isl_set *set; | 409 | 388 | | 410 | 388 | if (!pw1 || !pw2) | 411 | 0 | goto error; | 412 | 388 | | 413 | 388 | ctx = isl_space_get_ctx(pw1->dim); | 414 | | #ifdef HAS_TYPE | 415 | | if (pw1->type != pw2->type) | 416 | | isl_die(ctx, isl_error_invalid, | 417 | | "fold types don't match", goto error); | 418 | | #endif | 419 | 388 | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); | 420 | 388 | | 421 | 388 | if (FN(PW,IS_ZERO)(pw1)) { | 422 | 148 | FN(PW,free)(pw1); | 423 | 148 | return pw2; | 424 | 148 | } | 425 | 240 | | 426 | 240 | if (FN(PW,IS_ZERO)(pw2)) { | 427 | 191 | FN(PW,free)(pw2); | 428 | 191 | return pw1; | 429 | 191 | } | 430 | 49 | | 431 | 49 | n = (pw1->n + 1) * (pw2->n + 1); | 432 | | #ifdef HAS_TYPE | 433 | | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n); | 434 | | #else | 435 | 49 | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n); | 436 | 49 | #endif | 437 | 49 | | 438 | 131 | for (i = 0; i < pw1->n; ++i82 ) { | 439 | 82 | set = isl_set_copy(pw1->p[i].set); | 440 | 164 | for (j = 0; j < pw2->n; ++j82 ) { | 441 | 82 | struct isl_set *common; | 442 | 82 | EL *sum; | 443 | 82 | common = isl_set_intersect(isl_set_copy(pw1->p[i].set), | 444 | 82 | isl_set_copy(pw2->p[j].set)); | 445 | 82 | if (isl_set_plain_is_empty(common)) { | 446 | 80 | isl_set_free(common); | 447 | 80 | continue; | 448 | 80 | } | 449 | 2 | set = isl_set_subtract(set, | 450 | 2 | isl_set_copy(pw2->p[j].set)); | 451 | 2 | | 452 | 2 | sum = FN(EL,add_on_domain)(common, | 453 | 2 | FN(EL,copy)(pw1->p[i].FIELD), | 454 | 2 | FN(EL,copy)(pw2->p[j].FIELD)); | 455 | 2 | | 456 | 2 | res = FN(PW,add_piece)(res, common, sum); | 457 | 2 | } | 458 | 82 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD)); | 459 | 82 | } | 460 | 49 | | 461 | 98 | for (j = 0; j < pw2->n; ++j49 ) { | 462 | 49 | set = isl_set_copy(pw2->p[j].set); | 463 | 131 | for (i = 0; i < pw1->n; ++i82 ) | 464 | 82 | set = isl_set_subtract(set, | 465 | 82 | isl_set_copy(pw1->p[i].set)); | 466 | 49 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD)); | 467 | 49 | } | 468 | 49 | | 469 | 49 | FN(PW,free)(pw1); | 470 | 49 | FN(PW,free)(pw2); | 471 | 49 | | 472 | 49 | return res; | 473 | 49 | error: | 474 | 0 | FN(PW,free)(pw1); | 475 | 0 | FN(PW,free)(pw2); | 476 | 0 | return NULL; | 477 | 49 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_aligned isl_polynomial.c:isl_pw_qpolynomial_union_add_aligned Line | Count | Source | 404 | 24 | { | 405 | 24 | int i, j, n; | 406 | 24 | struct PW *res; | 407 | 24 | isl_ctx *ctx; | 408 | 24 | isl_set *set; | 409 | 24 | | 410 | 24 | if (!pw1 || !pw2) | 411 | 0 | goto error; | 412 | 24 | | 413 | 24 | ctx = isl_space_get_ctx(pw1->dim); | 414 | | #ifdef HAS_TYPE | 415 | | if (pw1->type != pw2->type) | 416 | | isl_die(ctx, isl_error_invalid, | 417 | | "fold types don't match", goto error); | 418 | | #endif | 419 | 24 | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); | 420 | 24 | | 421 | 24 | if (FN(PW,IS_ZERO)(pw1)) { | 422 | 0 | FN(PW,free)(pw1); | 423 | 0 | return pw2; | 424 | 0 | } | 425 | 24 | | 426 | 24 | if (FN(PW,IS_ZERO)(pw2)) { | 427 | 0 | FN(PW,free)(pw2); | 428 | 0 | return pw1; | 429 | 0 | } | 430 | 24 | | 431 | 24 | n = (pw1->n + 1) * (pw2->n + 1); | 432 | | #ifdef HAS_TYPE | 433 | | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n); | 434 | | #else | 435 | 24 | res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n); | 436 | 24 | #endif | 437 | 24 | | 438 | 49 | for (i = 0; i < pw1->n; ++i25 ) { | 439 | 25 | set = isl_set_copy(pw1->p[i].set); | 440 | 52 | for (j = 0; j < pw2->n; ++j27 ) { | 441 | 27 | struct isl_set *common; | 442 | 27 | EL *sum; | 443 | 27 | common = isl_set_intersect(isl_set_copy(pw1->p[i].set), | 444 | 27 | isl_set_copy(pw2->p[j].set)); | 445 | 27 | if (isl_set_plain_is_empty(common)) { | 446 | 5 | isl_set_free(common); | 447 | 5 | continue; | 448 | 5 | } | 449 | 22 | set = isl_set_subtract(set, | 450 | 22 | isl_set_copy(pw2->p[j].set)); | 451 | 22 | | 452 | 22 | sum = FN(EL,add_on_domain)(common, | 453 | 22 | FN(EL,copy)(pw1->p[i].FIELD), | 454 | 22 | FN(EL,copy)(pw2->p[j].FIELD)); | 455 | 22 | | 456 | 22 | res = FN(PW,add_piece)(res, common, sum); | 457 | 22 | } | 458 | 25 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD)); | 459 | 25 | } | 460 | 24 | | 461 | 49 | for (j = 0; j < pw2->n; ++j25 ) { | 462 | 25 | set = isl_set_copy(pw2->p[j].set); | 463 | 52 | for (i = 0; i < pw1->n; ++i27 ) | 464 | 27 | set = isl_set_subtract(set, | 465 | 27 | isl_set_copy(pw1->p[i].set)); | 466 | 25 | res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD)); | 467 | 25 | } | 468 | 24 | | 469 | 24 | FN(PW,free)(pw1); | 470 | 24 | FN(PW,free)(pw2); | 471 | 24 | | 472 | 24 | return res; | 473 | 24 | error: | 474 | 0 | FN(PW,free)(pw1); | 475 | 0 | FN(PW,free)(pw2); | 476 | 0 | return NULL; | 477 | 24 | } |
|
478 | | |
479 | | /* Private version of "union_add". For isl_pw_qpolynomial and |
480 | | * isl_pw_qpolynomial_fold, we prefer to simply call it "add". |
481 | | */ |
482 | | static __isl_give PW *FN(PW,union_add_)(__isl_take PW *pw1, __isl_take PW *pw2) |
483 | 3.87k | { |
484 | 3.87k | return FN(PW,align_params_pw_pw_and)(pw1, pw2, |
485 | 3.87k | &FN(PW,union_add_aligned)); |
486 | 3.87k | } isl_aff.c:isl_pw_aff_union_add_ Line | Count | Source | 483 | 3.45k | { | 484 | 3.45k | return FN(PW,align_params_pw_pw_and)(pw1, pw2, | 485 | 3.45k | &FN(PW,union_add_aligned)); | 486 | 3.45k | } |
isl_aff.c:isl_pw_multi_aff_union_add_ Line | Count | Source | 483 | 388 | { | 484 | 388 | return FN(PW,align_params_pw_pw_and)(pw1, pw2, | 485 | 388 | &FN(PW,union_add_aligned)); | 486 | 388 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_ isl_polynomial.c:isl_pw_qpolynomial_union_add_ Line | Count | Source | 483 | 24 | { | 484 | 24 | return FN(PW,align_params_pw_pw_and)(pw1, pw2, | 485 | 24 | &FN(PW,union_add_aligned)); | 486 | 24 | } |
|
487 | | |
488 | | /* Make sure "pw" has room for at least "n" more pieces. |
489 | | * |
490 | | * If there is only one reference to pw, we extend it in place. |
491 | | * Otherwise, we create a new PW and copy the pieces. |
492 | | */ |
493 | | static __isl_give PW *FN(PW,grow)(__isl_take PW *pw, int n) |
494 | 620 | { |
495 | 620 | int i; |
496 | 620 | isl_ctx *ctx; |
497 | 620 | PW *res; |
498 | 620 | |
499 | 620 | if (!pw) |
500 | 0 | return NULL; |
501 | 620 | if (pw->n + n <= pw->size) |
502 | 0 | return pw; |
503 | 620 | ctx = FN(PW,get_ctx)(pw); |
504 | 620 | n += pw->n; |
505 | 620 | if (pw->ref == 1) { |
506 | 620 | res = isl_realloc(ctx, pw, struct PW, |
507 | 620 | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); |
508 | 620 | if (!res) |
509 | 0 | return FN(PW,free)(pw); |
510 | 620 | res->size = n; |
511 | 620 | return res; |
512 | 620 | } |
513 | | #ifdef HAS_TYPE |
514 | 0 | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n); |
515 | | #else |
516 | 0 | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n); |
517 | | #endif |
518 | 0 | if (!res) |
519 | 0 | return FN(PW,free)(pw); |
520 | 0 | for (i = 0; i < pw->n; ++i) |
521 | 0 | res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set), |
522 | 0 | FN(EL,copy)(pw->p[i].FIELD)); |
523 | 0 | FN(PW,free)(pw); |
524 | 0 | return res; |
525 | 0 | } isl_aff.c:isl_pw_aff_grow Line | Count | Source | 494 | 387 | { | 495 | 387 | int i; | 496 | 387 | isl_ctx *ctx; | 497 | 387 | PW *res; | 498 | 387 | | 499 | 387 | if (!pw) | 500 | 0 | return NULL; | 501 | 387 | if (pw->n + n <= pw->size) | 502 | 0 | return pw; | 503 | 387 | ctx = FN(PW,get_ctx)(pw); | 504 | 387 | n += pw->n; | 505 | 387 | if (pw->ref == 1) { | 506 | 387 | res = isl_realloc(ctx, pw, struct PW, | 507 | 387 | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 508 | 387 | if (!res) | 509 | 0 | return FN(PW,free)(pw); | 510 | 387 | res->size = n; | 511 | 387 | return res; | 512 | 387 | } | 513 | | #ifdef HAS_TYPE | 514 | | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n); | 515 | | #else | 516 | 0 | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n); | 517 | 0 | #endif | 518 | 0 | if (!res) | 519 | 0 | return FN(PW,free)(pw); | 520 | 0 | for (i = 0; i < pw->n; ++i) | 521 | 0 | res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set), | 522 | 0 | FN(EL,copy)(pw->p[i].FIELD)); | 523 | 0 | FN(PW,free)(pw); | 524 | 0 | return res; | 525 | 0 | } |
isl_aff.c:isl_pw_multi_aff_grow Line | Count | Source | 494 | 232 | { | 495 | 232 | int i; | 496 | 232 | isl_ctx *ctx; | 497 | 232 | PW *res; | 498 | 232 | | 499 | 232 | if (!pw) | 500 | 0 | return NULL; | 501 | 232 | if (pw->n + n <= pw->size) | 502 | 0 | return pw; | 503 | 232 | ctx = FN(PW,get_ctx)(pw); | 504 | 232 | n += pw->n; | 505 | 232 | if (pw->ref == 1) { | 506 | 232 | res = isl_realloc(ctx, pw, struct PW, | 507 | 232 | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 508 | 232 | if (!res) | 509 | 0 | return FN(PW,free)(pw); | 510 | 232 | res->size = n; | 511 | 232 | return res; | 512 | 232 | } | 513 | | #ifdef HAS_TYPE | 514 | | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n); | 515 | | #else | 516 | 0 | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n); | 517 | 0 | #endif | 518 | 0 | if (!res) | 519 | 0 | return FN(PW,free)(pw); | 520 | 0 | for (i = 0; i < pw->n; ++i) | 521 | 0 | res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set), | 522 | 0 | FN(EL,copy)(pw->p[i].FIELD)); | 523 | 0 | FN(PW,free)(pw); | 524 | 0 | return res; | 525 | 0 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_grow isl_polynomial.c:isl_pw_qpolynomial_grow Line | Count | Source | 494 | 1 | { | 495 | 1 | int i; | 496 | 1 | isl_ctx *ctx; | 497 | 1 | PW *res; | 498 | 1 | | 499 | 1 | if (!pw) | 500 | 0 | return NULL; | 501 | 1 | if (pw->n + n <= pw->size) | 502 | 0 | return pw; | 503 | 1 | ctx = FN(PW,get_ctx)(pw); | 504 | 1 | n += pw->n; | 505 | 1 | if (pw->ref == 1) { | 506 | 1 | res = isl_realloc(ctx, pw, struct PW, | 507 | 1 | sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece))); | 508 | 1 | if (!res) | 509 | 0 | return FN(PW,free)(pw); | 510 | 1 | res->size = n; | 511 | 1 | return res; | 512 | 1 | } | 513 | | #ifdef HAS_TYPE | 514 | | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n); | 515 | | #else | 516 | 0 | res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n); | 517 | 0 | #endif | 518 | 0 | if (!res) | 519 | 0 | return FN(PW,free)(pw); | 520 | 0 | for (i = 0; i < pw->n; ++i) | 521 | 0 | res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set), | 522 | 0 | FN(EL,copy)(pw->p[i].FIELD)); | 523 | 0 | FN(PW,free)(pw); | 524 | 0 | return res; | 525 | 0 | } |
|
526 | | |
527 | | static __isl_give PW *FN(PW,add_disjoint_aligned)(__isl_take PW *pw1, |
528 | | __isl_take PW *pw2) |
529 | 9.00k | { |
530 | 9.00k | int i; |
531 | 9.00k | isl_ctx *ctx; |
532 | 9.00k | |
533 | 9.00k | if (!pw1 || !pw2) |
534 | 0 | goto error; |
535 | 9.00k | |
536 | 9.00k | if (pw1->size < pw1->n + pw2->n && pw1->n < pw2->n4.67k ) |
537 | 4.05k | return FN(PW,add_disjoint_aligned)(pw2, pw1); |
538 | 4.95k | |
539 | 4.95k | ctx = isl_space_get_ctx(pw1->dim); |
540 | | #ifdef HAS_TYPE |
541 | 0 | if (pw1->type != pw2->type) |
542 | 0 | isl_die(ctx, isl_error_invalid, |
543 | | "fold types don't match", goto error); |
544 | | #endif |
545 | 4.95k | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); |
546 | 0 |
|
547 | 4.95k | if (FN(PW,IS_ZERO)(pw1)) { |
548 | 239 | FN(PW,free)(pw1); |
549 | 239 | return pw2; |
550 | 239 | } |
551 | 4.71k | |
552 | 4.71k | if (FN(PW,IS_ZERO)(pw2)) { |
553 | 4.09k | FN(PW,free)(pw2); |
554 | 4.09k | return pw1; |
555 | 4.09k | } |
556 | 620 | |
557 | 620 | pw1 = FN(PW,grow)(pw1, pw2->n); |
558 | 620 | if (!pw1) |
559 | 0 | goto error; |
560 | 620 | |
561 | 1.24k | for (i = 0; 620 i < pw2->n; ++i622 ) |
562 | 622 | pw1 = FN(PW,add_piece)(pw1, |
563 | 622 | isl_set_copy(pw2->p[i].set), |
564 | 622 | FN(EL,copy)(pw2->p[i].FIELD)); |
565 | 620 | |
566 | 620 | FN(PW,free)(pw2); |
567 | 620 | |
568 | 620 | return pw1; |
569 | 620 | error: |
570 | 0 | FN(PW,free)(pw1); |
571 | 0 | FN(PW,free)(pw2); |
572 | 0 | return NULL; |
573 | 620 | } isl_aff.c:isl_pw_aff_add_disjoint_aligned Line | Count | Source | 529 | 675 | { | 530 | 675 | int i; | 531 | 675 | isl_ctx *ctx; | 532 | 675 | | 533 | 675 | if (!pw1 || !pw2) | 534 | 0 | goto error; | 535 | 675 | | 536 | 675 | if (pw1->size < pw1->n + pw2->n && pw1->n < pw2->n394 ) | 537 | 7 | return FN(PW,add_disjoint_aligned)(pw2, pw1); | 538 | 668 | | 539 | 668 | ctx = isl_space_get_ctx(pw1->dim); | 540 | | #ifdef HAS_TYPE | 541 | | if (pw1->type != pw2->type) | 542 | | isl_die(ctx, isl_error_invalid, | 543 | | "fold types don't match", goto error); | 544 | | #endif | 545 | 668 | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); | 546 | 668 | | 547 | 668 | if (FN(PW,IS_ZERO)(pw1)) { | 548 | 239 | FN(PW,free)(pw1); | 549 | 239 | return pw2; | 550 | 239 | } | 551 | 429 | | 552 | 429 | if (FN(PW,IS_ZERO)(pw2)) { | 553 | 42 | FN(PW,free)(pw2); | 554 | 42 | return pw1; | 555 | 42 | } | 556 | 387 | | 557 | 387 | pw1 = FN(PW,grow)(pw1, pw2->n); | 558 | 387 | if (!pw1) | 559 | 0 | goto error; | 560 | 387 | | 561 | 776 | for (i = 0; 387 i < pw2->n; ++i389 ) | 562 | 389 | pw1 = FN(PW,add_piece)(pw1, | 563 | 389 | isl_set_copy(pw2->p[i].set), | 564 | 389 | FN(EL,copy)(pw2->p[i].FIELD)); | 565 | 387 | | 566 | 387 | FN(PW,free)(pw2); | 567 | 387 | | 568 | 387 | return pw1; | 569 | 387 | error: | 570 | 0 | FN(PW,free)(pw1); | 571 | 0 | FN(PW,free)(pw2); | 572 | 0 | return NULL; | 573 | 387 | } |
isl_aff.c:isl_pw_multi_aff_add_disjoint_aligned Line | Count | Source | 529 | 8.32k | { | 530 | 8.32k | int i; | 531 | 8.32k | isl_ctx *ctx; | 532 | 8.32k | | 533 | 8.32k | if (!pw1 || !pw2) | 534 | 0 | goto error; | 535 | 8.32k | | 536 | 8.32k | if (pw1->size < pw1->n + pw2->n && pw1->n < pw2->n4.28k ) | 537 | 4.04k | return FN(PW,add_disjoint_aligned)(pw2, pw1); | 538 | 4.28k | | 539 | 4.28k | ctx = isl_space_get_ctx(pw1->dim); | 540 | | #ifdef HAS_TYPE | 541 | | if (pw1->type != pw2->type) | 542 | | isl_die(ctx, isl_error_invalid, | 543 | | "fold types don't match", goto error); | 544 | | #endif | 545 | 4.28k | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); | 546 | 4.28k | | 547 | 4.28k | if (FN(PW,IS_ZERO)(pw1)) { | 548 | 0 | FN(PW,free)(pw1); | 549 | 0 | return pw2; | 550 | 0 | } | 551 | 4.28k | | 552 | 4.28k | if (FN(PW,IS_ZERO)(pw2)) { | 553 | 4.04k | FN(PW,free)(pw2); | 554 | 4.04k | return pw1; | 555 | 4.04k | } | 556 | 232 | | 557 | 232 | pw1 = FN(PW,grow)(pw1, pw2->n); | 558 | 232 | if (!pw1) | 559 | 0 | goto error; | 560 | 232 | | 561 | 464 | for (i = 0; 232 i < pw2->n; ++i232 ) | 562 | 232 | pw1 = FN(PW,add_piece)(pw1, | 563 | 232 | isl_set_copy(pw2->p[i].set), | 564 | 232 | FN(EL,copy)(pw2->p[i].FIELD)); | 565 | 232 | | 566 | 232 | FN(PW,free)(pw2); | 567 | 232 | | 568 | 232 | return pw1; | 569 | 232 | error: | 570 | 0 | FN(PW,free)(pw1); | 571 | 0 | FN(PW,free)(pw2); | 572 | 0 | return NULL; | 573 | 232 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_add_disjoint_aligned isl_polynomial.c:isl_pw_qpolynomial_add_disjoint_aligned Line | Count | Source | 529 | 3 | { | 530 | 3 | int i; | 531 | 3 | isl_ctx *ctx; | 532 | 3 | | 533 | 3 | if (!pw1 || !pw2) | 534 | 0 | goto error; | 535 | 3 | | 536 | 3 | if (pw1->size < pw1->n + pw2->n && pw1->n < pw2->n2 ) | 537 | 1 | return FN(PW,add_disjoint_aligned)(pw2, pw1); | 538 | 2 | | 539 | 2 | ctx = isl_space_get_ctx(pw1->dim); | 540 | | #ifdef HAS_TYPE | 541 | | if (pw1->type != pw2->type) | 542 | | isl_die(ctx, isl_error_invalid, | 543 | | "fold types don't match", goto error); | 544 | | #endif | 545 | 2 | isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error); | 546 | 2 | | 547 | 2 | if (FN(PW,IS_ZERO)(pw1)) { | 548 | 0 | FN(PW,free)(pw1); | 549 | 0 | return pw2; | 550 | 0 | } | 551 | 2 | | 552 | 2 | if (FN(PW,IS_ZERO)(pw2)) { | 553 | 1 | FN(PW,free)(pw2); | 554 | 1 | return pw1; | 555 | 1 | } | 556 | 1 | | 557 | 1 | pw1 = FN(PW,grow)(pw1, pw2->n); | 558 | 1 | if (!pw1) | 559 | 0 | goto error; | 560 | 1 | | 561 | 2 | for (i = 0; 1 i < pw2->n; ++i1 ) | 562 | 1 | pw1 = FN(PW,add_piece)(pw1, | 563 | 1 | isl_set_copy(pw2->p[i].set), | 564 | 1 | FN(EL,copy)(pw2->p[i].FIELD)); | 565 | 1 | | 566 | 1 | FN(PW,free)(pw2); | 567 | 1 | | 568 | 1 | return pw1; | 569 | 1 | error: | 570 | 0 | FN(PW,free)(pw1); | 571 | 0 | FN(PW,free)(pw2); | 572 | 0 | return NULL; | 573 | 1 | } |
|
574 | | |
575 | | __isl_give PW *FN(PW,add_disjoint)(__isl_take PW *pw1, __isl_take PW *pw2) |
576 | 4.95k | { |
577 | 4.95k | return FN(PW,align_params_pw_pw_and)(pw1, pw2, |
578 | 4.95k | &FN(PW,add_disjoint_aligned)); |
579 | 4.95k | } Line | Count | Source | 576 | 668 | { | 577 | 668 | return FN(PW,align_params_pw_pw_and)(pw1, pw2, | 578 | 668 | &FN(PW,add_disjoint_aligned)); | 579 | 668 | } |
isl_pw_multi_aff_add_disjoint Line | Count | Source | 576 | 4.28k | { | 577 | 4.28k | return FN(PW,align_params_pw_pw_and)(pw1, pw2, | 578 | 4.28k | &FN(PW,add_disjoint_aligned)); | 579 | 4.28k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_add_disjoint isl_pw_qpolynomial_add_disjoint Line | Count | Source | 576 | 2 | { | 577 | 2 | return FN(PW,align_params_pw_pw_and)(pw1, pw2, | 578 | 2 | &FN(PW,add_disjoint_aligned)); | 579 | 2 | } |
|
580 | | |
581 | | /* This function is currently only used from isl_aff.c |
582 | | */ |
583 | | static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1, |
584 | | __isl_take PW *pw2, __isl_take isl_space *space, |
585 | | __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2)) |
586 | | __attribute__ ((unused)); |
587 | | |
588 | | /* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains. |
589 | | * The result of "fn" (and therefore also of this function) lives in "space". |
590 | | */ |
591 | | static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1, |
592 | | __isl_take PW *pw2, __isl_take isl_space *space, |
593 | | __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2)) |
594 | 79.0k | { |
595 | 79.0k | int i, j, n; |
596 | 79.0k | PW *res = NULL; |
597 | 79.0k | |
598 | 79.0k | if (!pw1 || !pw2) |
599 | 0 | goto error; |
600 | 79.0k | |
601 | 79.0k | n = pw1->n * pw2->n; |
602 | | #ifdef HAS_TYPE |
603 | | res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n); |
604 | | #else |
605 | 79.0k | res = FN(PW,alloc_size)(isl_space_copy(space), n); |
606 | 79.0k | #endif |
607 | 79.0k | |
608 | 160k | for (i = 0; i < pw1->n; ++i81.4k ) { |
609 | 166k | for (j = 0; j < pw2->n; ++j85.3k ) { |
610 | 85.3k | isl_set *common; |
611 | 85.3k | EL *res_ij; |
612 | 85.3k | int empty; |
613 | 85.3k | |
614 | 85.3k | common = isl_set_intersect( |
615 | 85.3k | isl_set_copy(pw1->p[i].set), |
616 | 85.3k | isl_set_copy(pw2->p[j].set)); |
617 | 85.3k | empty = isl_set_plain_is_empty(common); |
618 | 85.3k | if (empty < 0 || empty) { |
619 | 3.56k | isl_set_free(common); |
620 | 3.56k | if (empty < 0) |
621 | 0 | goto error; |
622 | 3.56k | continue; |
623 | 3.56k | } |
624 | 81.7k | |
625 | 81.7k | res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD), |
626 | 81.7k | FN(EL,copy)(pw2->p[j].FIELD)); |
627 | 81.7k | res_ij = FN(EL,gist)(res_ij, isl_set_copy(common)); |
628 | 81.7k | |
629 | 81.7k | res = FN(PW,add_piece)(res, common, res_ij); |
630 | 81.7k | } |
631 | 81.4k | } |
632 | 79.0k | |
633 | 79.0k | isl_space_free(space); |
634 | 79.0k | FN(PW,free)(pw1); |
635 | 79.0k | FN(PW,free)(pw2); |
636 | 79.0k | return res; |
637 | 79.0k | error: |
638 | 0 | isl_space_free(space); |
639 | 0 | FN(PW,free)(pw1); |
640 | 0 | FN(PW,free)(pw2); |
641 | 0 | FN(PW,free)(res); |
642 | 0 | return NULL; |
643 | 79.0k | } isl_aff.c:isl_pw_aff_on_shared_domain_in Line | Count | Source | 594 | 78.8k | { | 595 | 78.8k | int i, j, n; | 596 | 78.8k | PW *res = NULL; | 597 | 78.8k | | 598 | 78.8k | if (!pw1 || !pw2) | 599 | 0 | goto error; | 600 | 78.8k | | 601 | 78.8k | n = pw1->n * pw2->n; | 602 | | #ifdef HAS_TYPE | 603 | | res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n); | 604 | | #else | 605 | 78.8k | res = FN(PW,alloc_size)(isl_space_copy(space), n); | 606 | 78.8k | #endif | 607 | 78.8k | | 608 | 160k | for (i = 0; i < pw1->n; ++i81.2k ) { | 609 | 166k | for (j = 0; j < pw2->n; ++j85.0k ) { | 610 | 85.0k | isl_set *common; | 611 | 85.0k | EL *res_ij; | 612 | 85.0k | int empty; | 613 | 85.0k | | 614 | 85.0k | common = isl_set_intersect( | 615 | 85.0k | isl_set_copy(pw1->p[i].set), | 616 | 85.0k | isl_set_copy(pw2->p[j].set)); | 617 | 85.0k | empty = isl_set_plain_is_empty(common); | 618 | 85.0k | if (empty < 0 || empty) { | 619 | 3.56k | isl_set_free(common); | 620 | 3.56k | if (empty < 0) | 621 | 0 | goto error; | 622 | 3.56k | continue; | 623 | 3.56k | } | 624 | 81.5k | | 625 | 81.5k | res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD), | 626 | 81.5k | FN(EL,copy)(pw2->p[j].FIELD)); | 627 | 81.5k | res_ij = FN(EL,gist)(res_ij, isl_set_copy(common)); | 628 | 81.5k | | 629 | 81.5k | res = FN(PW,add_piece)(res, common, res_ij); | 630 | 81.5k | } | 631 | 81.2k | } | 632 | 78.8k | | 633 | 78.8k | isl_space_free(space); | 634 | 78.8k | FN(PW,free)(pw1); | 635 | 78.8k | FN(PW,free)(pw2); | 636 | 78.8k | return res; | 637 | 78.8k | error: | 638 | 0 | isl_space_free(space); | 639 | 0 | FN(PW,free)(pw1); | 640 | 0 | FN(PW,free)(pw2); | 641 | 0 | FN(PW,free)(res); | 642 | 0 | return NULL; | 643 | 78.8k | } |
isl_aff.c:isl_pw_multi_aff_on_shared_domain_in Line | Count | Source | 594 | 214 | { | 595 | 214 | int i, j, n; | 596 | 214 | PW *res = NULL; | 597 | 214 | | 598 | 214 | if (!pw1 || !pw2) | 599 | 0 | goto error; | 600 | 214 | | 601 | 214 | n = pw1->n * pw2->n; | 602 | | #ifdef HAS_TYPE | 603 | | res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n); | 604 | | #else | 605 | 214 | res = FN(PW,alloc_size)(isl_space_copy(space), n); | 606 | 214 | #endif | 607 | 214 | | 608 | 428 | for (i = 0; i < pw1->n; ++i214 ) { | 609 | 488 | for (j = 0; j < pw2->n; ++j274 ) { | 610 | 274 | isl_set *common; | 611 | 274 | EL *res_ij; | 612 | 274 | int empty; | 613 | 274 | | 614 | 274 | common = isl_set_intersect( | 615 | 274 | isl_set_copy(pw1->p[i].set), | 616 | 274 | isl_set_copy(pw2->p[j].set)); | 617 | 274 | empty = isl_set_plain_is_empty(common); | 618 | 274 | if (empty < 0 || empty) { | 619 | 0 | isl_set_free(common); | 620 | 0 | if (empty < 0) | 621 | 0 | goto error; | 622 | 0 | continue; | 623 | 0 | } | 624 | 274 | | 625 | 274 | res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD), | 626 | 274 | FN(EL,copy)(pw2->p[j].FIELD)); | 627 | 274 | res_ij = FN(EL,gist)(res_ij, isl_set_copy(common)); | 628 | 274 | | 629 | 274 | res = FN(PW,add_piece)(res, common, res_ij); | 630 | 274 | } | 631 | 214 | } | 632 | 214 | | 633 | 214 | isl_space_free(space); | 634 | 214 | FN(PW,free)(pw1); | 635 | 214 | FN(PW,free)(pw2); | 636 | 214 | return res; | 637 | 214 | error: | 638 | 0 | isl_space_free(space); | 639 | 0 | FN(PW,free)(pw1); | 640 | 0 | FN(PW,free)(pw2); | 641 | 0 | FN(PW,free)(res); | 642 | 0 | return NULL; | 643 | 214 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain_in Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain_in |
644 | | |
645 | | /* This function is currently only used from isl_aff.c |
646 | | */ |
647 | | static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1, |
648 | | __isl_take PW *pw2, |
649 | | __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2)) |
650 | | __attribute__ ((unused)); |
651 | | |
652 | | /* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains. |
653 | | * The result of "fn" is assumed to live in the same space as "pw1" and "pw2". |
654 | | */ |
655 | | static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1, |
656 | | __isl_take PW *pw2, |
657 | | __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2)) |
658 | 78.8k | { |
659 | 78.8k | isl_space *space; |
660 | 78.8k | |
661 | 78.8k | if (!pw1 || !pw2) |
662 | 0 | goto error; |
663 | 78.8k | |
664 | 78.8k | space = isl_space_copy(pw1->dim); |
665 | 78.8k | return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn); |
666 | 78.8k | error: |
667 | 0 | FN(PW,free)(pw1); |
668 | 0 | FN(PW,free)(pw2); |
669 | 0 | return NULL; |
670 | 78.8k | } isl_aff.c:isl_pw_aff_on_shared_domain Line | Count | Source | 658 | 78.8k | { | 659 | 78.8k | isl_space *space; | 660 | 78.8k | | 661 | 78.8k | if (!pw1 || !pw2) | 662 | 0 | goto error; | 663 | 78.8k | | 664 | 78.8k | space = isl_space_copy(pw1->dim); | 665 | 78.8k | return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn); | 666 | 78.8k | error: | 667 | 0 | FN(PW,free)(pw1); | 668 | 0 | FN(PW,free)(pw2); | 669 | 0 | return NULL; | 670 | 78.8k | } |
isl_aff.c:isl_pw_multi_aff_on_shared_domain Line | Count | Source | 658 | 1 | { | 659 | 1 | isl_space *space; | 660 | 1 | | 661 | 1 | if (!pw1 || !pw2) | 662 | 0 | goto error; | 663 | 1 | | 664 | 1 | space = isl_space_copy(pw1->dim); | 665 | 1 | return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn); | 666 | 1 | error: | 667 | 0 | FN(PW,free)(pw1); | 668 | 0 | FN(PW,free)(pw2); | 669 | 0 | return NULL; | 670 | 1 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain |
671 | | |
672 | | #ifndef NO_NEG |
673 | | __isl_give PW *FN(PW,neg)(__isl_take PW *pw) |
674 | 23.8k | { |
675 | 23.8k | int i; |
676 | 23.8k | |
677 | 23.8k | if (!pw) |
678 | 0 | return NULL; |
679 | 23.8k | |
680 | 23.8k | if (FN(PW,IS_ZERO)(pw)) |
681 | 1 | return pw; |
682 | 23.8k | |
683 | 23.8k | pw = FN(PW,cow)(pw); |
684 | 23.8k | if (!pw) |
685 | 0 | return NULL; |
686 | 23.8k | |
687 | 48.4k | for (i = 0; 23.8k i < pw->n; ++i24.6k ) { |
688 | 24.6k | pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD); |
689 | 24.6k | if (!pw->p[i].FIELD) |
690 | 24.6k | return 0 FN0 (PW,free)(pw); |
691 | 24.6k | } |
692 | 23.8k | |
693 | 23.8k | return pw; |
694 | 23.8k | } Line | Count | Source | 674 | 23.8k | { | 675 | 23.8k | int i; | 676 | 23.8k | | 677 | 23.8k | if (!pw) | 678 | 0 | return NULL; | 679 | 23.8k | | 680 | 23.8k | if (FN(PW,IS_ZERO)(pw)) | 681 | 1 | return pw; | 682 | 23.8k | | 683 | 23.8k | pw = FN(PW,cow)(pw); | 684 | 23.8k | if (!pw) | 685 | 0 | return NULL; | 686 | 23.8k | | 687 | 48.4k | for (i = 0; 23.8k i < pw->n; ++i24.5k ) { | 688 | 24.5k | pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD); | 689 | 24.5k | if (!pw->p[i].FIELD) | 690 | 24.5k | return 0 FN0 (PW,free)(pw); | 691 | 24.5k | } | 692 | 23.8k | | 693 | 23.8k | return pw; | 694 | 23.8k | } |
Unexecuted instantiation: isl_pw_multi_aff_neg Line | Count | Source | 674 | 11 | { | 675 | 11 | int i; | 676 | 11 | | 677 | 11 | if (!pw) | 678 | 0 | return NULL; | 679 | 11 | | 680 | 11 | if (FN(PW,IS_ZERO)(pw)) | 681 | 0 | return pw; | 682 | 11 | | 683 | 11 | pw = FN(PW,cow)(pw); | 684 | 11 | if (!pw) | 685 | 0 | return NULL; | 686 | 11 | | 687 | 23 | for (i = 0; 11 i < pw->n; ++i12 ) { | 688 | 12 | pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD); | 689 | 12 | if (!pw->p[i].FIELD) | 690 | 12 | return 0 FN0 (PW,free)(pw); | 691 | 12 | } | 692 | 11 | | 693 | 11 | return pw; | 694 | 11 | } |
|
695 | | #endif |
696 | | |
697 | | #ifndef NO_SUB |
698 | | __isl_give PW *FN(PW,sub)(__isl_take PW *pw1, __isl_take PW *pw2) |
699 | 6.80k | { |
700 | 6.80k | return FN(PW,add)(pw1, FN(PW,neg)(pw2)); |
701 | 6.80k | } Line | Count | Source | 699 | 6.79k | { | 700 | 6.79k | return FN(PW,add)(pw1, FN(PW,neg)(pw2)); | 701 | 6.79k | } |
Line | Count | Source | 699 | 9 | { | 700 | 9 | return FN(PW,add)(pw1, FN(PW,neg)(pw2)); | 701 | 9 | } |
|
702 | | #endif |
703 | | |
704 | | /* Return the parameter domain of "pw". |
705 | | */ |
706 | | __isl_give isl_set *FN(PW,params)(__isl_take PW *pw) |
707 | 0 | { |
708 | 0 | return isl_set_params(FN(PW,domain)(pw)); |
709 | 0 | } Unexecuted instantiation: isl_pw_aff_params Unexecuted instantiation: isl_pw_multi_aff_params Unexecuted instantiation: isl_pw_qpolynomial_fold_params Unexecuted instantiation: isl_pw_qpolynomial_params |
710 | | |
711 | | __isl_give isl_set *FN(PW,domain)(__isl_take PW *pw) |
712 | 55.9k | { |
713 | 55.9k | int i; |
714 | 55.9k | isl_set *dom; |
715 | 55.9k | |
716 | 55.9k | if (!pw) |
717 | 0 | return NULL; |
718 | 55.9k | |
719 | 55.9k | dom = isl_set_empty(FN(PW,get_domain_space)(pw)); |
720 | 113k | for (i = 0; i < pw->n; ++i57.5k ) |
721 | 57.5k | dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set)); |
722 | 55.9k | |
723 | 55.9k | FN(PW,free)(pw); |
724 | 55.9k | |
725 | 55.9k | return dom; |
726 | 55.9k | } Line | Count | Source | 712 | 54.9k | { | 713 | 54.9k | int i; | 714 | 54.9k | isl_set *dom; | 715 | 54.9k | | 716 | 54.9k | if (!pw) | 717 | 0 | return NULL; | 718 | 54.9k | | 719 | 54.9k | dom = isl_set_empty(FN(PW,get_domain_space)(pw)); | 720 | 111k | for (i = 0; i < pw->n; ++i56.5k ) | 721 | 56.5k | dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set)); | 722 | 54.9k | | 723 | 54.9k | FN(PW,free)(pw); | 724 | 54.9k | | 725 | 54.9k | return dom; | 726 | 54.9k | } |
Line | Count | Source | 712 | 1.02k | { | 713 | 1.02k | int i; | 714 | 1.02k | isl_set *dom; | 715 | 1.02k | | 716 | 1.02k | if (!pw) | 717 | 0 | return NULL; | 718 | 1.02k | | 719 | 1.02k | dom = isl_set_empty(FN(PW,get_domain_space)(pw)); | 720 | 2.07k | for (i = 0; i < pw->n; ++i1.05k ) | 721 | 1.05k | dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set)); | 722 | 1.02k | | 723 | 1.02k | FN(PW,free)(pw); | 724 | 1.02k | | 725 | 1.02k | return dom; | 726 | 1.02k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_domain isl_pw_qpolynomial_domain Line | Count | Source | 712 | 1 | { | 713 | 1 | int i; | 714 | 1 | isl_set *dom; | 715 | 1 | | 716 | 1 | if (!pw) | 717 | 0 | return NULL; | 718 | 1 | | 719 | 1 | dom = isl_set_empty(FN(PW,get_domain_space)(pw)); | 720 | 2 | for (i = 0; i < pw->n; ++i1 ) | 721 | 1 | dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set)); | 722 | 1 | | 723 | 1 | FN(PW,free)(pw); | 724 | 1 | | 725 | 1 | return dom; | 726 | 1 | } |
|
727 | | |
728 | | /* Exploit the equalities in the domain of piece "i" of "pw" |
729 | | * to simplify the associated function. |
730 | | * If the domain of piece "i" is empty, then remove it entirely, |
731 | | * replacing it with the final piece. |
732 | | */ |
733 | | static int FN(PW,exploit_equalities_and_remove_if_empty)(__isl_keep PW *pw, |
734 | | int i) |
735 | 46.2k | { |
736 | 46.2k | isl_basic_set *aff; |
737 | 46.2k | int empty = isl_set_plain_is_empty(pw->p[i].set); |
738 | 46.2k | |
739 | 46.2k | if (empty < 0) |
740 | 0 | return -1; |
741 | 46.2k | if (empty) { |
742 | 53 | isl_set_free(pw->p[i].set); |
743 | 53 | FN(EL,free)(pw->p[i].FIELD); |
744 | 53 | if (i != pw->n - 1) |
745 | 0 | pw->p[i] = pw->p[pw->n - 1]; |
746 | 53 | pw->n--; |
747 | 53 | |
748 | 53 | return 0; |
749 | 53 | } |
750 | 46.1k | |
751 | 46.1k | aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set)); |
752 | 46.1k | pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff); |
753 | 46.1k | if (!pw->p[i].FIELD) |
754 | 46.1k | return -10 ; |
755 | 46.1k | |
756 | 46.1k | return 0; |
757 | 46.1k | } isl_aff.c:isl_pw_aff_exploit_equalities_and_remove_if_empty Line | Count | Source | 735 | 43.0k | { | 736 | 43.0k | isl_basic_set *aff; | 737 | 43.0k | int empty = isl_set_plain_is_empty(pw->p[i].set); | 738 | 43.0k | | 739 | 43.0k | if (empty < 0) | 740 | 0 | return -1; | 741 | 43.0k | if (empty) { | 742 | 48 | isl_set_free(pw->p[i].set); | 743 | 48 | FN(EL,free)(pw->p[i].FIELD); | 744 | 48 | if (i != pw->n - 1) | 745 | 0 | pw->p[i] = pw->p[pw->n - 1]; | 746 | 48 | pw->n--; | 747 | 48 | | 748 | 48 | return 0; | 749 | 48 | } | 750 | 42.9k | | 751 | 42.9k | aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set)); | 752 | 42.9k | pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff); | 753 | 42.9k | if (!pw->p[i].FIELD) | 754 | 42.9k | return -10 ; | 755 | 42.9k | | 756 | 42.9k | return 0; | 757 | 42.9k | } |
isl_aff.c:isl_pw_multi_aff_exploit_equalities_and_remove_if_empty Line | Count | Source | 735 | 3.15k | { | 736 | 3.15k | isl_basic_set *aff; | 737 | 3.15k | int empty = isl_set_plain_is_empty(pw->p[i].set); | 738 | 3.15k | | 739 | 3.15k | if (empty < 0) | 740 | 0 | return -1; | 741 | 3.15k | if (empty) { | 742 | 5 | isl_set_free(pw->p[i].set); | 743 | 5 | FN(EL,free)(pw->p[i].FIELD); | 744 | 5 | if (i != pw->n - 1) | 745 | 0 | pw->p[i] = pw->p[pw->n - 1]; | 746 | 5 | pw->n--; | 747 | 5 | | 748 | 5 | return 0; | 749 | 5 | } | 750 | 3.15k | | 751 | 3.15k | aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set)); | 752 | 3.15k | pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff); | 753 | 3.15k | if (!pw->p[i].FIELD) | 754 | 3.15k | return -10 ; | 755 | 3.15k | | 756 | 3.15k | return 0; | 757 | 3.15k | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_exploit_equalities_and_remove_if_empty isl_polynomial.c:isl_pw_qpolynomial_exploit_equalities_and_remove_if_empty Line | Count | Source | 735 | 35 | { | 736 | 35 | isl_basic_set *aff; | 737 | 35 | int empty = isl_set_plain_is_empty(pw->p[i].set); | 738 | 35 | | 739 | 35 | if (empty < 0) | 740 | 0 | return -1; | 741 | 35 | if (empty) { | 742 | 0 | isl_set_free(pw->p[i].set); | 743 | 0 | FN(EL,free)(pw->p[i].FIELD); | 744 | 0 | if (i != pw->n - 1) | 745 | 0 | pw->p[i] = pw->p[pw->n - 1]; | 746 | 0 | pw->n--; | 747 | 0 |
| 748 | 0 | return 0; | 749 | 0 | } | 750 | 35 | | 751 | 35 | aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set)); | 752 | 35 | pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff); | 753 | 35 | if (!pw->p[i].FIELD) | 754 | 35 | return -10 ; | 755 | 35 | | 756 | 35 | return 0; | 757 | 35 | } |
|
758 | | |
759 | | /* Convert a piecewise expression defined over a parameter domain |
760 | | * into one that is defined over a zero-dimensional set. |
761 | | */ |
762 | | __isl_give PW *FN(PW,from_range)(__isl_take PW *pw) |
763 | 58 | { |
764 | 58 | isl_space *space; |
765 | 58 | |
766 | 58 | if (!pw) |
767 | 0 | return NULL; |
768 | 58 | if (!isl_space_is_set(pw->dim)) |
769 | 58 | isl_die0 (FN(PW,get_ctx)(pw), isl_error_invalid, |
770 | 58 | "not living in a set space", return FN(PW,free)(pw)); |
771 | 58 | |
772 | 58 | space = FN(PW,get_space)(pw); |
773 | 58 | space = isl_space_from_range(space); |
774 | 58 | pw = FN(PW,reset_space)(pw, space); |
775 | 58 | |
776 | 58 | return pw; |
777 | 58 | } Line | Count | Source | 763 | 58 | { | 764 | 58 | isl_space *space; | 765 | 58 | | 766 | 58 | if (!pw) | 767 | 0 | return NULL; | 768 | 58 | if (!isl_space_is_set(pw->dim)) | 769 | 58 | isl_die0 (FN(PW,get_ctx)(pw), isl_error_invalid, | 770 | 58 | "not living in a set space", return FN(PW,free)(pw)); | 771 | 58 | | 772 | 58 | space = FN(PW,get_space)(pw); | 773 | 58 | space = isl_space_from_range(space); | 774 | 58 | pw = FN(PW,reset_space)(pw, space); | 775 | 58 | | 776 | 58 | return pw; | 777 | 58 | } |
Unexecuted instantiation: isl_pw_multi_aff_from_range Unexecuted instantiation: isl_pw_qpolynomial_fold_from_range Unexecuted instantiation: isl_pw_qpolynomial_from_range |
778 | | |
779 | | /* Fix the value of the given parameter or domain dimension of "pw" |
780 | | * to be equal to "value". |
781 | | */ |
782 | | __isl_give PW *FN(PW,fix_si)(__isl_take PW *pw, enum isl_dim_type type, |
783 | | unsigned pos, int value) |
784 | 0 | { |
785 | 0 | int i; |
786 | 0 |
|
787 | 0 | if (!pw) |
788 | 0 | return NULL; |
789 | 0 | |
790 | 0 | if (type == isl_dim_out) |
791 | 0 | isl_die(FN(PW,get_ctx)(pw), isl_error_invalid, |
792 | 0 | "cannot fix output dimension", return FN(PW,free)(pw)); |
793 | 0 |
|
794 | 0 | if (pw->n == 0) |
795 | 0 | return pw; |
796 | 0 | |
797 | 0 | if (type == isl_dim_in) |
798 | 0 | type = isl_dim_set; |
799 | 0 |
|
800 | 0 | pw = FN(PW,cow)(pw); |
801 | 0 | if (!pw) |
802 | 0 | return FN(PW,free)(pw); |
803 | 0 |
|
804 | 0 | for (i = pw->n - 1; i >= 0; --i) { |
805 | 0 | pw->p[i].set = isl_set_fix_si(pw->p[i].set, type, pos, value); |
806 | 0 | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) |
807 | 0 | return FN(PW,free)(pw); |
808 | 0 | } |
809 | 0 |
|
810 | 0 | return pw; |
811 | 0 | } Unexecuted instantiation: isl_pw_aff_fix_si Unexecuted instantiation: isl_pw_multi_aff_fix_si Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_si Unexecuted instantiation: isl_pw_qpolynomial_fix_si |
812 | | |
813 | | /* Restrict the domain of "pw" by combining each cell |
814 | | * with "set" through a call to "fn", where "fn" may be |
815 | | * isl_set_intersect, isl_set_intersect_params or isl_set_subtract. |
816 | | */ |
817 | | static __isl_give PW *FN(PW,restrict_domain_aligned)(__isl_take PW *pw, |
818 | | __isl_take isl_set *set, |
819 | | __isl_give isl_set *(*fn)(__isl_take isl_set *set1, |
820 | | __isl_take isl_set *set2)) |
821 | 44.9k | { |
822 | 44.9k | int i; |
823 | 44.9k | |
824 | 44.9k | if (!pw || !set) |
825 | 0 | goto error; |
826 | 44.9k | |
827 | 44.9k | if (pw->n == 0) { |
828 | 4 | isl_set_free(set); |
829 | 4 | return pw; |
830 | 4 | } |
831 | 44.9k | |
832 | 44.9k | pw = FN(PW,cow)(pw); |
833 | 44.9k | if (!pw) |
834 | 0 | goto error; |
835 | 44.9k | |
836 | 91.1k | for (i = pw->n - 1; 44.9k i >= 0; --i46.2k ) { |
837 | 46.2k | pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set)); |
838 | 46.2k | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) |
839 | 0 | goto error; |
840 | 46.2k | } |
841 | 44.9k | |
842 | 44.9k | isl_set_free(set); |
843 | 44.9k | return pw; |
844 | 44.9k | error: |
845 | 0 | isl_set_free(set); |
846 | 0 | FN(PW,free)(pw); |
847 | 0 | return NULL; |
848 | 44.9k | } isl_aff.c:isl_pw_aff_restrict_domain_aligned Line | Count | Source | 821 | 41.7k | { | 822 | 41.7k | int i; | 823 | 41.7k | | 824 | 41.7k | if (!pw || !set) | 825 | 0 | goto error; | 826 | 41.7k | | 827 | 41.7k | if (pw->n == 0) { | 828 | 1 | isl_set_free(set); | 829 | 1 | return pw; | 830 | 1 | } | 831 | 41.7k | | 832 | 41.7k | pw = FN(PW,cow)(pw); | 833 | 41.7k | if (!pw) | 834 | 0 | goto error; | 835 | 41.7k | | 836 | 84.7k | for (i = pw->n - 1; 41.7k i >= 0; --i43.0k ) { | 837 | 43.0k | pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set)); | 838 | 43.0k | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) | 839 | 0 | goto error; | 840 | 43.0k | } | 841 | 41.7k | | 842 | 41.7k | isl_set_free(set); | 843 | 41.7k | return pw; | 844 | 41.7k | error: | 845 | 0 | isl_set_free(set); | 846 | 0 | FN(PW,free)(pw); | 847 | 0 | return NULL; | 848 | 41.7k | } |
isl_aff.c:isl_pw_multi_aff_restrict_domain_aligned Line | Count | Source | 821 | 3.12k | { | 822 | 3.12k | int i; | 823 | 3.12k | | 824 | 3.12k | if (!pw || !set) | 825 | 0 | goto error; | 826 | 3.12k | | 827 | 3.12k | if (pw->n == 0) { | 828 | 2 | isl_set_free(set); | 829 | 2 | return pw; | 830 | 2 | } | 831 | 3.12k | | 832 | 3.12k | pw = FN(PW,cow)(pw); | 833 | 3.12k | if (!pw) | 834 | 0 | goto error; | 835 | 3.12k | | 836 | 6.28k | for (i = pw->n - 1; 3.12k i >= 0; --i3.15k ) { | 837 | 3.15k | pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set)); | 838 | 3.15k | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) | 839 | 0 | goto error; | 840 | 3.15k | } | 841 | 3.12k | | 842 | 3.12k | isl_set_free(set); | 843 | 3.12k | return pw; | 844 | 3.12k | error: | 845 | 0 | isl_set_free(set); | 846 | 0 | FN(PW,free)(pw); | 847 | 0 | return NULL; | 848 | 3.12k | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_restrict_domain_aligned isl_polynomial.c:isl_pw_qpolynomial_restrict_domain_aligned Line | Count | Source | 821 | 35 | { | 822 | 35 | int i; | 823 | 35 | | 824 | 35 | if (!pw || !set) | 825 | 0 | goto error; | 826 | 35 | | 827 | 35 | if (pw->n == 0) { | 828 | 1 | isl_set_free(set); | 829 | 1 | return pw; | 830 | 1 | } | 831 | 34 | | 832 | 34 | pw = FN(PW,cow)(pw); | 833 | 34 | if (!pw) | 834 | 0 | goto error; | 835 | 34 | | 836 | 68 | for (i = pw->n - 1; 34 i >= 0; --i34 ) { | 837 | 34 | pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set)); | 838 | 34 | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) | 839 | 0 | goto error; | 840 | 34 | } | 841 | 34 | | 842 | 34 | isl_set_free(set); | 843 | 34 | return pw; | 844 | 34 | error: | 845 | 0 | isl_set_free(set); | 846 | 0 | FN(PW,free)(pw); | 847 | 0 | return NULL; | 848 | 34 | } |
|
849 | | |
850 | | static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw, |
851 | | __isl_take isl_set *set) |
852 | 38.5k | { |
853 | 38.5k | return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect); |
854 | 38.5k | } isl_aff.c:isl_pw_aff_intersect_domain_aligned Line | Count | Source | 852 | 36.0k | { | 853 | 36.0k | return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect); | 854 | 36.0k | } |
isl_aff.c:isl_pw_multi_aff_intersect_domain_aligned Line | Count | Source | 852 | 2.44k | { | 853 | 2.44k | return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect); | 854 | 2.44k | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_domain_aligned isl_polynomial.c:isl_pw_qpolynomial_intersect_domain_aligned Line | Count | Source | 852 | 35 | { | 853 | 35 | return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect); | 854 | 35 | } |
|
855 | | |
856 | | __isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw, |
857 | | __isl_take isl_set *context) |
858 | 38.5k | { |
859 | 38.5k | return FN(PW,align_params_pw_set_and)(pw, context, |
860 | 38.5k | &FN(PW,intersect_domain_aligned)); |
861 | 38.5k | } isl_pw_aff_intersect_domain Line | Count | Source | 858 | 36.0k | { | 859 | 36.0k | return FN(PW,align_params_pw_set_and)(pw, context, | 860 | 36.0k | &FN(PW,intersect_domain_aligned)); | 861 | 36.0k | } |
isl_pw_multi_aff_intersect_domain Line | Count | Source | 858 | 2.44k | { | 859 | 2.44k | return FN(PW,align_params_pw_set_and)(pw, context, | 860 | 2.44k | &FN(PW,intersect_domain_aligned)); | 861 | 2.44k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_domain isl_pw_qpolynomial_intersect_domain Line | Count | Source | 858 | 35 | { | 859 | 35 | return FN(PW,align_params_pw_set_and)(pw, context, | 860 | 35 | &FN(PW,intersect_domain_aligned)); | 861 | 35 | } |
|
862 | | |
863 | | static __isl_give PW *FN(PW,intersect_params_aligned)(__isl_take PW *pw, |
864 | | __isl_take isl_set *set) |
865 | 6.41k | { |
866 | 6.41k | return FN(PW,restrict_domain_aligned)(pw, set, |
867 | 6.41k | &isl_set_intersect_params); |
868 | 6.41k | } isl_aff.c:isl_pw_aff_intersect_params_aligned Line | Count | Source | 865 | 5.73k | { | 866 | 5.73k | return FN(PW,restrict_domain_aligned)(pw, set, | 867 | 5.73k | &isl_set_intersect_params); | 868 | 5.73k | } |
isl_aff.c:isl_pw_multi_aff_intersect_params_aligned Line | Count | Source | 865 | 686 | { | 866 | 686 | return FN(PW,restrict_domain_aligned)(pw, set, | 867 | 686 | &isl_set_intersect_params); | 868 | 686 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_params_aligned Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_intersect_params_aligned |
869 | | |
870 | | /* Intersect the domain of "pw" with the parameter domain "context". |
871 | | */ |
872 | | __isl_give PW *FN(PW,intersect_params)(__isl_take PW *pw, |
873 | | __isl_take isl_set *context) |
874 | 6.41k | { |
875 | 6.41k | return FN(PW,align_params_pw_set_and)(pw, context, |
876 | 6.41k | &FN(PW,intersect_params_aligned)); |
877 | 6.41k | } isl_pw_aff_intersect_params Line | Count | Source | 874 | 5.73k | { | 875 | 5.73k | return FN(PW,align_params_pw_set_and)(pw, context, | 876 | 5.73k | &FN(PW,intersect_params_aligned)); | 877 | 5.73k | } |
isl_pw_multi_aff_intersect_params Line | Count | Source | 874 | 686 | { | 875 | 686 | return FN(PW,align_params_pw_set_and)(pw, context, | 876 | 686 | &FN(PW,intersect_params_aligned)); | 877 | 686 | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_params Unexecuted instantiation: isl_pw_qpolynomial_intersect_params |
878 | | |
879 | | /* Subtract "domain' from the domain of "pw", assuming their |
880 | | * parameters have been aligned. |
881 | | */ |
882 | | static __isl_give PW *FN(PW,subtract_domain_aligned)(__isl_take PW *pw, |
883 | | __isl_take isl_set *domain) |
884 | 3 | { |
885 | 3 | return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract); |
886 | 3 | } Unexecuted instantiation: isl_aff.c:isl_pw_aff_subtract_domain_aligned isl_aff.c:isl_pw_multi_aff_subtract_domain_aligned Line | Count | Source | 884 | 3 | { | 885 | 3 | return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract); | 886 | 3 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_subtract_domain_aligned Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_subtract_domain_aligned |
887 | | |
888 | | /* Subtract "domain' from the domain of "pw". |
889 | | */ |
890 | | __isl_give PW *FN(PW,subtract_domain)(__isl_take PW *pw, |
891 | | __isl_take isl_set *domain) |
892 | 3 | { |
893 | 3 | return FN(PW,align_params_pw_set_and)(pw, domain, |
894 | 3 | &FN(PW,subtract_domain_aligned)); |
895 | 3 | } Unexecuted instantiation: isl_pw_aff_subtract_domain isl_pw_multi_aff_subtract_domain Line | Count | Source | 892 | 3 | { | 893 | 3 | return FN(PW,align_params_pw_set_and)(pw, domain, | 894 | 3 | &FN(PW,subtract_domain_aligned)); | 895 | 3 | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_subtract_domain Unexecuted instantiation: isl_pw_qpolynomial_subtract_domain |
896 | | |
897 | | /* Compute the gist of "pw" with respect to the domain constraints |
898 | | * of "context" for the case where the domain of the last element |
899 | | * of "pw" is equal to "context". |
900 | | * Call "fn_el" to compute the gist of this element, replace |
901 | | * its domain by the universe and drop all other elements |
902 | | * as their domains are necessarily disjoint from "context". |
903 | | */ |
904 | | static __isl_give PW *FN(PW,gist_last)(__isl_take PW *pw, |
905 | | __isl_take isl_set *context, |
906 | | __isl_give EL *(*fn_el)(__isl_take EL *el, __isl_take isl_set *set)) |
907 | 8.87k | { |
908 | 8.87k | int i; |
909 | 8.87k | isl_space *space; |
910 | 8.87k | |
911 | 8.87k | for (i = 0; i < pw->n - 1; ++i0 ) { |
912 | 0 | isl_set_free(pw->p[i].set); |
913 | 0 | FN(EL,free)(pw->p[i].FIELD); |
914 | 0 | } |
915 | 8.87k | pw->p[0].FIELD = pw->p[pw->n - 1].FIELD; |
916 | 8.87k | pw->p[0].set = pw->p[pw->n - 1].set; |
917 | 8.87k | pw->n = 1; |
918 | 8.87k | |
919 | 8.87k | space = isl_set_get_space(context); |
920 | 8.87k | pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context); |
921 | 8.87k | context = isl_set_universe(space); |
922 | 8.87k | isl_set_free(pw->p[0].set); |
923 | 8.87k | pw->p[0].set = context; |
924 | 8.87k | |
925 | 8.87k | if (!pw->p[0].FIELD || !pw->p[0].set) |
926 | 0 | return FN(PW,free)(pw); |
927 | 8.87k | |
928 | 8.87k | return pw; |
929 | 8.87k | } isl_aff.c:isl_pw_aff_gist_last Line | Count | Source | 907 | 8.12k | { | 908 | 8.12k | int i; | 909 | 8.12k | isl_space *space; | 910 | 8.12k | | 911 | 8.12k | for (i = 0; i < pw->n - 1; ++i0 ) { | 912 | 0 | isl_set_free(pw->p[i].set); | 913 | 0 | FN(EL,free)(pw->p[i].FIELD); | 914 | 0 | } | 915 | 8.12k | pw->p[0].FIELD = pw->p[pw->n - 1].FIELD; | 916 | 8.12k | pw->p[0].set = pw->p[pw->n - 1].set; | 917 | 8.12k | pw->n = 1; | 918 | 8.12k | | 919 | 8.12k | space = isl_set_get_space(context); | 920 | 8.12k | pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context); | 921 | 8.12k | context = isl_set_universe(space); | 922 | 8.12k | isl_set_free(pw->p[0].set); | 923 | 8.12k | pw->p[0].set = context; | 924 | 8.12k | | 925 | 8.12k | if (!pw->p[0].FIELD || !pw->p[0].set) | 926 | 0 | return FN(PW,free)(pw); | 927 | 8.12k | | 928 | 8.12k | return pw; | 929 | 8.12k | } |
isl_aff.c:isl_pw_multi_aff_gist_last Line | Count | Source | 907 | 754 | { | 908 | 754 | int i; | 909 | 754 | isl_space *space; | 910 | 754 | | 911 | 754 | for (i = 0; i < pw->n - 1; ++i0 ) { | 912 | 0 | isl_set_free(pw->p[i].set); | 913 | 0 | FN(EL,free)(pw->p[i].FIELD); | 914 | 0 | } | 915 | 754 | pw->p[0].FIELD = pw->p[pw->n - 1].FIELD; | 916 | 754 | pw->p[0].set = pw->p[pw->n - 1].set; | 917 | 754 | pw->n = 1; | 918 | 754 | | 919 | 754 | space = isl_set_get_space(context); | 920 | 754 | pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context); | 921 | 754 | context = isl_set_universe(space); | 922 | 754 | isl_set_free(pw->p[0].set); | 923 | 754 | pw->p[0].set = context; | 924 | 754 | | 925 | 754 | if (!pw->p[0].FIELD || !pw->p[0].set) | 926 | 0 | return FN(PW,free)(pw); | 927 | 754 | | 928 | 754 | return pw; | 929 | 754 | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_last isl_polynomial.c:isl_pw_qpolynomial_gist_last Line | Count | Source | 907 | 1 | { | 908 | 1 | int i; | 909 | 1 | isl_space *space; | 910 | 1 | | 911 | 1 | for (i = 0; i < pw->n - 1; ++i0 ) { | 912 | 0 | isl_set_free(pw->p[i].set); | 913 | 0 | FN(EL,free)(pw->p[i].FIELD); | 914 | 0 | } | 915 | 1 | pw->p[0].FIELD = pw->p[pw->n - 1].FIELD; | 916 | 1 | pw->p[0].set = pw->p[pw->n - 1].set; | 917 | 1 | pw->n = 1; | 918 | 1 | | 919 | 1 | space = isl_set_get_space(context); | 920 | 1 | pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context); | 921 | 1 | context = isl_set_universe(space); | 922 | 1 | isl_set_free(pw->p[0].set); | 923 | 1 | pw->p[0].set = context; | 924 | 1 | | 925 | 1 | if (!pw->p[0].FIELD || !pw->p[0].set) | 926 | 0 | return FN(PW,free)(pw); | 927 | 1 | | 928 | 1 | return pw; | 929 | 1 | } |
|
930 | | |
931 | | /* Compute the gist of "pw" with respect to the domain constraints |
932 | | * of "context". Call "fn_el" to compute the gist of the elements |
933 | | * and "fn_dom" to compute the gist of the domains. |
934 | | * |
935 | | * If the piecewise expression is empty or the context is the universe, |
936 | | * then nothing can be simplified. |
937 | | */ |
938 | | static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw, |
939 | | __isl_take isl_set *context, |
940 | | __isl_give EL *(*fn_el)(__isl_take EL *el, |
941 | | __isl_take isl_set *set), |
942 | | __isl_give isl_set *(*fn_dom)(__isl_take isl_set *set, |
943 | | __isl_take isl_basic_set *bset)) |
944 | 14.3k | { |
945 | 14.3k | int i; |
946 | 14.3k | int is_universe; |
947 | 14.3k | isl_bool aligned; |
948 | 14.3k | isl_basic_set *hull = NULL; |
949 | 14.3k | |
950 | 14.3k | if (!pw || !context) |
951 | 0 | goto error; |
952 | 14.3k | |
953 | 14.3k | if (pw->n == 0) { |
954 | 0 | isl_set_free(context); |
955 | 0 | return pw; |
956 | 0 | } |
957 | 14.3k | |
958 | 14.3k | is_universe = isl_set_plain_is_universe(context); |
959 | 14.3k | if (is_universe < 0) |
960 | 0 | goto error; |
961 | 14.3k | if (is_universe) { |
962 | 1.17k | isl_set_free(context); |
963 | 1.17k | return pw; |
964 | 1.17k | } |
965 | 13.1k | |
966 | 13.1k | aligned = isl_set_space_has_equal_params(context, pw->dim); |
967 | 13.1k | if (aligned < 0) |
968 | 0 | goto error; |
969 | 13.1k | if (!aligned) { |
970 | 0 | pw = FN(PW,align_params)(pw, isl_set_get_space(context)); |
971 | 0 | context = isl_set_align_params(context, FN(PW,get_space)(pw)); |
972 | 0 | } |
973 | 13.1k | |
974 | 13.1k | pw = FN(PW,cow)(pw); |
975 | 13.1k | if (!pw) |
976 | 0 | goto error; |
977 | 13.1k | |
978 | 13.1k | if (pw->n == 1) { |
979 | 13.1k | int equal; |
980 | 13.1k | |
981 | 13.1k | equal = isl_set_plain_is_equal(pw->p[0].set, context); |
982 | 13.1k | if (equal < 0) |
983 | 0 | goto error; |
984 | 13.1k | if (equal) |
985 | 8.87k | return FN(PW,gist_last)(pw, context, fn_el); |
986 | 4.26k | } |
987 | 4.26k | |
988 | 4.26k | context = isl_set_compute_divs(context); |
989 | 4.26k | hull = isl_set_simple_hull(isl_set_copy(context)); |
990 | 4.26k | |
991 | 8.56k | for (i = pw->n - 1; i >= 0; --i4.30k ) { |
992 | 4.30k | isl_set *set_i; |
993 | 4.30k | int empty; |
994 | 4.30k | |
995 | 4.30k | if (i == pw->n - 1) { |
996 | 4.26k | int equal; |
997 | 4.26k | equal = isl_set_plain_is_equal(pw->p[i].set, context); |
998 | 4.26k | if (equal < 0) |
999 | 0 | goto error; |
1000 | 4.26k | if (equal) { |
1001 | 2 | isl_basic_set_free(hull); |
1002 | 2 | return FN(PW,gist_last)(pw, context, fn_el); |
1003 | 2 | } |
1004 | 4.30k | } |
1005 | 4.30k | set_i = isl_set_intersect(isl_set_copy(pw->p[i].set), |
1006 | 4.30k | isl_set_copy(context)); |
1007 | 4.30k | empty = isl_set_plain_is_empty(set_i); |
1008 | 4.30k | pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i); |
1009 | 4.30k | pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull)); |
1010 | 4.30k | if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set) |
1011 | 0 | goto error; |
1012 | 4.30k | if (empty) { |
1013 | 2 | isl_set_free(pw->p[i].set); |
1014 | 2 | FN(EL,free)(pw->p[i].FIELD); |
1015 | 2 | if (i != pw->n - 1) |
1016 | 0 | pw->p[i] = pw->p[pw->n - 1]; |
1017 | 2 | pw->n--; |
1018 | 2 | } |
1019 | 4.30k | } |
1020 | 4.26k | |
1021 | 4.26k | isl_basic_set_free(hull); |
1022 | 4.26k | isl_set_free(context); |
1023 | 4.26k | |
1024 | 4.26k | return pw; |
1025 | 4.26k | error: |
1026 | 0 | FN(PW,free)(pw); |
1027 | 0 | isl_basic_set_free(hull); |
1028 | 0 | isl_set_free(context); |
1029 | 0 | return NULL; |
1030 | 4.26k | } isl_aff.c:isl_pw_aff_gist_aligned Line | Count | Source | 944 | 12.0k | { | 945 | 12.0k | int i; | 946 | 12.0k | int is_universe; | 947 | 12.0k | isl_bool aligned; | 948 | 12.0k | isl_basic_set *hull = NULL; | 949 | 12.0k | | 950 | 12.0k | if (!pw || !context) | 951 | 0 | goto error; | 952 | 12.0k | | 953 | 12.0k | if (pw->n == 0) { | 954 | 0 | isl_set_free(context); | 955 | 0 | return pw; | 956 | 0 | } | 957 | 12.0k | | 958 | 12.0k | is_universe = isl_set_plain_is_universe(context); | 959 | 12.0k | if (is_universe < 0) | 960 | 0 | goto error; | 961 | 12.0k | if (is_universe) { | 962 | 1.09k | isl_set_free(context); | 963 | 1.09k | return pw; | 964 | 1.09k | } | 965 | 10.9k | | 966 | 10.9k | aligned = isl_set_space_has_equal_params(context, pw->dim); | 967 | 10.9k | if (aligned < 0) | 968 | 0 | goto error; | 969 | 10.9k | if (!aligned) { | 970 | 0 | pw = FN(PW,align_params)(pw, isl_set_get_space(context)); | 971 | 0 | context = isl_set_align_params(context, FN(PW,get_space)(pw)); | 972 | 0 | } | 973 | 10.9k | | 974 | 10.9k | pw = FN(PW,cow)(pw); | 975 | 10.9k | if (!pw) | 976 | 0 | goto error; | 977 | 10.9k | | 978 | 10.9k | if (pw->n == 1) { | 979 | 10.9k | int equal; | 980 | 10.9k | | 981 | 10.9k | equal = isl_set_plain_is_equal(pw->p[0].set, context); | 982 | 10.9k | if (equal < 0) | 983 | 0 | goto error; | 984 | 10.9k | if (equal) | 985 | 8.12k | return FN(PW,gist_last)(pw, context, fn_el); | 986 | 2.85k | } | 987 | 2.85k | | 988 | 2.85k | context = isl_set_compute_divs(context); | 989 | 2.85k | hull = isl_set_simple_hull(isl_set_copy(context)); | 990 | 2.85k | | 991 | 5.74k | for (i = pw->n - 1; i >= 0; --i2.88k ) { | 992 | 2.89k | isl_set *set_i; | 993 | 2.89k | int empty; | 994 | 2.89k | | 995 | 2.89k | if (i == pw->n - 1) { | 996 | 2.85k | int equal; | 997 | 2.85k | equal = isl_set_plain_is_equal(pw->p[i].set, context); | 998 | 2.85k | if (equal < 0) | 999 | 0 | goto error; | 1000 | 2.85k | if (equal) { | 1001 | 2 | isl_basic_set_free(hull); | 1002 | 2 | return FN(PW,gist_last)(pw, context, fn_el); | 1003 | 2 | } | 1004 | 2.88k | } | 1005 | 2.88k | set_i = isl_set_intersect(isl_set_copy(pw->p[i].set), | 1006 | 2.88k | isl_set_copy(context)); | 1007 | 2.88k | empty = isl_set_plain_is_empty(set_i); | 1008 | 2.88k | pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i); | 1009 | 2.88k | pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull)); | 1010 | 2.88k | if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set) | 1011 | 0 | goto error; | 1012 | 2.88k | if (empty) { | 1013 | 0 | isl_set_free(pw->p[i].set); | 1014 | 0 | FN(EL,free)(pw->p[i].FIELD); | 1015 | 0 | if (i != pw->n - 1) | 1016 | 0 | pw->p[i] = pw->p[pw->n - 1]; | 1017 | 0 | pw->n--; | 1018 | 0 | } | 1019 | 2.88k | } | 1020 | 2.85k | | 1021 | 2.85k | isl_basic_set_free(hull); | 1022 | 2.85k | isl_set_free(context); | 1023 | 2.85k | | 1024 | 2.85k | return pw; | 1025 | 2.85k | error: | 1026 | 0 | FN(PW,free)(pw); | 1027 | 0 | isl_basic_set_free(hull); | 1028 | 0 | isl_set_free(context); | 1029 | 0 | return NULL; | 1030 | 2.85k | } |
isl_aff.c:isl_pw_multi_aff_gist_aligned Line | Count | Source | 944 | 2.23k | { | 945 | 2.23k | int i; | 946 | 2.23k | int is_universe; | 947 | 2.23k | isl_bool aligned; | 948 | 2.23k | isl_basic_set *hull = NULL; | 949 | 2.23k | | 950 | 2.23k | if (!pw || !context) | 951 | 0 | goto error; | 952 | 2.23k | | 953 | 2.23k | if (pw->n == 0) { | 954 | 0 | isl_set_free(context); | 955 | 0 | return pw; | 956 | 0 | } | 957 | 2.23k | | 958 | 2.23k | is_universe = isl_set_plain_is_universe(context); | 959 | 2.23k | if (is_universe < 0) | 960 | 0 | goto error; | 961 | 2.23k | if (is_universe) { | 962 | 76 | isl_set_free(context); | 963 | 76 | return pw; | 964 | 76 | } | 965 | 2.16k | | 966 | 2.16k | aligned = isl_set_space_has_equal_params(context, pw->dim); | 967 | 2.16k | if (aligned < 0) | 968 | 0 | goto error; | 969 | 2.16k | if (!aligned) { | 970 | 0 | pw = FN(PW,align_params)(pw, isl_set_get_space(context)); | 971 | 0 | context = isl_set_align_params(context, FN(PW,get_space)(pw)); | 972 | 0 | } | 973 | 2.16k | | 974 | 2.16k | pw = FN(PW,cow)(pw); | 975 | 2.16k | if (!pw) | 976 | 0 | goto error; | 977 | 2.16k | | 978 | 2.16k | if (pw->n == 1) { | 979 | 2.16k | int equal; | 980 | 2.16k | | 981 | 2.16k | equal = isl_set_plain_is_equal(pw->p[0].set, context); | 982 | 2.16k | if (equal < 0) | 983 | 0 | goto error; | 984 | 2.16k | if (equal) | 985 | 754 | return FN(PW,gist_last)(pw, context, fn_el); | 986 | 1.40k | } | 987 | 1.40k | | 988 | 1.40k | context = isl_set_compute_divs(context); | 989 | 1.40k | hull = isl_set_simple_hull(isl_set_copy(context)); | 990 | 1.40k | | 991 | 2.81k | for (i = pw->n - 1; i >= 0; --i1.40k ) { | 992 | 1.40k | isl_set *set_i; | 993 | 1.40k | int empty; | 994 | 1.40k | | 995 | 1.40k | if (i == pw->n - 1) { | 996 | 1.40k | int equal; | 997 | 1.40k | equal = isl_set_plain_is_equal(pw->p[i].set, context); | 998 | 1.40k | if (equal < 0) | 999 | 0 | goto error; | 1000 | 1.40k | if (equal) { | 1001 | 0 | isl_basic_set_free(hull); | 1002 | 0 | return FN(PW,gist_last)(pw, context, fn_el); | 1003 | 0 | } | 1004 | 1.40k | } | 1005 | 1.40k | set_i = isl_set_intersect(isl_set_copy(pw->p[i].set), | 1006 | 1.40k | isl_set_copy(context)); | 1007 | 1.40k | empty = isl_set_plain_is_empty(set_i); | 1008 | 1.40k | pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i); | 1009 | 1.40k | pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull)); | 1010 | 1.40k | if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set) | 1011 | 0 | goto error; | 1012 | 1.40k | if (empty) { | 1013 | 2 | isl_set_free(pw->p[i].set); | 1014 | 2 | FN(EL,free)(pw->p[i].FIELD); | 1015 | 2 | if (i != pw->n - 1) | 1016 | 0 | pw->p[i] = pw->p[pw->n - 1]; | 1017 | 2 | pw->n--; | 1018 | 2 | } | 1019 | 1.40k | } | 1020 | 1.40k | | 1021 | 1.40k | isl_basic_set_free(hull); | 1022 | 1.40k | isl_set_free(context); | 1023 | 1.40k | | 1024 | 1.40k | return pw; | 1025 | 1.40k | error: | 1026 | 0 | FN(PW,free)(pw); | 1027 | 0 | isl_basic_set_free(hull); | 1028 | 0 | isl_set_free(context); | 1029 | 0 | return NULL; | 1030 | 1.40k | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_aligned isl_polynomial.c:isl_pw_qpolynomial_gist_aligned Line | Count | Source | 944 | 4 | { | 945 | 4 | int i; | 946 | 4 | int is_universe; | 947 | 4 | isl_bool aligned; | 948 | 4 | isl_basic_set *hull = NULL; | 949 | 4 | | 950 | 4 | if (!pw || !context) | 951 | 0 | goto error; | 952 | 4 | | 953 | 4 | if (pw->n == 0) { | 954 | 0 | isl_set_free(context); | 955 | 0 | return pw; | 956 | 0 | } | 957 | 4 | | 958 | 4 | is_universe = isl_set_plain_is_universe(context); | 959 | 4 | if (is_universe < 0) | 960 | 0 | goto error; | 961 | 4 | if (is_universe) { | 962 | 0 | isl_set_free(context); | 963 | 0 | return pw; | 964 | 0 | } | 965 | 4 | | 966 | 4 | aligned = isl_set_space_has_equal_params(context, pw->dim); | 967 | 4 | if (aligned < 0) | 968 | 0 | goto error; | 969 | 4 | if (!aligned) { | 970 | 0 | pw = FN(PW,align_params)(pw, isl_set_get_space(context)); | 971 | 0 | context = isl_set_align_params(context, FN(PW,get_space)(pw)); | 972 | 0 | } | 973 | 4 | | 974 | 4 | pw = FN(PW,cow)(pw); | 975 | 4 | if (!pw) | 976 | 0 | goto error; | 977 | 4 | | 978 | 4 | if (pw->n == 1) { | 979 | 4 | int equal; | 980 | 4 | | 981 | 4 | equal = isl_set_plain_is_equal(pw->p[0].set, context); | 982 | 4 | if (equal < 0) | 983 | 0 | goto error; | 984 | 4 | if (equal) | 985 | 1 | return FN(PW,gist_last)(pw, context, fn_el); | 986 | 3 | } | 987 | 3 | | 988 | 3 | context = isl_set_compute_divs(context); | 989 | 3 | hull = isl_set_simple_hull(isl_set_copy(context)); | 990 | 3 | | 991 | 6 | for (i = pw->n - 1; i >= 0; --i3 ) { | 992 | 3 | isl_set *set_i; | 993 | 3 | int empty; | 994 | 3 | | 995 | 3 | if (i == pw->n - 1) { | 996 | 3 | int equal; | 997 | 3 | equal = isl_set_plain_is_equal(pw->p[i].set, context); | 998 | 3 | if (equal < 0) | 999 | 0 | goto error; | 1000 | 3 | if (equal) { | 1001 | 0 | isl_basic_set_free(hull); | 1002 | 0 | return FN(PW,gist_last)(pw, context, fn_el); | 1003 | 0 | } | 1004 | 3 | } | 1005 | 3 | set_i = isl_set_intersect(isl_set_copy(pw->p[i].set), | 1006 | 3 | isl_set_copy(context)); | 1007 | 3 | empty = isl_set_plain_is_empty(set_i); | 1008 | 3 | pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i); | 1009 | 3 | pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull)); | 1010 | 3 | if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set) | 1011 | 0 | goto error; | 1012 | 3 | if (empty) { | 1013 | 0 | isl_set_free(pw->p[i].set); | 1014 | 0 | FN(EL,free)(pw->p[i].FIELD); | 1015 | 0 | if (i != pw->n - 1) | 1016 | 0 | pw->p[i] = pw->p[pw->n - 1]; | 1017 | 0 | pw->n--; | 1018 | 0 | } | 1019 | 3 | } | 1020 | 3 | | 1021 | 3 | isl_basic_set_free(hull); | 1022 | 3 | isl_set_free(context); | 1023 | 3 | | 1024 | 3 | return pw; | 1025 | 3 | error: | 1026 | 0 | FN(PW,free)(pw); | 1027 | 0 | isl_basic_set_free(hull); | 1028 | 0 | isl_set_free(context); | 1029 | 0 | return NULL; | 1030 | 3 | } |
|
1031 | | |
1032 | | static __isl_give PW *FN(PW,gist_domain_aligned)(__isl_take PW *pw, |
1033 | | __isl_take isl_set *set) |
1034 | 14.3k | { |
1035 | 14.3k | return FN(PW,gist_aligned)(pw, set, &FN(EL,gist), |
1036 | 14.3k | &isl_set_gist_basic_set); |
1037 | 14.3k | } isl_aff.c:isl_pw_aff_gist_domain_aligned Line | Count | Source | 1034 | 12.0k | { | 1035 | 12.0k | return FN(PW,gist_aligned)(pw, set, &FN(EL,gist), | 1036 | 12.0k | &isl_set_gist_basic_set); | 1037 | 12.0k | } |
isl_aff.c:isl_pw_multi_aff_gist_domain_aligned Line | Count | Source | 1034 | 2.23k | { | 1035 | 2.23k | return FN(PW,gist_aligned)(pw, set, &FN(EL,gist), | 1036 | 2.23k | &isl_set_gist_basic_set); | 1037 | 2.23k | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_domain_aligned isl_polynomial.c:isl_pw_qpolynomial_gist_domain_aligned Line | Count | Source | 1034 | 4 | { | 1035 | 4 | return FN(PW,gist_aligned)(pw, set, &FN(EL,gist), | 1036 | 4 | &isl_set_gist_basic_set); | 1037 | 4 | } |
|
1038 | | |
1039 | | __isl_give PW *FN(PW,gist)(__isl_take PW *pw, __isl_take isl_set *context) |
1040 | 14.3k | { |
1041 | 14.3k | return FN(PW,align_params_pw_set_and)(pw, context, |
1042 | 14.3k | &FN(PW,gist_domain_aligned)); |
1043 | 14.3k | } Line | Count | Source | 1040 | 12.0k | { | 1041 | 12.0k | return FN(PW,align_params_pw_set_and)(pw, context, | 1042 | 12.0k | &FN(PW,gist_domain_aligned)); | 1043 | 12.0k | } |
Line | Count | Source | 1040 | 2.23k | { | 1041 | 2.23k | return FN(PW,align_params_pw_set_and)(pw, context, | 1042 | 2.23k | &FN(PW,gist_domain_aligned)); | 1043 | 2.23k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist Line | Count | Source | 1040 | 4 | { | 1041 | 4 | return FN(PW,align_params_pw_set_and)(pw, context, | 1042 | 4 | &FN(PW,gist_domain_aligned)); | 1043 | 4 | } |
|
1044 | | |
1045 | | static __isl_give PW *FN(PW,gist_params_aligned)(__isl_take PW *pw, |
1046 | | __isl_take isl_set *set) |
1047 | 0 | { |
1048 | 0 | return FN(PW,gist_aligned)(pw, set, &FN(EL,gist_params), |
1049 | 0 | &isl_set_gist_params_basic_set); |
1050 | 0 | } Unexecuted instantiation: isl_aff.c:isl_pw_aff_gist_params_aligned Unexecuted instantiation: isl_aff.c:isl_pw_multi_aff_gist_params_aligned Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_params_aligned Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_gist_params_aligned |
1051 | | |
1052 | | __isl_give PW *FN(PW,gist_params)(__isl_take PW *pw, |
1053 | | __isl_take isl_set *context) |
1054 | 0 | { |
1055 | 0 | return FN(PW,align_params_pw_set_and)(pw, context, |
1056 | 0 | &FN(PW,gist_params_aligned)); |
1057 | 0 | } Unexecuted instantiation: isl_pw_aff_gist_params Unexecuted instantiation: isl_pw_multi_aff_gist_params Unexecuted instantiation: isl_pw_qpolynomial_fold_gist_params Unexecuted instantiation: isl_pw_qpolynomial_gist_params |
1058 | | |
1059 | | /* Return -1 if the piece "p1" should be sorted before "p2" |
1060 | | * and 1 if it should be sorted after "p2". |
1061 | | * Return 0 if they do not need to be sorted in a specific order. |
1062 | | * |
1063 | | * The two pieces are compared on the basis of their function value expressions. |
1064 | | */ |
1065 | | static int FN(PW,sort_field_cmp)(const void *p1, const void *p2, void *arg) |
1066 | 6.99k | { |
1067 | 6.99k | struct FN(PW,piece) const *pc1 = p1; |
1068 | 6.99k | struct FN(PW,piece) const *pc2 = p2; |
1069 | 6.99k | |
1070 | 6.99k | return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD); |
1071 | 6.99k | } isl_aff.c:isl_pw_aff_sort_field_cmp Line | Count | Source | 1066 | 681 | { | 1067 | 681 | struct FN(PW,piece) const *pc1 = p1; | 1068 | 681 | struct FN(PW,piece) const *pc2 = p2; | 1069 | 681 | | 1070 | 681 | return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD); | 1071 | 681 | } |
isl_aff.c:isl_pw_multi_aff_sort_field_cmp Line | Count | Source | 1066 | 6.31k | { | 1067 | 6.31k | struct FN(PW,piece) const *pc1 = p1; | 1068 | 6.31k | struct FN(PW,piece) const *pc2 = p2; | 1069 | 6.31k | | 1070 | 6.31k | return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD); | 1071 | 6.31k | } |
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_sort_field_cmp isl_polynomial.c:isl_pw_qpolynomial_sort_field_cmp Line | Count | Source | 1066 | 1 | { | 1067 | 1 | struct FN(PW,piece) const *pc1 = p1; | 1068 | 1 | struct FN(PW,piece) const *pc2 = p2; | 1069 | 1 | | 1070 | 1 | return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD); | 1071 | 1 | } |
|
1072 | | |
1073 | | /* Sort the pieces of "pw" according to their function value |
1074 | | * expressions and then combine pairs of adjacent pieces with |
1075 | | * the same such expression. |
1076 | | * |
1077 | | * The sorting is performed in place because it does not |
1078 | | * change the meaning of "pw", but care needs to be |
1079 | | * taken not to change any possible other copies of "pw" |
1080 | | * in case anything goes wrong. |
1081 | | */ |
1082 | | __isl_give PW *FN(PW,sort)(__isl_take PW *pw) |
1083 | 30.4k | { |
1084 | 30.4k | int i, j; |
1085 | 30.4k | isl_set *set; |
1086 | 30.4k | |
1087 | 30.4k | if (!pw) |
1088 | 6 | return NULL; |
1089 | 30.4k | if (pw->n <= 1) |
1090 | 29.1k | return pw; |
1091 | 1.25k | if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]), |
1092 | 1.25k | &FN(PW,sort_field_cmp), NULL) < 0) |
1093 | 0 | return FN(PW,free)(pw); |
1094 | 4.99k | for (i = pw->n - 1; 1.25k i >= 1; --i3.74k ) { |
1095 | 3.74k | if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD)) |
1096 | 3.69k | continue; |
1097 | 45 | set = isl_set_union(isl_set_copy(pw->p[i - 1].set), |
1098 | 45 | isl_set_copy(pw->p[i].set)); |
1099 | 45 | if (!set) |
1100 | 0 | return FN(PW,free)(pw); |
1101 | 45 | isl_set_free(pw->p[i].set); |
1102 | 45 | FN(EL,free)(pw->p[i].FIELD); |
1103 | 45 | isl_set_free(pw->p[i - 1].set); |
1104 | 45 | pw->p[i - 1].set = set; |
1105 | 59 | for (j = i + 1; j < pw->n; ++j14 ) |
1106 | 14 | pw->p[j - 1] = pw->p[j]; |
1107 | 45 | pw->n--; |
1108 | 45 | } |
1109 | 1.25k | |
1110 | 1.25k | return pw; |
1111 | 1.25k | } Line | Count | Source | 1083 | 25.6k | { | 1084 | 25.6k | int i, j; | 1085 | 25.6k | isl_set *set; | 1086 | 25.6k | | 1087 | 25.6k | if (!pw) | 1088 | 0 | return NULL; | 1089 | 25.6k | if (pw->n <= 1) | 1090 | 25.2k | return pw; | 1091 | 371 | if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]), | 1092 | 371 | &FN(PW,sort_field_cmp), NULL) < 0) | 1093 | 0 | return FN(PW,free)(pw); | 1094 | 895 | for (i = pw->n - 1; 371 i >= 1; --i524 ) { | 1095 | 524 | if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD)) | 1096 | 517 | continue; | 1097 | 7 | set = isl_set_union(isl_set_copy(pw->p[i - 1].set), | 1098 | 7 | isl_set_copy(pw->p[i].set)); | 1099 | 7 | if (!set) | 1100 | 0 | return FN(PW,free)(pw); | 1101 | 7 | isl_set_free(pw->p[i].set); | 1102 | 7 | FN(EL,free)(pw->p[i].FIELD); | 1103 | 7 | isl_set_free(pw->p[i - 1].set); | 1104 | 7 | pw->p[i - 1].set = set; | 1105 | 19 | for (j = i + 1; j < pw->n; ++j12 ) | 1106 | 12 | pw->p[j - 1] = pw->p[j]; | 1107 | 7 | pw->n--; | 1108 | 7 | } | 1109 | 371 | | 1110 | 371 | return pw; | 1111 | 371 | } |
Line | Count | Source | 1083 | 4.75k | { | 1084 | 4.75k | int i, j; | 1085 | 4.75k | isl_set *set; | 1086 | 4.75k | | 1087 | 4.75k | if (!pw) | 1088 | 6 | return NULL; | 1089 | 4.75k | if (pw->n <= 1) | 1090 | 3.87k | return pw; | 1091 | 879 | if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]), | 1092 | 879 | &FN(PW,sort_field_cmp), NULL) < 0) | 1093 | 0 | return FN(PW,free)(pw); | 1094 | 4.09k | for (i = pw->n - 1; 879 i >= 1; --i3.21k ) { | 1095 | 3.21k | if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD)) | 1096 | 3.17k | continue; | 1097 | 38 | set = isl_set_union(isl_set_copy(pw->p[i - 1].set), | 1098 | 38 | isl_set_copy(pw->p[i].set)); | 1099 | 38 | if (!set) | 1100 | 0 | return FN(PW,free)(pw); | 1101 | 38 | isl_set_free(pw->p[i].set); | 1102 | 38 | FN(EL,free)(pw->p[i].FIELD); | 1103 | 38 | isl_set_free(pw->p[i - 1].set); | 1104 | 38 | pw->p[i - 1].set = set; | 1105 | 40 | for (j = i + 1; j < pw->n; ++j2 ) | 1106 | 2 | pw->p[j - 1] = pw->p[j]; | 1107 | 38 | pw->n--; | 1108 | 38 | } | 1109 | 879 | | 1110 | 879 | return pw; | 1111 | 879 | } |
isl_pw_qpolynomial_fold_sort Line | Count | Source | 1083 | 2 | { | 1084 | 2 | int i, j; | 1085 | 2 | isl_set *set; | 1086 | 2 | | 1087 | 2 | if (!pw) | 1088 | 0 | return NULL; | 1089 | 2 | if (pw->n <= 1) | 1090 | 2 | return pw; | 1091 | 0 | if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]), | 1092 | 0 | &FN(PW,sort_field_cmp), NULL) < 0) | 1093 | 0 | return FN(PW,free)(pw); | 1094 | 0 | for (i = pw->n - 1; i >= 1; --i) { | 1095 | 0 | if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD)) | 1096 | 0 | continue; | 1097 | 0 | set = isl_set_union(isl_set_copy(pw->p[i - 1].set), | 1098 | 0 | isl_set_copy(pw->p[i].set)); | 1099 | 0 | if (!set) | 1100 | 0 | return FN(PW,free)(pw); | 1101 | 0 | isl_set_free(pw->p[i].set); | 1102 | 0 | FN(EL,free)(pw->p[i].FIELD); | 1103 | 0 | isl_set_free(pw->p[i - 1].set); | 1104 | 0 | pw->p[i - 1].set = set; | 1105 | 0 | for (j = i + 1; j < pw->n; ++j) | 1106 | 0 | pw->p[j - 1] = pw->p[j]; | 1107 | 0 | pw->n--; | 1108 | 0 | } | 1109 | 0 |
| 1110 | 0 | return pw; | 1111 | 0 | } |
Line | Count | Source | 1083 | 7 | { | 1084 | 7 | int i, j; | 1085 | 7 | isl_set *set; | 1086 | 7 | | 1087 | 7 | if (!pw) | 1088 | 0 | return NULL; | 1089 | 7 | if (pw->n <= 1) | 1090 | 6 | return pw; | 1091 | 1 | if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]), | 1092 | 1 | &FN(PW,sort_field_cmp), NULL) < 0) | 1093 | 0 | return FN(PW,free)(pw); | 1094 | 2 | for (i = pw->n - 1; 1 i >= 1; --i1 ) { | 1095 | 1 | if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD)) | 1096 | 1 | continue; | 1097 | 0 | set = isl_set_union(isl_set_copy(pw->p[i - 1].set), | 1098 | 0 | isl_set_copy(pw->p[i].set)); | 1099 | 0 | if (!set) | 1100 | 0 | return FN(PW,free)(pw); | 1101 | 0 | isl_set_free(pw->p[i].set); | 1102 | 0 | FN(EL,free)(pw->p[i].FIELD); | 1103 | 0 | isl_set_free(pw->p[i - 1].set); | 1104 | 0 | pw->p[i - 1].set = set; | 1105 | 0 | for (j = i + 1; j < pw->n; ++j) | 1106 | 0 | pw->p[j - 1] = pw->p[j]; | 1107 | 0 | pw->n--; | 1108 | 0 | } | 1109 | 1 | | 1110 | 1 | return pw; | 1111 | 1 | } |
|
1112 | | |
1113 | | /* Coalesce the domains of "pw". |
1114 | | * |
1115 | | * Prior to the actual coalescing, first sort the pieces such that |
1116 | | * pieces with the same function value expression are combined |
1117 | | * into a single piece, the combined domain of which can then |
1118 | | * be coalesced. |
1119 | | */ |
1120 | | __isl_give PW *FN(PW,coalesce)(__isl_take PW *pw) |
1121 | 25.4k | { |
1122 | 25.4k | int i; |
1123 | 25.4k | |
1124 | 25.4k | pw = FN(PW,sort)(pw); |
1125 | 25.4k | if (!pw) |
1126 | 6 | return NULL; |
1127 | 25.3k | |
1128 | 51.3k | for (i = 0; 25.3k i < pw->n; ++i25.9k ) { |
1129 | 25.9k | pw->p[i].set = isl_set_coalesce(pw->p[i].set); |
1130 | 25.9k | if (!pw->p[i].set) |
1131 | 0 | goto error; |
1132 | 25.9k | } |
1133 | 25.3k | |
1134 | 25.3k | return pw; |
1135 | 25.3k | error: |
1136 | 0 | FN(PW,free)(pw); |
1137 | 0 | return NULL; |
1138 | 25.3k | } Line | Count | Source | 1121 | 24.3k | { | 1122 | 24.3k | int i; | 1123 | 24.3k | | 1124 | 24.3k | pw = FN(PW,sort)(pw); | 1125 | 24.3k | if (!pw) | 1126 | 0 | return NULL; | 1127 | 24.3k | | 1128 | 49.0k | for (i = 0; 24.3k i < pw->n; ++i24.7k ) { | 1129 | 24.7k | pw->p[i].set = isl_set_coalesce(pw->p[i].set); | 1130 | 24.7k | if (!pw->p[i].set) | 1131 | 0 | goto error; | 1132 | 24.7k | } | 1133 | 24.3k | | 1134 | 24.3k | return pw; | 1135 | 24.3k | error: | 1136 | 0 | FN(PW,free)(pw); | 1137 | 0 | return NULL; | 1138 | 24.3k | } |
isl_pw_multi_aff_coalesce Line | Count | Source | 1121 | 1.09k | { | 1122 | 1.09k | int i; | 1123 | 1.09k | | 1124 | 1.09k | pw = FN(PW,sort)(pw); | 1125 | 1.09k | if (!pw) | 1126 | 6 | return NULL; | 1127 | 1.09k | | 1128 | 2.25k | for (i = 0; 1.09k i < pw->n; ++i1.16k ) { | 1129 | 1.16k | pw->p[i].set = isl_set_coalesce(pw->p[i].set); | 1130 | 1.16k | if (!pw->p[i].set) | 1131 | 0 | goto error; | 1132 | 1.16k | } | 1133 | 1.09k | | 1134 | 1.09k | return pw; | 1135 | 1.09k | error: | 1136 | 0 | FN(PW,free)(pw); | 1137 | 0 | return NULL; | 1138 | 1.09k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_coalesce |
1139 | | |
1140 | | isl_ctx *FN(PW,get_ctx)(__isl_keep PW *pw) |
1141 | 22.3k | { |
1142 | 22.3k | return pw ? isl_space_get_ctx(pw->dim) : NULL; |
1143 | 22.3k | } Line | Count | Source | 1141 | 18.8k | { | 1142 | 18.8k | return pw ? isl_space_get_ctx(pw->dim) : NULL; | 1143 | 18.8k | } |
Line | Count | Source | 1141 | 3.52k | { | 1142 | 3.52k | return pw ? isl_space_get_ctx(pw->dim) : NULL; | 1143 | 3.52k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_ctx isl_pw_qpolynomial_get_ctx Line | Count | Source | 1141 | 1 | { | 1142 | 1 | return pw ? isl_space_get_ctx(pw->dim) : NULL; | 1143 | 1 | } |
|
1144 | | |
1145 | | isl_bool FN(PW,involves_dims)(__isl_keep PW *pw, enum isl_dim_type type, |
1146 | | unsigned first, unsigned n) |
1147 | 222 | { |
1148 | 222 | int i; |
1149 | 222 | enum isl_dim_type set_type; |
1150 | 222 | |
1151 | 222 | if (!pw) |
1152 | 0 | return isl_bool_error; |
1153 | 222 | if (pw->n == 0 || n == 0) |
1154 | 0 | return isl_bool_false; |
1155 | 222 | |
1156 | 222 | set_type = type == isl_dim_in ? isl_dim_set219 : type3 ; |
1157 | 222 | |
1158 | 443 | for (i = 0; i < pw->n; ++i221 ) { |
1159 | 222 | isl_bool involves = FN(EL,involves_dims)(pw->p[i].FIELD, |
1160 | 222 | type, first, n); |
1161 | 222 | if (involves < 0 || involves) |
1162 | 1 | return involves; |
1163 | 221 | involves = isl_set_involves_dims(pw->p[i].set, |
1164 | 221 | set_type, first, n); |
1165 | 221 | if (involves < 0 || involves) |
1166 | 0 | return involves; |
1167 | 221 | } |
1168 | 222 | return isl_bool_false221 ; |
1169 | 222 | } Line | Count | Source | 1147 | 222 | { | 1148 | 222 | int i; | 1149 | 222 | enum isl_dim_type set_type; | 1150 | 222 | | 1151 | 222 | if (!pw) | 1152 | 0 | return isl_bool_error; | 1153 | 222 | if (pw->n == 0 || n == 0) | 1154 | 0 | return isl_bool_false; | 1155 | 222 | | 1156 | 222 | set_type = type == isl_dim_in ? isl_dim_set219 : type3 ; | 1157 | 222 | | 1158 | 443 | for (i = 0; i < pw->n; ++i221 ) { | 1159 | 222 | isl_bool involves = FN(EL,involves_dims)(pw->p[i].FIELD, | 1160 | 222 | type, first, n); | 1161 | 222 | if (involves < 0 || involves) | 1162 | 1 | return involves; | 1163 | 221 | involves = isl_set_involves_dims(pw->p[i].set, | 1164 | 221 | set_type, first, n); | 1165 | 221 | if (involves < 0 || involves) | 1166 | 0 | return involves; | 1167 | 221 | } | 1168 | 222 | return isl_bool_false221 ; | 1169 | 222 | } |
Unexecuted instantiation: isl_pw_multi_aff_involves_dims Unexecuted instantiation: isl_pw_qpolynomial_fold_involves_dims Unexecuted instantiation: isl_pw_qpolynomial_involves_dims |
1170 | | |
1171 | | __isl_give PW *FN(PW,set_dim_name)(__isl_take PW *pw, |
1172 | | enum isl_dim_type type, unsigned pos, const char *s) |
1173 | 0 | { |
1174 | 0 | int i; |
1175 | 0 | enum isl_dim_type set_type; |
1176 | 0 |
|
1177 | 0 | pw = FN(PW,cow)(pw); |
1178 | 0 | if (!pw) |
1179 | 0 | return NULL; |
1180 | 0 | |
1181 | 0 | set_type = type == isl_dim_in ? isl_dim_set : type; |
1182 | 0 |
|
1183 | 0 | pw->dim = isl_space_set_dim_name(pw->dim, type, pos, s); |
1184 | 0 | if (!pw->dim) |
1185 | 0 | goto error; |
1186 | 0 | |
1187 | 0 | for (i = 0; i < pw->n; ++i) { |
1188 | 0 | pw->p[i].set = isl_set_set_dim_name(pw->p[i].set, |
1189 | 0 | set_type, pos, s); |
1190 | 0 | if (!pw->p[i].set) |
1191 | 0 | goto error; |
1192 | 0 | pw->p[i].FIELD = FN(EL,set_dim_name)(pw->p[i].FIELD, type, pos, s); |
1193 | 0 | if (!pw->p[i].FIELD) |
1194 | 0 | goto error; |
1195 | 0 | } |
1196 | 0 |
|
1197 | 0 | return pw; |
1198 | 0 | error: |
1199 | 0 | FN(PW,free)(pw); |
1200 | 0 | return NULL; |
1201 | 0 | } Unexecuted instantiation: isl_pw_aff_set_dim_name Unexecuted instantiation: isl_pw_multi_aff_set_dim_name Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_name Unexecuted instantiation: isl_pw_qpolynomial_set_dim_name |
1202 | | |
1203 | | __isl_give PW *FN(PW,drop_dims)(__isl_take PW *pw, |
1204 | | enum isl_dim_type type, unsigned first, unsigned n) |
1205 | 842 | { |
1206 | 842 | int i; |
1207 | 842 | enum isl_dim_type set_type; |
1208 | 842 | |
1209 | 842 | if (!pw) |
1210 | 0 | return NULL; |
1211 | 842 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)0 ) |
1212 | 0 | return pw; |
1213 | 842 | |
1214 | 842 | set_type = type == isl_dim_in ? isl_dim_set219 : type623 ; |
1215 | 842 | |
1216 | 842 | pw = FN(PW,cow)(pw); |
1217 | 842 | if (!pw) |
1218 | 0 | return NULL; |
1219 | 842 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); |
1220 | 842 | if (!pw->dim) |
1221 | 0 | goto error; |
1222 | 1.68k | for (i = 0; 842 i < pw->n; ++i842 ) { |
1223 | 842 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); |
1224 | 842 | if (!pw->p[i].FIELD) |
1225 | 842 | goto error0 ; |
1226 | 842 | if (type == isl_dim_out) |
1227 | 621 | continue; |
1228 | 221 | pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n); |
1229 | 221 | if (!pw->p[i].set) |
1230 | 0 | goto error; |
1231 | 221 | } |
1232 | 842 | |
1233 | 842 | return pw; |
1234 | 842 | error: |
1235 | 0 | FN(PW,free)(pw); |
1236 | 0 | return NULL; |
1237 | 842 | } Line | Count | Source | 1205 | 221 | { | 1206 | 221 | int i; | 1207 | 221 | enum isl_dim_type set_type; | 1208 | 221 | | 1209 | 221 | if (!pw) | 1210 | 0 | return NULL; | 1211 | 221 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)0 ) | 1212 | 0 | return pw; | 1213 | 221 | | 1214 | 221 | set_type = type == isl_dim_in ? isl_dim_set219 : type2 ; | 1215 | 221 | | 1216 | 221 | pw = FN(PW,cow)(pw); | 1217 | 221 | if (!pw) | 1218 | 0 | return NULL; | 1219 | 221 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); | 1220 | 221 | if (!pw->dim) | 1221 | 0 | goto error; | 1222 | 442 | for (i = 0; 221 i < pw->n; ++i221 ) { | 1223 | 221 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); | 1224 | 221 | if (!pw->p[i].FIELD) | 1225 | 221 | goto error0 ; | 1226 | 221 | if (type == isl_dim_out) | 1227 | 0 | continue; | 1228 | 221 | pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n); | 1229 | 221 | if (!pw->p[i].set) | 1230 | 0 | goto error; | 1231 | 221 | } | 1232 | 221 | | 1233 | 221 | return pw; | 1234 | 221 | error: | 1235 | 0 | FN(PW,free)(pw); | 1236 | 0 | return NULL; | 1237 | 221 | } |
isl_pw_multi_aff_drop_dims Line | Count | Source | 1205 | 621 | { | 1206 | 621 | int i; | 1207 | 621 | enum isl_dim_type set_type; | 1208 | 621 | | 1209 | 621 | if (!pw) | 1210 | 0 | return NULL; | 1211 | 621 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)0 ) | 1212 | 0 | return pw; | 1213 | 621 | | 1214 | 621 | set_type = type == isl_dim_in ? isl_dim_set0 : type; | 1215 | 621 | | 1216 | 621 | pw = FN(PW,cow)(pw); | 1217 | 621 | if (!pw) | 1218 | 0 | return NULL; | 1219 | 621 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); | 1220 | 621 | if (!pw->dim) | 1221 | 0 | goto error; | 1222 | 1.24k | for (i = 0; 621 i < pw->n; ++i621 ) { | 1223 | 621 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); | 1224 | 621 | if (!pw->p[i].FIELD) | 1225 | 621 | goto error0 ; | 1226 | 621 | if (type == isl_dim_out) | 1227 | 621 | continue; | 1228 | 0 | pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n); | 1229 | 0 | if (!pw->p[i].set) | 1230 | 0 | goto error; | 1231 | 0 | } | 1232 | 621 | | 1233 | 621 | return pw; | 1234 | 621 | error: | 1235 | 0 | FN(PW,free)(pw); | 1236 | 0 | return NULL; | 1237 | 621 | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_drop_dims Unexecuted instantiation: isl_pw_qpolynomial_drop_dims |
1238 | | |
1239 | | /* This function is very similar to drop_dims. |
1240 | | * The only difference is that the cells may still involve |
1241 | | * the specified dimensions. They are removed using |
1242 | | * isl_set_project_out instead of isl_set_drop. |
1243 | | */ |
1244 | | __isl_give PW *FN(PW,project_out)(__isl_take PW *pw, |
1245 | | enum isl_dim_type type, unsigned first, unsigned n) |
1246 | 212 | { |
1247 | 212 | int i; |
1248 | 212 | enum isl_dim_type set_type; |
1249 | 212 | |
1250 | 212 | if (!pw) |
1251 | 0 | return NULL; |
1252 | 212 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)19 ) |
1253 | 0 | return pw; |
1254 | 212 | |
1255 | 212 | set_type = type == isl_dim_in ? isl_dim_set : type0 ; |
1256 | 212 | |
1257 | 212 | pw = FN(PW,cow)(pw); |
1258 | 212 | if (!pw) |
1259 | 0 | return NULL; |
1260 | 212 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); |
1261 | 212 | if (!pw->dim) |
1262 | 0 | goto error; |
1263 | 608 | for (i = 0; 212 i < pw->n; ++i396 ) { |
1264 | 396 | pw->p[i].set = isl_set_project_out(pw->p[i].set, |
1265 | 396 | set_type, first, n); |
1266 | 396 | if (!pw->p[i].set) |
1267 | 0 | goto error; |
1268 | 396 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); |
1269 | 396 | if (!pw->p[i].FIELD) |
1270 | 396 | goto error0 ; |
1271 | 396 | } |
1272 | 212 | |
1273 | 212 | return pw; |
1274 | 212 | error: |
1275 | 0 | FN(PW,free)(pw); |
1276 | 0 | return NULL; |
1277 | 212 | } Line | Count | Source | 1246 | 7 | { | 1247 | 7 | int i; | 1248 | 7 | enum isl_dim_type set_type; | 1249 | 7 | | 1250 | 7 | if (!pw) | 1251 | 0 | return NULL; | 1252 | 7 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)) | 1253 | 0 | return pw; | 1254 | 7 | | 1255 | 7 | set_type = type == isl_dim_in ? isl_dim_set : type0 ; | 1256 | 7 | | 1257 | 7 | pw = FN(PW,cow)(pw); | 1258 | 7 | if (!pw) | 1259 | 0 | return NULL; | 1260 | 7 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); | 1261 | 7 | if (!pw->dim) | 1262 | 0 | goto error; | 1263 | 16 | for (i = 0; 7 i < pw->n; ++i9 ) { | 1264 | 9 | pw->p[i].set = isl_set_project_out(pw->p[i].set, | 1265 | 9 | set_type, first, n); | 1266 | 9 | if (!pw->p[i].set) | 1267 | 0 | goto error; | 1268 | 9 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); | 1269 | 9 | if (!pw->p[i].FIELD) | 1270 | 9 | goto error0 ; | 1271 | 9 | } | 1272 | 7 | | 1273 | 7 | return pw; | 1274 | 7 | error: | 1275 | 0 | FN(PW,free)(pw); | 1276 | 0 | return NULL; | 1277 | 7 | } |
isl_pw_multi_aff_project_out Line | Count | Source | 1246 | 204 | { | 1247 | 204 | int i; | 1248 | 204 | enum isl_dim_type set_type; | 1249 | 204 | | 1250 | 204 | if (!pw) | 1251 | 0 | return NULL; | 1252 | 204 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)11 ) | 1253 | 0 | return pw; | 1254 | 204 | | 1255 | 204 | set_type = type == isl_dim_in ? isl_dim_set : type0 ; | 1256 | 204 | | 1257 | 204 | pw = FN(PW,cow)(pw); | 1258 | 204 | if (!pw) | 1259 | 0 | return NULL; | 1260 | 204 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); | 1261 | 204 | if (!pw->dim) | 1262 | 0 | goto error; | 1263 | 590 | for (i = 0; 204 i < pw->n; ++i386 ) { | 1264 | 386 | pw->p[i].set = isl_set_project_out(pw->p[i].set, | 1265 | 386 | set_type, first, n); | 1266 | 386 | if (!pw->p[i].set) | 1267 | 0 | goto error; | 1268 | 386 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); | 1269 | 386 | if (!pw->p[i].FIELD) | 1270 | 386 | goto error0 ; | 1271 | 386 | } | 1272 | 204 | | 1273 | 204 | return pw; | 1274 | 204 | error: | 1275 | 0 | FN(PW,free)(pw); | 1276 | 0 | return NULL; | 1277 | 204 | } |
isl_pw_qpolynomial_fold_project_out Line | Count | Source | 1246 | 1 | { | 1247 | 1 | int i; | 1248 | 1 | enum isl_dim_type set_type; | 1249 | 1 | | 1250 | 1 | if (!pw) | 1251 | 0 | return NULL; | 1252 | 1 | if (n == 0 && !isl_space_get_tuple_name(pw->dim, type)) | 1253 | 0 | return pw; | 1254 | 1 | | 1255 | 1 | set_type = type == isl_dim_in ? isl_dim_set : type0 ; | 1256 | 1 | | 1257 | 1 | pw = FN(PW,cow)(pw); | 1258 | 1 | if (!pw) | 1259 | 0 | return NULL; | 1260 | 1 | pw->dim = isl_space_drop_dims(pw->dim, type, first, n); | 1261 | 1 | if (!pw->dim) | 1262 | 0 | goto error; | 1263 | 2 | for (i = 0; 1 i < pw->n; ++i1 ) { | 1264 | 1 | pw->p[i].set = isl_set_project_out(pw->p[i].set, | 1265 | 1 | set_type, first, n); | 1266 | 1 | if (!pw->p[i].set) | 1267 | 0 | goto error; | 1268 | 1 | pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n); | 1269 | 1 | if (!pw->p[i].FIELD) | 1270 | 1 | goto error0 ; | 1271 | 1 | } | 1272 | 1 | | 1273 | 1 | return pw; | 1274 | 1 | error: | 1275 | 0 | FN(PW,free)(pw); | 1276 | 0 | return NULL; | 1277 | 1 | } |
Unexecuted instantiation: isl_pw_qpolynomial_project_out |
1278 | | |
1279 | | /* Project the domain of pw onto its parameter space. |
1280 | | */ |
1281 | | __isl_give PW *FN(PW,project_domain_on_params)(__isl_take PW *pw) |
1282 | 19 | { |
1283 | 19 | isl_space *space; |
1284 | 19 | unsigned n; |
1285 | 19 | |
1286 | 19 | n = FN(PW,dim)(pw, isl_dim_in); |
1287 | 19 | pw = FN(PW,project_out)(pw, isl_dim_in, 0, n); |
1288 | 19 | space = FN(PW,get_domain_space)(pw); |
1289 | 19 | space = isl_space_params(space); |
1290 | 19 | pw = FN(PW,reset_domain_space)(pw, space); |
1291 | 19 | return pw; |
1292 | 19 | } isl_pw_aff_project_domain_on_params Line | Count | Source | 1282 | 7 | { | 1283 | 7 | isl_space *space; | 1284 | 7 | unsigned n; | 1285 | 7 | | 1286 | 7 | n = FN(PW,dim)(pw, isl_dim_in); | 1287 | 7 | pw = FN(PW,project_out)(pw, isl_dim_in, 0, n); | 1288 | 7 | space = FN(PW,get_domain_space)(pw); | 1289 | 7 | space = isl_space_params(space); | 1290 | 7 | pw = FN(PW,reset_domain_space)(pw, space); | 1291 | 7 | return pw; | 1292 | 7 | } |
isl_pw_multi_aff_project_domain_on_params Line | Count | Source | 1282 | 11 | { | 1283 | 11 | isl_space *space; | 1284 | 11 | unsigned n; | 1285 | 11 | | 1286 | 11 | n = FN(PW,dim)(pw, isl_dim_in); | 1287 | 11 | pw = FN(PW,project_out)(pw, isl_dim_in, 0, n); | 1288 | 11 | space = FN(PW,get_domain_space)(pw); | 1289 | 11 | space = isl_space_params(space); | 1290 | 11 | pw = FN(PW,reset_domain_space)(pw, space); | 1291 | 11 | return pw; | 1292 | 11 | } |
isl_pw_qpolynomial_fold_project_domain_on_params Line | Count | Source | 1282 | 1 | { | 1283 | 1 | isl_space *space; | 1284 | 1 | unsigned n; | 1285 | 1 | | 1286 | 1 | n = FN(PW,dim)(pw, isl_dim_in); | 1287 | 1 | pw = FN(PW,project_out)(pw, isl_dim_in, 0, n); | 1288 | 1 | space = FN(PW,get_domain_space)(pw); | 1289 | 1 | space = isl_space_params(space); | 1290 | 1 | pw = FN(PW,reset_domain_space)(pw, space); | 1291 | 1 | return pw; | 1292 | 1 | } |
Unexecuted instantiation: isl_pw_qpolynomial_project_domain_on_params |
1293 | | |
1294 | | /* Drop all parameters not referenced by "pw". |
1295 | | */ |
1296 | | __isl_give PW *FN(PW,drop_unused_params)(__isl_take PW *pw) |
1297 | 1 | { |
1298 | 1 | int i; |
1299 | 1 | |
1300 | 1 | if (FN(PW,check_named_params)(pw) < 0) |
1301 | 0 | return FN(PW,free)(pw); |
1302 | 1 | |
1303 | 4 | for (i = 1 FN1 (PW,dim)(pw, isl_dim_param) - 1; i >= 0; i--3 ) { |
1304 | 3 | isl_bool involves; |
1305 | 3 | |
1306 | 3 | involves = FN(PW,involves_dims)(pw, isl_dim_param, i, 1); |
1307 | 3 | if (involves < 0) |
1308 | 0 | return FN(PW,free)(pw); |
1309 | 3 | if (!involves) |
1310 | 2 | pw = FN(PW,drop_dims)(pw, isl_dim_param, i, 1); |
1311 | 3 | } |
1312 | 1 | |
1313 | 1 | return pw; |
1314 | 1 | } isl_pw_aff_drop_unused_params Line | Count | Source | 1297 | 1 | { | 1298 | 1 | int i; | 1299 | 1 | | 1300 | 1 | if (FN(PW,check_named_params)(pw) < 0) | 1301 | 0 | return FN(PW,free)(pw); | 1302 | 1 | | 1303 | 4 | for (i = 1 FN1 (PW,dim)(pw, isl_dim_param) - 1; i >= 0; i--3 ) { | 1304 | 3 | isl_bool involves; | 1305 | 3 | | 1306 | 3 | involves = FN(PW,involves_dims)(pw, isl_dim_param, i, 1); | 1307 | 3 | if (involves < 0) | 1308 | 0 | return FN(PW,free)(pw); | 1309 | 3 | if (!involves) | 1310 | 2 | pw = FN(PW,drop_dims)(pw, isl_dim_param, i, 1); | 1311 | 3 | } | 1312 | 1 | | 1313 | 1 | return pw; | 1314 | 1 | } |
Unexecuted instantiation: isl_pw_multi_aff_drop_unused_params Unexecuted instantiation: isl_pw_qpolynomial_fold_drop_unused_params Unexecuted instantiation: isl_pw_qpolynomial_drop_unused_params |
1315 | | |
1316 | | #ifndef NO_INSERT_DIMS |
1317 | | __isl_give PW *FN(PW,insert_dims)(__isl_take PW *pw, enum isl_dim_type type, |
1318 | | unsigned first, unsigned n) |
1319 | 3.85k | { |
1320 | 3.85k | int i; |
1321 | 3.85k | enum isl_dim_type set_type; |
1322 | 3.85k | |
1323 | 3.85k | if (!pw) |
1324 | 0 | return NULL; |
1325 | 3.85k | if (n == 0 && !isl_space_is_named_or_nested(pw->dim, type)15 ) |
1326 | 13 | return pw; |
1327 | 3.83k | |
1328 | 3.83k | set_type = type == isl_dim_in ? isl_dim_set : type0 ; |
1329 | 3.83k | |
1330 | 3.83k | pw = FN(PW,cow)(pw); |
1331 | 3.83k | if (!pw) |
1332 | 0 | return NULL; |
1333 | 3.83k | |
1334 | 3.83k | pw->dim = isl_space_insert_dims(pw->dim, type, first, n); |
1335 | 3.83k | if (!pw->dim) |
1336 | 0 | goto error; |
1337 | 3.83k | |
1338 | 7.67k | for (i = 0; 3.83k i < pw->n; ++i3.83k ) { |
1339 | 3.83k | pw->p[i].set = isl_set_insert_dims(pw->p[i].set, |
1340 | 3.83k | set_type, first, n); |
1341 | 3.83k | if (!pw->p[i].set) |
1342 | 0 | goto error; |
1343 | 3.83k | pw->p[i].FIELD = FN(EL,insert_dims)(pw->p[i].FIELD, |
1344 | 3.83k | type, first, n); |
1345 | 3.83k | if (!pw->p[i].FIELD) |
1346 | 3.83k | goto error0 ; |
1347 | 3.83k | } |
1348 | 3.83k | |
1349 | 3.83k | return pw; |
1350 | 3.83k | error: |
1351 | 0 | FN(PW,free)(pw); |
1352 | 0 | return NULL; |
1353 | 3.83k | } Line | Count | Source | 1319 | 3.85k | { | 1320 | 3.85k | int i; | 1321 | 3.85k | enum isl_dim_type set_type; | 1322 | 3.85k | | 1323 | 3.85k | if (!pw) | 1324 | 0 | return NULL; | 1325 | 3.85k | if (n == 0 && !isl_space_is_named_or_nested(pw->dim, type)15 ) | 1326 | 13 | return pw; | 1327 | 3.83k | | 1328 | 3.83k | set_type = type == isl_dim_in ? isl_dim_set : type0 ; | 1329 | 3.83k | | 1330 | 3.83k | pw = FN(PW,cow)(pw); | 1331 | 3.83k | if (!pw) | 1332 | 0 | return NULL; | 1333 | 3.83k | | 1334 | 3.83k | pw->dim = isl_space_insert_dims(pw->dim, type, first, n); | 1335 | 3.83k | if (!pw->dim) | 1336 | 0 | goto error; | 1337 | 3.83k | | 1338 | 7.67k | for (i = 0; 3.83k i < pw->n; ++i3.83k ) { | 1339 | 3.83k | pw->p[i].set = isl_set_insert_dims(pw->p[i].set, | 1340 | 3.83k | set_type, first, n); | 1341 | 3.83k | if (!pw->p[i].set) | 1342 | 0 | goto error; | 1343 | 3.83k | pw->p[i].FIELD = FN(EL,insert_dims)(pw->p[i].FIELD, | 1344 | 3.83k | type, first, n); | 1345 | 3.83k | if (!pw->p[i].FIELD) | 1346 | 3.83k | goto error0 ; | 1347 | 3.83k | } | 1348 | 3.83k | | 1349 | 3.83k | return pw; | 1350 | 3.83k | error: | 1351 | 0 | FN(PW,free)(pw); | 1352 | 0 | return NULL; | 1353 | 3.83k | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_insert_dims Unexecuted instantiation: isl_pw_qpolynomial_insert_dims |
1354 | | #endif |
1355 | | |
1356 | | __isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw, |
1357 | | enum isl_dim_type type, unsigned pos, isl_int v) |
1358 | 1 | { |
1359 | 1 | int i; |
1360 | 1 | |
1361 | 1 | if (!pw) |
1362 | 0 | return NULL; |
1363 | 1 | |
1364 | 1 | if (type == isl_dim_in) |
1365 | 0 | type = isl_dim_set; |
1366 | 1 | |
1367 | 1 | pw = FN(PW,cow)(pw); |
1368 | 1 | if (!pw) |
1369 | 0 | return NULL; |
1370 | 2 | for (i = 0; 1 i < pw->n; ++i1 ) { |
1371 | 1 | pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v); |
1372 | 1 | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) |
1373 | 0 | return FN(PW,free)(pw); |
1374 | 1 | } |
1375 | 1 | |
1376 | 1 | return pw; |
1377 | 1 | } Unexecuted instantiation: isl_pw_aff_fix_dim Unexecuted instantiation: isl_pw_multi_aff_fix_dim Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_dim isl_pw_qpolynomial_fix_dim Line | Count | Source | 1358 | 1 | { | 1359 | 1 | int i; | 1360 | 1 | | 1361 | 1 | if (!pw) | 1362 | 0 | return NULL; | 1363 | 1 | | 1364 | 1 | if (type == isl_dim_in) | 1365 | 0 | type = isl_dim_set; | 1366 | 1 | | 1367 | 1 | pw = FN(PW,cow)(pw); | 1368 | 1 | if (!pw) | 1369 | 0 | return NULL; | 1370 | 2 | for (i = 0; 1 i < pw->n; ++i1 ) { | 1371 | 1 | pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v); | 1372 | 1 | if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) | 1373 | 0 | return FN(PW,free)(pw); | 1374 | 1 | } | 1375 | 1 | | 1376 | 1 | return pw; | 1377 | 1 | } |
|
1378 | | |
1379 | | /* Fix the value of the variable at position "pos" of type "type" of "pw" |
1380 | | * to be equal to "v". |
1381 | | */ |
1382 | | __isl_give PW *FN(PW,fix_val)(__isl_take PW *pw, |
1383 | | enum isl_dim_type type, unsigned pos, __isl_take isl_val *v) |
1384 | 1 | { |
1385 | 1 | if (!v) |
1386 | 0 | return FN(PW,free)(pw); |
1387 | 1 | if (!isl_val_is_int(v)) |
1388 | 1 | isl_die0 (FN(PW,get_ctx)(pw), isl_error_invalid, |
1389 | 1 | "expecting integer value", goto error); |
1390 | 1 | |
1391 | 1 | pw = FN(PW,fix_dim)(pw, type, pos, v->n); |
1392 | 1 | isl_val_free(v); |
1393 | 1 | |
1394 | 1 | return pw; |
1395 | 1 | error: |
1396 | 0 | isl_val_free(v); |
1397 | 0 | return FN(PW,free)(pw); |
1398 | 1 | } Unexecuted instantiation: isl_pw_aff_fix_val Unexecuted instantiation: isl_pw_multi_aff_fix_val Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_val isl_pw_qpolynomial_fix_val Line | Count | Source | 1384 | 1 | { | 1385 | 1 | if (!v) | 1386 | 0 | return FN(PW,free)(pw); | 1387 | 1 | if (!isl_val_is_int(v)) | 1388 | 1 | isl_die0 (FN(PW,get_ctx)(pw), isl_error_invalid, | 1389 | 1 | "expecting integer value", goto error); | 1390 | 1 | | 1391 | 1 | pw = FN(PW,fix_dim)(pw, type, pos, v->n); | 1392 | 1 | isl_val_free(v); | 1393 | 1 | | 1394 | 1 | return pw; | 1395 | 1 | error: | 1396 | 0 | isl_val_free(v); | 1397 | 0 | return FN(PW,free)(pw); | 1398 | 1 | } |
|
1399 | | |
1400 | | unsigned FN(PW,dim)(__isl_keep PW *pw, enum isl_dim_type type) |
1401 | 27.1k | { |
1402 | 27.1k | return pw ? isl_space_dim(pw->dim, type)27.1k : 03 ; |
1403 | 27.1k | } Line | Count | Source | 1401 | 3.86k | { | 1402 | 3.86k | return pw ? isl_space_dim(pw->dim, type) : 00 ; | 1403 | 3.86k | } |
Line | Count | Source | 1401 | 23.3k | { | 1402 | 23.3k | return pw ? isl_space_dim(pw->dim, type)23.3k : 03 ; | 1403 | 23.3k | } |
isl_pw_qpolynomial_fold_dim Line | Count | Source | 1401 | 3 | { | 1402 | 3 | return pw ? isl_space_dim(pw->dim, type) : 00 ; | 1403 | 3 | } |
Unexecuted instantiation: isl_pw_qpolynomial_dim |
1404 | | |
1405 | | __isl_give PW *FN(PW,split_dims)(__isl_take PW *pw, |
1406 | | enum isl_dim_type type, unsigned first, unsigned n) |
1407 | 0 | { |
1408 | 0 | int i; |
1409 | 0 |
|
1410 | 0 | if (!pw) |
1411 | 0 | return NULL; |
1412 | 0 | if (n == 0) |
1413 | 0 | return pw; |
1414 | 0 | |
1415 | 0 | if (type == isl_dim_in) |
1416 | 0 | type = isl_dim_set; |
1417 | 0 |
|
1418 | 0 | pw = FN(PW,cow)(pw); |
1419 | 0 | if (!pw) |
1420 | 0 | return NULL; |
1421 | 0 | if (!pw->dim) |
1422 | 0 | goto error; |
1423 | 0 | for (i = 0; i < pw->n; ++i) { |
1424 | 0 | pw->p[i].set = isl_set_split_dims(pw->p[i].set, type, first, n); |
1425 | 0 | if (!pw->p[i].set) |
1426 | 0 | goto error; |
1427 | 0 | } |
1428 | 0 |
|
1429 | 0 | return pw; |
1430 | 0 | error: |
1431 | 0 | FN(PW,free)(pw); |
1432 | 0 | return NULL; |
1433 | 0 | } Unexecuted instantiation: isl_pw_aff_split_dims Unexecuted instantiation: isl_pw_multi_aff_split_dims Unexecuted instantiation: isl_pw_qpolynomial_fold_split_dims Unexecuted instantiation: isl_pw_qpolynomial_split_dims |
1434 | | |
1435 | | #ifndef NO_OPT |
1436 | | /* Compute the maximal value attained by the piecewise quasipolynomial |
1437 | | * on its domain or zero if the domain is empty. |
1438 | | * In the worst case, the domain is scanned completely, |
1439 | | * so the domain is assumed to be bounded. |
1440 | | */ |
1441 | | __isl_give isl_val *FN(PW,opt)(__isl_take PW *pw, int max) |
1442 | 7 | { |
1443 | 7 | int i; |
1444 | 7 | isl_val *opt; |
1445 | 7 | |
1446 | 7 | if (!pw) |
1447 | 0 | return NULL; |
1448 | 7 | |
1449 | 7 | if (pw->n == 0) { |
1450 | 0 | opt = isl_val_zero(FN(PW,get_ctx)(pw)); |
1451 | 0 | FN(PW,free)(pw); |
1452 | 0 | return opt; |
1453 | 0 | } |
1454 | 7 | |
1455 | 7 | opt = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[0].FIELD), |
1456 | 7 | isl_set_copy(pw->p[0].set), max); |
1457 | 7 | for (i = 1; i < pw->n; ++i0 ) { |
1458 | 0 | isl_val *opt_i; |
1459 | 0 | opt_i = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[i].FIELD), |
1460 | 0 | isl_set_copy(pw->p[i].set), max); |
1461 | 0 | if (max) |
1462 | 0 | opt = isl_val_max(opt, opt_i); |
1463 | 0 | else |
1464 | 0 | opt = isl_val_min(opt, opt_i); |
1465 | 0 | } |
1466 | 7 | |
1467 | 7 | FN(PW,free)(pw); |
1468 | 7 | return opt; |
1469 | 7 | } isl_pw_qpolynomial_fold_opt Line | Count | Source | 1442 | 7 | { | 1443 | 7 | int i; | 1444 | 7 | isl_val *opt; | 1445 | 7 | | 1446 | 7 | if (!pw) | 1447 | 0 | return NULL; | 1448 | 7 | | 1449 | 7 | if (pw->n == 0) { | 1450 | 0 | opt = isl_val_zero(FN(PW,get_ctx)(pw)); | 1451 | 0 | FN(PW,free)(pw); | 1452 | 0 | return opt; | 1453 | 0 | } | 1454 | 7 | | 1455 | 7 | opt = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[0].FIELD), | 1456 | 7 | isl_set_copy(pw->p[0].set), max); | 1457 | 7 | for (i = 1; i < pw->n; ++i0 ) { | 1458 | 0 | isl_val *opt_i; | 1459 | 0 | opt_i = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[i].FIELD), | 1460 | 0 | isl_set_copy(pw->p[i].set), max); | 1461 | 0 | if (max) | 1462 | 0 | opt = isl_val_max(opt, opt_i); | 1463 | 0 | else | 1464 | 0 | opt = isl_val_min(opt, opt_i); | 1465 | 0 | } | 1466 | 7 | | 1467 | 7 | FN(PW,free)(pw); | 1468 | 7 | return opt; | 1469 | 7 | } |
Unexecuted instantiation: isl_pw_qpolynomial_opt |
1470 | | |
1471 | | __isl_give isl_val *FN(PW,max)(__isl_take PW *pw) |
1472 | 2 | { |
1473 | 2 | return FN(PW,opt)(pw, 1); |
1474 | 2 | } isl_pw_qpolynomial_fold_max Line | Count | Source | 1472 | 2 | { | 1473 | 2 | return FN(PW,opt)(pw, 1); | 1474 | 2 | } |
Unexecuted instantiation: isl_pw_qpolynomial_max |
1475 | | |
1476 | | __isl_give isl_val *FN(PW,min)(__isl_take PW *pw) |
1477 | 5 | { |
1478 | 5 | return FN(PW,opt)(pw, 0); |
1479 | 5 | } isl_pw_qpolynomial_fold_min Line | Count | Source | 1477 | 5 | { | 1478 | 5 | return FN(PW,opt)(pw, 0); | 1479 | 5 | } |
Unexecuted instantiation: isl_pw_qpolynomial_min |
1480 | | #endif |
1481 | | |
1482 | | /* Return the space of "pw". |
1483 | | */ |
1484 | | __isl_keep isl_space *FN(PW,peek_space)(__isl_keep PW *pw) |
1485 | 308k | { |
1486 | 308k | return pw ? pw->dim : NULL; |
1487 | 308k | } Line | Count | Source | 1485 | 227k | { | 1486 | 227k | return pw ? pw->dim : NULL; | 1487 | 227k | } |
isl_pw_multi_aff_peek_space Line | Count | Source | 1485 | 81.5k | { | 1486 | 81.5k | return pw ? pw->dim : NULL; | 1487 | 81.5k | } |
isl_pw_qpolynomial_fold_peek_space Line | Count | Source | 1485 | 1 | { | 1486 | 1 | return pw ? pw->dim : NULL; | 1487 | 1 | } |
isl_pw_qpolynomial_peek_space Line | Count | Source | 1485 | 15 | { | 1486 | 15 | return pw ? pw->dim : NULL; | 1487 | 15 | } |
|
1488 | | |
1489 | | __isl_give isl_space *FN(PW,get_space)(__isl_keep PW *pw) |
1490 | 217k | { |
1491 | 217k | return isl_space_copy(FN(PW,peek_space)(pw)); |
1492 | 217k | } Line | Count | Source | 1490 | 156k | { | 1491 | 156k | return isl_space_copy(FN(PW,peek_space)(pw)); | 1492 | 156k | } |
isl_pw_multi_aff_get_space Line | Count | Source | 1490 | 61.3k | { | 1491 | 61.3k | return isl_space_copy(FN(PW,peek_space)(pw)); | 1492 | 61.3k | } |
isl_pw_qpolynomial_fold_get_space Line | Count | Source | 1490 | 1 | { | 1491 | 1 | return isl_space_copy(FN(PW,peek_space)(pw)); | 1492 | 1 | } |
isl_pw_qpolynomial_get_space Line | Count | Source | 1490 | 9 | { | 1491 | 9 | return isl_space_copy(FN(PW,peek_space)(pw)); | 1492 | 9 | } |
|
1493 | | |
1494 | | __isl_give isl_space *FN(PW,get_domain_space)(__isl_keep PW *pw) |
1495 | 112k | { |
1496 | 112k | return pw ? isl_space_domain(isl_space_copy(pw->dim))112k : NULL; |
1497 | 112k | } isl_pw_aff_get_domain_space Line | Count | Source | 1495 | 111k | { | 1496 | 111k | return pw ? isl_space_domain(isl_space_copy(pw->dim))111k : NULL; | 1497 | 111k | } |
isl_pw_multi_aff_get_domain_space Line | Count | Source | 1495 | 1.11k | { | 1496 | 1.11k | return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL; | 1497 | 1.11k | } |
isl_pw_qpolynomial_fold_get_domain_space Line | Count | Source | 1495 | 5 | { | 1496 | 5 | return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL; | 1497 | 5 | } |
isl_pw_qpolynomial_get_domain_space Line | Count | Source | 1495 | 2 | { | 1496 | 2 | return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL; | 1497 | 2 | } |
|
1498 | | |
1499 | | /* Return the position of the dimension of the given type and name |
1500 | | * in "pw". |
1501 | | * Return -1 if no such dimension can be found. |
1502 | | */ |
1503 | | int FN(PW,find_dim_by_name)(__isl_keep PW *pw, |
1504 | | enum isl_dim_type type, const char *name) |
1505 | 0 | { |
1506 | 0 | if (!pw) |
1507 | 0 | return -1; |
1508 | 0 | return isl_space_find_dim_by_name(pw->dim, type, name); |
1509 | 0 | } Unexecuted instantiation: isl_pw_aff_find_dim_by_name Unexecuted instantiation: isl_pw_multi_aff_find_dim_by_name Unexecuted instantiation: isl_pw_qpolynomial_fold_find_dim_by_name Unexecuted instantiation: isl_pw_qpolynomial_find_dim_by_name |
1510 | | |
1511 | | #ifndef NO_RESET_DIM |
1512 | | /* Reset the space of "pw". Since we don't know if the elements |
1513 | | * represent the spaces themselves or their domains, we pass along |
1514 | | * both when we call their reset_space_and_domain. |
1515 | | */ |
1516 | | static __isl_give PW *FN(PW,reset_space_and_domain)(__isl_take PW *pw, |
1517 | | __isl_take isl_space *space, __isl_take isl_space *domain) |
1518 | 72.7k | { |
1519 | 72.7k | int i; |
1520 | 72.7k | |
1521 | 72.7k | pw = FN(PW,cow)(pw); |
1522 | 72.7k | if (!pw || !space || !domain) |
1523 | 0 | goto error; |
1524 | 72.7k | |
1525 | 146k | for (i = 0; 72.7k i < pw->n; ++i73.5k ) { |
1526 | 73.5k | pw->p[i].set = isl_set_reset_space(pw->p[i].set, |
1527 | 73.5k | isl_space_copy(domain)); |
1528 | 73.5k | if (!pw->p[i].set) |
1529 | 0 | goto error; |
1530 | 73.5k | pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD, |
1531 | 73.5k | isl_space_copy(space), isl_space_copy(domain)); |
1532 | 73.5k | if (!pw->p[i].FIELD) |
1533 | 73.5k | goto error0 ; |
1534 | 73.5k | } |
1535 | 72.7k | |
1536 | 72.7k | isl_space_free(domain); |
1537 | 72.7k | |
1538 | 72.7k | isl_space_free(pw->dim); |
1539 | 72.7k | pw->dim = space; |
1540 | 72.7k | |
1541 | 72.7k | return pw; |
1542 | 72.7k | error: |
1543 | 0 | isl_space_free(domain); |
1544 | 0 | isl_space_free(space); |
1545 | 0 | FN(PW,free)(pw); |
1546 | 0 | return NULL; |
1547 | 72.7k | } isl_aff.c:isl_pw_aff_reset_space_and_domain Line | Count | Source | 1518 | 70.0k | { | 1519 | 70.0k | int i; | 1520 | 70.0k | | 1521 | 70.0k | pw = FN(PW,cow)(pw); | 1522 | 70.0k | if (!pw || !space || !domain) | 1523 | 0 | goto error; | 1524 | 70.0k | | 1525 | 140k | for (i = 0; 70.0k i < pw->n; ++i70.5k ) { | 1526 | 70.5k | pw->p[i].set = isl_set_reset_space(pw->p[i].set, | 1527 | 70.5k | isl_space_copy(domain)); | 1528 | 70.5k | if (!pw->p[i].set) | 1529 | 0 | goto error; | 1530 | 70.5k | pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD, | 1531 | 70.5k | isl_space_copy(space), isl_space_copy(domain)); | 1532 | 70.5k | if (!pw->p[i].FIELD) | 1533 | 70.5k | goto error0 ; | 1534 | 70.5k | } | 1535 | 70.0k | | 1536 | 70.0k | isl_space_free(domain); | 1537 | 70.0k | | 1538 | 70.0k | isl_space_free(pw->dim); | 1539 | 70.0k | pw->dim = space; | 1540 | 70.0k | | 1541 | 70.0k | return pw; | 1542 | 70.0k | error: | 1543 | 0 | isl_space_free(domain); | 1544 | 0 | isl_space_free(space); | 1545 | 0 | FN(PW,free)(pw); | 1546 | 0 | return NULL; | 1547 | 70.0k | } |
isl_aff.c:isl_pw_multi_aff_reset_space_and_domain Line | Count | Source | 1518 | 2.75k | { | 1519 | 2.75k | int i; | 1520 | 2.75k | | 1521 | 2.75k | pw = FN(PW,cow)(pw); | 1522 | 2.75k | if (!pw || !space || !domain) | 1523 | 0 | goto error; | 1524 | 2.75k | | 1525 | 5.76k | for (i = 0; 2.75k i < pw->n; ++i3.01k ) { | 1526 | 3.01k | pw->p[i].set = isl_set_reset_space(pw->p[i].set, | 1527 | 3.01k | isl_space_copy(domain)); | 1528 | 3.01k | if (!pw->p[i].set) | 1529 | 0 | goto error; | 1530 | 3.01k | pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD, | 1531 | 3.01k | isl_space_copy(space), isl_space_copy(domain)); | 1532 | 3.01k | if (!pw->p[i].FIELD) | 1533 | 3.01k | goto error0 ; | 1534 | 3.01k | } | 1535 | 2.75k | | 1536 | 2.75k | isl_space_free(domain); | 1537 | 2.75k | | 1538 | 2.75k | isl_space_free(pw->dim); | 1539 | 2.75k | pw->dim = space; | 1540 | 2.75k | | 1541 | 2.75k | return pw; | 1542 | 2.75k | error: | 1543 | 0 | isl_space_free(domain); | 1544 | 0 | isl_space_free(space); | 1545 | 0 | FN(PW,free)(pw); | 1546 | 0 | return NULL; | 1547 | 2.75k | } |
isl_fold.c:isl_pw_qpolynomial_fold_reset_space_and_domain Line | Count | Source | 1518 | 4 | { | 1519 | 4 | int i; | 1520 | 4 | | 1521 | 4 | pw = FN(PW,cow)(pw); | 1522 | 4 | if (!pw || !space || !domain) | 1523 | 0 | goto error; | 1524 | 4 | | 1525 | 7 | for (i = 0; 4 i < pw->n; ++i3 ) { | 1526 | 3 | pw->p[i].set = isl_set_reset_space(pw->p[i].set, | 1527 | 3 | isl_space_copy(domain)); | 1528 | 3 | if (!pw->p[i].set) | 1529 | 0 | goto error; | 1530 | 3 | pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD, | 1531 | 3 | isl_space_copy(space), isl_space_copy(domain)); | 1532 | 3 | if (!pw->p[i].FIELD) | 1533 | 3 | goto error0 ; | 1534 | 3 | } | 1535 | 4 | | 1536 | 4 | isl_space_free(domain); | 1537 | 4 | | 1538 | 4 | isl_space_free(pw->dim); | 1539 | 4 | pw->dim = space; | 1540 | 4 | | 1541 | 4 | return pw; | 1542 | 4 | error: | 1543 | 0 | isl_space_free(domain); | 1544 | 0 | isl_space_free(space); | 1545 | 0 | FN(PW,free)(pw); | 1546 | 0 | return NULL; | 1547 | 4 | } |
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_reset_space_and_domain |
1548 | | |
1549 | | __isl_give PW *FN(PW,reset_domain_space)(__isl_take PW *pw, |
1550 | | __isl_take isl_space *domain) |
1551 | 56.8k | { |
1552 | 56.8k | isl_space *space; |
1553 | 56.8k | |
1554 | 56.8k | space = isl_space_extend_domain_with_range(isl_space_copy(domain), |
1555 | 56.8k | FN(PW,get_space)(pw)); |
1556 | 56.8k | return FN(PW,reset_space_and_domain)(pw, space, domain); |
1557 | 56.8k | } isl_pw_aff_reset_domain_space Line | Count | Source | 1551 | 56.8k | { | 1552 | 56.8k | isl_space *space; | 1553 | 56.8k | | 1554 | 56.8k | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 1555 | 56.8k | FN(PW,get_space)(pw)); | 1556 | 56.8k | return FN(PW,reset_space_and_domain)(pw, space, domain); | 1557 | 56.8k | } |
isl_pw_multi_aff_reset_domain_space Line | Count | Source | 1551 | 18 | { | 1552 | 18 | isl_space *space; | 1553 | 18 | | 1554 | 18 | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 1555 | 18 | FN(PW,get_space)(pw)); | 1556 | 18 | return FN(PW,reset_space_and_domain)(pw, space, domain); | 1557 | 18 | } |
isl_pw_qpolynomial_fold_reset_domain_space Line | Count | Source | 1551 | 1 | { | 1552 | 1 | isl_space *space; | 1553 | 1 | | 1554 | 1 | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 1555 | 1 | FN(PW,get_space)(pw)); | 1556 | 1 | return FN(PW,reset_space_and_domain)(pw, space, domain); | 1557 | 1 | } |
Unexecuted instantiation: isl_pw_qpolynomial_reset_domain_space |
1558 | | |
1559 | | __isl_give PW *FN(PW,reset_space)(__isl_take PW *pw, __isl_take isl_space *dim) |
1560 | 15.8k | { |
1561 | 15.8k | isl_space *domain; |
1562 | 15.8k | |
1563 | 15.8k | domain = isl_space_domain(isl_space_copy(dim)); |
1564 | 15.8k | return FN(PW,reset_space_and_domain)(pw, dim, domain); |
1565 | 15.8k | } Line | Count | Source | 1560 | 13.1k | { | 1561 | 13.1k | isl_space *domain; | 1562 | 13.1k | | 1563 | 13.1k | domain = isl_space_domain(isl_space_copy(dim)); | 1564 | 13.1k | return FN(PW,reset_space_and_domain)(pw, dim, domain); | 1565 | 13.1k | } |
isl_pw_multi_aff_reset_space Line | Count | Source | 1560 | 2.73k | { | 1561 | 2.73k | isl_space *domain; | 1562 | 2.73k | | 1563 | 2.73k | domain = isl_space_domain(isl_space_copy(dim)); | 1564 | 2.73k | return FN(PW,reset_space_and_domain)(pw, dim, domain); | 1565 | 2.73k | } |
isl_pw_qpolynomial_fold_reset_space Line | Count | Source | 1560 | 3 | { | 1561 | 3 | isl_space *domain; | 1562 | 3 | | 1563 | 3 | domain = isl_space_domain(isl_space_copy(dim)); | 1564 | 3 | return FN(PW,reset_space_and_domain)(pw, dim, domain); | 1565 | 3 | } |
Unexecuted instantiation: isl_pw_qpolynomial_reset_space |
1566 | | |
1567 | | __isl_give PW *FN(PW,set_tuple_id)(__isl_take PW *pw, enum isl_dim_type type, |
1568 | | __isl_take isl_id *id) |
1569 | 559 | { |
1570 | 559 | isl_space *space; |
1571 | 559 | |
1572 | 559 | pw = FN(PW,cow)(pw); |
1573 | 559 | if (!pw) |
1574 | 0 | goto error; |
1575 | 559 | |
1576 | 559 | space = FN(PW,get_space)(pw); |
1577 | 559 | space = isl_space_set_tuple_id(space, type, id); |
1578 | 559 | |
1579 | 559 | return FN(PW,reset_space)(pw, space); |
1580 | 559 | error: |
1581 | 0 | isl_id_free(id); |
1582 | 0 | return FN(PW,free)(pw); |
1583 | 559 | } Line | Count | Source | 1569 | 559 | { | 1570 | 559 | isl_space *space; | 1571 | 559 | | 1572 | 559 | pw = FN(PW,cow)(pw); | 1573 | 559 | if (!pw) | 1574 | 0 | goto error; | 1575 | 559 | | 1576 | 559 | space = FN(PW,get_space)(pw); | 1577 | 559 | space = isl_space_set_tuple_id(space, type, id); | 1578 | 559 | | 1579 | 559 | return FN(PW,reset_space)(pw, space); | 1580 | 559 | error: | 1581 | 0 | isl_id_free(id); | 1582 | 0 | return FN(PW,free)(pw); | 1583 | 559 | } |
Unexecuted instantiation: isl_pw_multi_aff_set_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_fold_set_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_set_tuple_id |
1584 | | |
1585 | | /* Drop the id on the specified tuple. |
1586 | | */ |
1587 | | __isl_give PW *FN(PW,reset_tuple_id)(__isl_take PW *pw, enum isl_dim_type type) |
1588 | 0 | { |
1589 | 0 | isl_space *space; |
1590 | 0 |
|
1591 | 0 | if (!pw) |
1592 | 0 | return NULL; |
1593 | 0 | if (!FN(PW,has_tuple_id)(pw, type)) |
1594 | 0 | return pw; |
1595 | 0 | |
1596 | 0 | pw = FN(PW,cow)(pw); |
1597 | 0 | if (!pw) |
1598 | 0 | return NULL; |
1599 | 0 | |
1600 | 0 | space = FN(PW,get_space)(pw); |
1601 | 0 | space = isl_space_reset_tuple_id(space, type); |
1602 | 0 |
|
1603 | 0 | return FN(PW,reset_space)(pw, space); |
1604 | 0 | } Unexecuted instantiation: isl_pw_aff_reset_tuple_id Unexecuted instantiation: isl_pw_multi_aff_reset_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_tuple_id Unexecuted instantiation: isl_pw_qpolynomial_reset_tuple_id |
1605 | | |
1606 | | __isl_give PW *FN(PW,set_dim_id)(__isl_take PW *pw, |
1607 | | enum isl_dim_type type, unsigned pos, __isl_take isl_id *id) |
1608 | 0 | { |
1609 | 0 | pw = FN(PW,cow)(pw); |
1610 | 0 | if (!pw) |
1611 | 0 | goto error; |
1612 | 0 | pw->dim = isl_space_set_dim_id(pw->dim, type, pos, id); |
1613 | 0 | return FN(PW,reset_space)(pw, isl_space_copy(pw->dim)); |
1614 | 0 | error: |
1615 | 0 | isl_id_free(id); |
1616 | 0 | return FN(PW,free)(pw); |
1617 | 0 | } Unexecuted instantiation: isl_pw_aff_set_dim_id Unexecuted instantiation: isl_pw_multi_aff_set_dim_id Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_id Unexecuted instantiation: isl_pw_qpolynomial_set_dim_id |
1618 | | #endif |
1619 | | |
1620 | | /* Reset the user pointer on all identifiers of parameters and tuples |
1621 | | * of the space of "pw". |
1622 | | */ |
1623 | | __isl_give PW *FN(PW,reset_user)(__isl_take PW *pw) |
1624 | 0 | { |
1625 | 0 | isl_space *space; |
1626 | 0 |
|
1627 | 0 | space = FN(PW,get_space)(pw); |
1628 | 0 | space = isl_space_reset_user(space); |
1629 | 0 |
|
1630 | 0 | return FN(PW,reset_space)(pw, space); |
1631 | 0 | } Unexecuted instantiation: isl_pw_aff_reset_user Unexecuted instantiation: isl_pw_multi_aff_reset_user Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_user Unexecuted instantiation: isl_pw_qpolynomial_reset_user |
1632 | | |
1633 | | isl_bool FN(PW,has_equal_space)(__isl_keep PW *pw1, __isl_keep PW *pw2) |
1634 | 4 | { |
1635 | 4 | if (!pw1 || !pw2) |
1636 | 0 | return isl_bool_error; |
1637 | 4 | |
1638 | 4 | return isl_space_is_equal(pw1->dim, pw2->dim); |
1639 | 4 | } Unexecuted instantiation: isl_pw_aff_has_equal_space Unexecuted instantiation: isl_pw_multi_aff_has_equal_space Unexecuted instantiation: isl_pw_qpolynomial_fold_has_equal_space isl_pw_qpolynomial_has_equal_space Line | Count | Source | 1634 | 4 | { | 1635 | 4 | if (!pw1 || !pw2) | 1636 | 0 | return isl_bool_error; | 1637 | 4 | | 1638 | 4 | return isl_space_is_equal(pw1->dim, pw2->dim); | 1639 | 4 | } |
|
1640 | | |
1641 | | #ifndef NO_MORPH |
1642 | | __isl_give PW *FN(PW,morph_domain)(__isl_take PW *pw, |
1643 | | __isl_take isl_morph *morph) |
1644 | 2 | { |
1645 | 2 | int i; |
1646 | 2 | isl_ctx *ctx; |
1647 | 2 | |
1648 | 2 | if (!pw || !morph) |
1649 | 0 | goto error; |
1650 | 2 | |
1651 | 2 | ctx = isl_space_get_ctx(pw->dim); |
1652 | 2 | isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim), |
1653 | 2 | goto error); |
1654 | 2 | |
1655 | 2 | pw = FN(PW,cow)(pw); |
1656 | 2 | if (!pw) |
1657 | 0 | goto error; |
1658 | 2 | pw->dim = isl_space_extend_domain_with_range( |
1659 | 2 | isl_space_copy(morph->ran->dim), pw->dim); |
1660 | 2 | if (!pw->dim) |
1661 | 0 | goto error; |
1662 | 2 | |
1663 | 3 | for (i = 0; 2 i < pw->n; ++i1 ) { |
1664 | 1 | pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set); |
1665 | 1 | if (!pw->p[i].set) |
1666 | 0 | goto error; |
1667 | 1 | pw->p[i].FIELD = FN(EL,morph_domain)(pw->p[i].FIELD, |
1668 | 1 | isl_morph_copy(morph)); |
1669 | 1 | if (!pw->p[i].FIELD) |
1670 | 1 | goto error0 ; |
1671 | 1 | } |
1672 | 2 | |
1673 | 2 | isl_morph_free(morph); |
1674 | 2 | |
1675 | 2 | return pw; |
1676 | 2 | error: |
1677 | 0 | FN(PW,free)(pw); |
1678 | 0 | isl_morph_free(morph); |
1679 | 0 | return NULL; |
1680 | 2 | } isl_pw_qpolynomial_fold_morph_domain Line | Count | Source | 1644 | 2 | { | 1645 | 2 | int i; | 1646 | 2 | isl_ctx *ctx; | 1647 | 2 | | 1648 | 2 | if (!pw || !morph) | 1649 | 0 | goto error; | 1650 | 2 | | 1651 | 2 | ctx = isl_space_get_ctx(pw->dim); | 1652 | 2 | isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim), | 1653 | 2 | goto error); | 1654 | 2 | | 1655 | 2 | pw = FN(PW,cow)(pw); | 1656 | 2 | if (!pw) | 1657 | 0 | goto error; | 1658 | 2 | pw->dim = isl_space_extend_domain_with_range( | 1659 | 2 | isl_space_copy(morph->ran->dim), pw->dim); | 1660 | 2 | if (!pw->dim) | 1661 | 0 | goto error; | 1662 | 2 | | 1663 | 3 | for (i = 0; 2 i < pw->n; ++i1 ) { | 1664 | 1 | pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set); | 1665 | 1 | if (!pw->p[i].set) | 1666 | 0 | goto error; | 1667 | 1 | pw->p[i].FIELD = FN(EL,morph_domain)(pw->p[i].FIELD, | 1668 | 1 | isl_morph_copy(morph)); | 1669 | 1 | if (!pw->p[i].FIELD) | 1670 | 1 | goto error0 ; | 1671 | 1 | } | 1672 | 2 | | 1673 | 2 | isl_morph_free(morph); | 1674 | 2 | | 1675 | 2 | return pw; | 1676 | 2 | error: | 1677 | 0 | FN(PW,free)(pw); | 1678 | 0 | isl_morph_free(morph); | 1679 | 0 | return NULL; | 1680 | 2 | } |
Unexecuted instantiation: isl_pw_qpolynomial_morph_domain |
1681 | | #endif |
1682 | | |
1683 | | int FN(PW,n_piece)(__isl_keep PW *pw) |
1684 | 11.6k | { |
1685 | 11.6k | return pw ? pw->n : 00 ; |
1686 | 11.6k | } Line | Count | Source | 1684 | 11.6k | { | 1685 | 11.6k | return pw ? pw->n : 00 ; | 1686 | 11.6k | } |
Unexecuted instantiation: isl_pw_multi_aff_n_piece Unexecuted instantiation: isl_pw_qpolynomial_fold_n_piece Unexecuted instantiation: isl_pw_qpolynomial_n_piece |
1687 | | |
1688 | | isl_stat FN(PW,foreach_piece)(__isl_keep PW *pw, |
1689 | | isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el, void *user), |
1690 | | void *user) |
1691 | 12.9k | { |
1692 | 12.9k | int i; |
1693 | 12.9k | |
1694 | 12.9k | if (!pw) |
1695 | 0 | return isl_stat_error; |
1696 | 12.9k | |
1697 | 22.3k | for (i = 0; 12.9k i < pw->n; ++i9.42k ) |
1698 | 13.3k | if (fn(isl_set_copy(pw->p[i].set), |
1699 | 13.3k | FN(EL,copy)(pw->p[i].FIELD), user) < 0) |
1700 | 3.89k | return isl_stat_error; |
1701 | 12.9k | |
1702 | 12.9k | return isl_stat_ok9.05k ; |
1703 | 12.9k | } Line | Count | Source | 1691 | 12.9k | { | 1692 | 12.9k | int i; | 1693 | 12.9k | | 1694 | 12.9k | if (!pw) | 1695 | 0 | return isl_stat_error; | 1696 | 12.9k | | 1697 | 22.3k | for (i = 0; 12.9k i < pw->n; ++i9.41k ) | 1698 | 13.3k | if (fn(isl_set_copy(pw->p[i].set), | 1699 | 13.3k | FN(EL,copy)(pw->p[i].FIELD), user) < 0) | 1700 | 3.89k | return isl_stat_error; | 1701 | 12.9k | | 1702 | 12.9k | return isl_stat_ok9.04k ; | 1703 | 12.9k | } |
isl_pw_multi_aff_foreach_piece Line | Count | Source | 1691 | 2 | { | 1692 | 2 | int i; | 1693 | 2 | | 1694 | 2 | if (!pw) | 1695 | 0 | return isl_stat_error; | 1696 | 2 | | 1697 | 4 | for (i = 0; 2 i < pw->n; ++i2 ) | 1698 | 2 | if (fn(isl_set_copy(pw->p[i].set), | 1699 | 2 | FN(EL,copy)(pw->p[i].FIELD), user) < 0) | 1700 | 0 | return isl_stat_error; | 1701 | 2 | | 1702 | 2 | return isl_stat_ok; | 1703 | 2 | } |
Unexecuted instantiation: isl_pw_qpolynomial_fold_foreach_piece isl_pw_qpolynomial_foreach_piece Line | Count | Source | 1691 | 1 | { | 1692 | 1 | int i; | 1693 | 1 | | 1694 | 1 | if (!pw) | 1695 | 0 | return isl_stat_error; | 1696 | 1 | | 1697 | 3 | for (i = 0; 1 i < pw->n; ++i2 ) | 1698 | 2 | if (fn(isl_set_copy(pw->p[i].set), | 1699 | 2 | FN(EL,copy)(pw->p[i].FIELD), user) < 0) | 1700 | 0 | return isl_stat_error; | 1701 | 1 | | 1702 | 1 | return isl_stat_ok; | 1703 | 1 | } |
|
1704 | | |
1705 | | #ifndef NO_LIFT |
1706 | | static isl_bool any_divs(__isl_keep isl_set *set) |
1707 | 2 | { |
1708 | 2 | int i; |
1709 | 2 | |
1710 | 2 | if (!set) |
1711 | 0 | return isl_bool_error; |
1712 | 2 | |
1713 | 3 | for (i = 0; 2 i < set->n; ++i1 ) |
1714 | 2 | if (set->p[i]->n_div > 0) |
1715 | 1 | return isl_bool_true; |
1716 | 2 | |
1717 | 2 | return isl_bool_false1 ; |
1718 | 2 | } Unexecuted instantiation: isl_polynomial.c:any_divs |
1719 | | |
1720 | | static isl_stat foreach_lifted_subset(__isl_take isl_set *set, |
1721 | | __isl_take EL *el, |
1722 | | isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el, |
1723 | | void *user), void *user) |
1724 | 1 | { |
1725 | 1 | int i; |
1726 | 1 | |
1727 | 1 | if (!set || !el) |
1728 | 0 | goto error; |
1729 | 1 | |
1730 | 2 | for (i = 0; 1 i < set->n; ++i1 ) { |
1731 | 1 | isl_set *lift; |
1732 | 1 | EL *copy; |
1733 | 1 | |
1734 | 1 | lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i])); |
1735 | 1 | lift = isl_set_lift(lift); |
1736 | 1 | |
1737 | 1 | copy = FN(EL,copy)(el); |
1738 | 1 | copy = FN(EL,lift)(copy, isl_set_get_space(lift)); |
1739 | 1 | |
1740 | 1 | if (fn(lift, copy, user) < 0) |
1741 | 0 | goto error; |
1742 | 1 | } |
1743 | 1 | |
1744 | 1 | isl_set_free(set); |
1745 | 1 | FN(EL,free)(el); |
1746 | 1 | |
1747 | 1 | return isl_stat_ok; |
1748 | 1 | error: |
1749 | 0 | isl_set_free(set); |
1750 | 0 | FN(EL,free)(el); |
1751 | 0 | return isl_stat_error; |
1752 | 1 | } isl_fold.c:foreach_lifted_subset Line | Count | Source | 1724 | 1 | { | 1725 | 1 | int i; | 1726 | 1 | | 1727 | 1 | if (!set || !el) | 1728 | 0 | goto error; | 1729 | 1 | | 1730 | 2 | for (i = 0; 1 i < set->n; ++i1 ) { | 1731 | 1 | isl_set *lift; | 1732 | 1 | EL *copy; | 1733 | 1 | | 1734 | 1 | lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i])); | 1735 | 1 | lift = isl_set_lift(lift); | 1736 | 1 | | 1737 | 1 | copy = FN(EL,copy)(el); | 1738 | 1 | copy = FN(EL,lift)(copy, isl_set_get_space(lift)); | 1739 | 1 | | 1740 | 1 | if (fn(lift, copy, user) < 0) | 1741 | 0 | goto error; | 1742 | 1 | } | 1743 | 1 | | 1744 | 1 | isl_set_free(set); | 1745 | 1 | FN(EL,free)(el); | 1746 | 1 | | 1747 | 1 | return isl_stat_ok; | 1748 | 1 | error: | 1749 | 0 | isl_set_free(set); | 1750 | 0 | FN(EL,free)(el); | 1751 | 0 | return isl_stat_error; | 1752 | 1 | } |
Unexecuted instantiation: isl_polynomial.c:foreach_lifted_subset |
1753 | | |
1754 | | isl_stat FN(PW,foreach_lifted_piece)(__isl_keep PW *pw, |
1755 | | isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el, |
1756 | | void *user), void *user) |
1757 | 2 | { |
1758 | 2 | int i; |
1759 | 2 | |
1760 | 2 | if (!pw) |
1761 | 0 | return isl_stat_error; |
1762 | 2 | |
1763 | 4 | for (i = 0; 2 i < pw->n; ++i2 ) { |
1764 | 2 | isl_bool any; |
1765 | 2 | isl_set *set; |
1766 | 2 | EL *el; |
1767 | 2 | |
1768 | 2 | any = any_divs(pw->p[i].set); |
1769 | 2 | if (any < 0) |
1770 | 0 | return isl_stat_error; |
1771 | 2 | set = isl_set_copy(pw->p[i].set); |
1772 | 2 | el = FN(EL,copy)(pw->p[i].FIELD); |
1773 | 2 | if (!any) { |
1774 | 1 | if (fn(set, el, user) < 0) |
1775 | 0 | return isl_stat_error; |
1776 | 1 | continue; |
1777 | 1 | } |
1778 | 1 | if (foreach_lifted_subset(set, el, fn, user) < 0) |
1779 | 0 | return isl_stat_error; |
1780 | 1 | } |
1781 | 2 | |
1782 | 2 | return isl_stat_ok; |
1783 | 2 | } isl_pw_qpolynomial_fold_foreach_lifted_piece Line | Count | Source | 1757 | 2 | { | 1758 | 2 | int i; | 1759 | 2 | | 1760 | 2 | if (!pw) | 1761 | 0 | return isl_stat_error; | 1762 | 2 | | 1763 | 4 | for (i = 0; 2 i < pw->n; ++i2 ) { | 1764 | 2 | isl_bool any; | 1765 | 2 | isl_set *set; | 1766 | 2 | EL *el; | 1767 | 2 | | 1768 | 2 | any = any_divs(pw->p[i].set); | 1769 | 2 | if (any < 0) | 1770 | 0 | return isl_stat_error; | 1771 | 2 | set = isl_set_copy(pw->p[i].set); | 1772 | 2 | el = FN(EL,copy)(pw->p[i].FIELD); | 1773 | 2 | if (!any) { | 1774 | 1 | if (fn(set, el, user) < 0) | 1775 | 0 | return isl_stat_error; | 1776 | 1 | continue; | 1777 | 1 | } | 1778 | 1 | if (foreach_lifted_subset(set, el, fn, user) < 0) | 1779 | 0 | return isl_stat_error; | 1780 | 1 | } | 1781 | 2 | | 1782 | 2 | return isl_stat_ok; | 1783 | 2 | } |
Unexecuted instantiation: isl_pw_qpolynomial_foreach_lifted_piece |
1784 | | #endif |
1785 | | |
1786 | | #ifndef NO_MOVE_DIMS |
1787 | | __isl_give PW *FN(PW,move_dims)(__isl_take PW *pw, |
1788 | | enum isl_dim_type dst_type, unsigned dst_pos, |
1789 | | enum isl_dim_type src_type, unsigned src_pos, unsigned n) |
1790 | 1 | { |
1791 | 1 | int i; |
1792 | 1 | |
1793 | 1 | pw = FN(PW,cow)(pw); |
1794 | 1 | if (!pw) |
1795 | 0 | return NULL; |
1796 | 1 | |
1797 | 1 | pw->dim = isl_space_move_dims(pw->dim, dst_type, dst_pos, src_type, src_pos, n); |
1798 | 1 | if (!pw->dim) |
1799 | 0 | goto error; |
1800 | 1 | |
1801 | 2 | for (i = 0; 1 i < pw->n; ++i1 ) { |
1802 | 1 | pw->p[i].FIELD = FN(EL,move_dims)(pw->p[i].FIELD, |
1803 | 1 | dst_type, dst_pos, src_type, src_pos, n); |
1804 | 1 | if (!pw->p[i].FIELD) |
1805 | 1 | goto error0 ; |
1806 | 1 | } |
1807 | 1 | |
1808 | 1 | if (dst_type == isl_dim_in) |
1809 | 0 | dst_type = isl_dim_set; |
1810 | 1 | if (src_type == isl_dim_in) |
1811 | 1 | src_type = isl_dim_set; |
1812 | 1 | |
1813 | 2 | for (i = 0; i < pw->n; ++i1 ) { |
1814 | 1 | pw->p[i].set = isl_set_move_dims(pw->p[i].set, |
1815 | 1 | dst_type, dst_pos, |
1816 | 1 | src_type, src_pos, n); |
1817 | 1 | if (!pw->p[i].set) |
1818 | 0 | goto error; |
1819 | 1 | } |
1820 | 1 | |
1821 | 1 | return pw; |
1822 | 1 | error: |
1823 | 0 | FN(PW,free)(pw); |
1824 | 0 | return NULL; |
1825 | 1 | } Unexecuted instantiation: isl_pw_aff_move_dims Unexecuted instantiation: isl_pw_multi_aff_move_dims Unexecuted instantiation: isl_pw_qpolynomial_fold_move_dims isl_pw_qpolynomial_move_dims Line | Count | Source | 1790 | 1 | { | 1791 | 1 | int i; | 1792 | 1 | | 1793 | 1 | pw = FN(PW,cow)(pw); | 1794 | 1 | if (!pw) | 1795 | 0 | return NULL; | 1796 | 1 | | 1797 | 1 | pw->dim = isl_space_move_dims(pw->dim, dst_type, dst_pos, src_type, src_pos, n); | 1798 | 1 | if (!pw->dim) | 1799 | 0 | goto error; | 1800 | 1 | | 1801 | 2 | for (i = 0; 1 i < pw->n; ++i1 ) { | 1802 | 1 | pw->p[i].FIELD = FN(EL,move_dims)(pw->p[i].FIELD, | 1803 | 1 | dst_type, dst_pos, src_type, src_pos, n); | 1804 | 1 | if (!pw->p[i].FIELD) | 1805 | 1 | goto error0 ; | 1806 | 1 | } | 1807 | 1 | | 1808 | 1 | if (dst_type == isl_dim_in) | 1809 | 0 | dst_type = isl_dim_set; | 1810 | 1 | if (src_type == isl_dim_in) | 1811 | 1 | src_type = isl_dim_set; | 1812 | 1 | | 1813 | 2 | for (i = 0; i < pw->n; ++i1 ) { | 1814 | 1 | pw->p[i].set = isl_set_move_dims(pw->p[i].set, | 1815 | 1 | dst_type, dst_pos, | 1816 | 1 | src_type, src_pos, n); | 1817 | 1 | if (!pw->p[i].set) | 1818 | 0 | goto error; | 1819 | 1 | } | 1820 | 1 | | 1821 | 1 | return pw; | 1822 | 1 | error: | 1823 | 0 | FN(PW,free)(pw); | 1824 | 0 | return NULL; | 1825 | 1 | } |
|
1826 | | #endif |
1827 | | |
1828 | | __isl_give PW *FN(PW,mul_isl_int)(__isl_take PW *pw, isl_int v) |
1829 | 4.41k | { |
1830 | 4.41k | int i; |
1831 | 4.41k | |
1832 | 4.41k | if (isl_int_is_one(v)) |
1833 | 4.41k | return pw0 ; |
1834 | 4.41k | if (pw && DEFAULT_IS_ZERO && isl_int_is_zero0 (v)) { |
1835 | 0 | PW *zero; |
1836 | 0 | isl_space *dim = FN(PW,get_space)(pw); |
1837 | | #ifdef HAS_TYPE |
1838 | 0 | zero = FN(PW,ZERO)(dim, pw->type); |
1839 | | #else |
1840 | 0 | zero = FN(PW,ZERO)(dim); |
1841 | | #endif |
1842 | 0 | FN(PW,free)(pw); |
1843 | 0 | return zero; |
1844 | 0 | } |
1845 | 4.41k | pw = FN(PW,cow)(pw); |
1846 | 4.41k | if (!pw) |
1847 | 0 | return NULL; |
1848 | 4.41k | if (pw->n == 0) |
1849 | 0 | return pw; |
1850 | 0 | |
1851 | | #ifdef HAS_TYPE |
1852 | 0 | if (isl_int_is_neg(v)) |
1853 | 0 | pw->type = isl_fold_type_negate(pw->type); |
1854 | | #endif |
1855 | 9.06k | for (i = 0; 4.41k i < pw->n; ++i4.65k ) { |
1856 | 4.65k | pw->p[i].FIELD = FN(EL,scale)(pw->p[i].FIELD, v); |
1857 | 4.65k | if (!pw->p[i].FIELD) |
1858 | 4.65k | goto error0 ; |
1859 | 4.65k | } |
1860 | 4.41k | |
1861 | 4.41k | return pw; |
1862 | 4.41k | error: |
1863 | 0 | FN(PW,free)(pw); |
1864 | 0 | return NULL; |
1865 | 4.41k | } Line | Count | Source | 1829 | 4.41k | { | 1830 | 4.41k | int i; | 1831 | 4.41k | | 1832 | 4.41k | if (isl_int_is_one(v)) | 1833 | 4.41k | return pw0 ; | 1834 | 4.41k | if (pw && DEFAULT_IS_ZERO && isl_int_is_zero0 (v)) { | 1835 | 0 | PW *zero; | 1836 | 0 | isl_space *dim = FN(PW,get_space)(pw); | 1837 | | #ifdef HAS_TYPE | 1838 | | zero = FN(PW,ZERO)(dim, pw->type); | 1839 | | #else | 1840 | 0 | zero = FN(PW,ZERO)(dim); | 1841 | 0 | #endif | 1842 | 0 | FN(PW,free)(pw); | 1843 | 0 | return zero; | 1844 | 0 | } | 1845 | 4.41k | pw = FN(PW,cow)(pw); | 1846 | 4.41k | if (!pw) | 1847 | 0 | return NULL; | 1848 | 4.41k | if (pw->n == 0) | 1849 | 0 | return pw; | 1850 | 4.41k | | 1851 | | #ifdef HAS_TYPE | 1852 | | if (isl_int_is_neg(v)) | 1853 | | pw->type = isl_fold_type_negate(pw->type); | 1854 | | #endif | 1855 | 9.06k | for (i = 0; 4.41k i < pw->n; ++i4.65k ) { | 1856 | 4.65k | pw->p[i].FIELD = FN(EL,scale)(pw->p[i].FIELD, v); | 1857 | 4.65k | if (!pw->p[i].FIELD) | 1858 | 4.65k | goto error0 ; | 1859 | 4.65k | } | 1860 | 4.41k | | 1861 | 4.41k | return pw; | 1862 | 4.41k | error: | 1863 | 0 | FN(PW,free)(pw); | 1864 | 0 | return NULL; | 1865 | 4.41k | } |
Unexecuted instantiation: isl_pw_multi_aff_mul_isl_int Unexecuted instantiation: isl_pw_qpolynomial_fold_mul_isl_int Unexecuted instantiation: isl_pw_qpolynomial_mul_isl_int |
1866 | | |
1867 | | /* Multiply the pieces of "pw" by "v" and return the result. |
1868 | | */ |
1869 | | __isl_give PW *FN(PW,scale_val)(__isl_take PW *pw, __isl_take isl_val *v) |
1870 | 169 | { |
1871 | 169 | int i; |
1872 | 169 | |
1873 | 169 | if (!pw || !v) |
1874 | 0 | goto error; |
|