/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_multi_templ.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2011 Sven Verdoolaege |
3 | | * Copyright 2012-2013 Ecole Normale Superieure |
4 | | * |
5 | | * Use of this software is governed by the MIT license |
6 | | * |
7 | | * Written by Sven Verdoolaege, |
8 | | * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France |
9 | | */ |
10 | | |
11 | | #include <isl/id.h> |
12 | | #include <isl_space_private.h> |
13 | | #include <isl_val_private.h> |
14 | | #include <isl/set.h> |
15 | | #include <isl_reordering.h> |
16 | | |
17 | | #include <isl_multi_macro.h> |
18 | | |
19 | | #define MULTI_NAME(BASE) "isl_multi_" #BASE |
20 | 0 | #define xLIST(EL) EL ## _list |
21 | 0 | #define LIST(EL) xLIST(EL) |
22 | | |
23 | | isl_ctx *FN(MULTI(BASE),get_ctx)(__isl_keep MULTI(BASE) *multi) |
24 | 97.5k | { |
25 | 97.5k | return multi ? isl_space_get_ctx(multi->space) : NULL; |
26 | 97.5k | } Line | Count | Source | 24 | 39.7k | { | 25 | 39.7k | return multi ? isl_space_get_ctx(multi->space) : NULL; | 26 | 39.7k | } |
Line | Count | Source | 24 | 21.8k | { | 25 | 21.8k | return multi ? isl_space_get_ctx(multi->space) : NULL; | 26 | 21.8k | } |
isl_multi_union_pw_aff_get_ctx Line | Count | Source | 24 | 26.8k | { | 25 | 26.8k | return multi ? isl_space_get_ctx(multi->space) : NULL; | 26 | 26.8k | } |
Line | Count | Source | 24 | 9.06k | { | 25 | 9.06k | return multi ? isl_space_get_ctx(multi->space) : NULL; | 26 | 9.06k | } |
|
27 | | |
28 | | /* Return the space of "multi". |
29 | | */ |
30 | | __isl_keep isl_space *FN(MULTI(BASE),peek_space)(__isl_keep MULTI(BASE) *multi) |
31 | 3.55M | { |
32 | 3.55M | return multi ? multi->space : NULL; |
33 | 3.55M | } Line | Count | Source | 31 | 3.43M | { | 32 | 3.43M | return multi ? multi->space : NULL; | 33 | 3.43M | } |
isl_multi_pw_aff_peek_space Line | Count | Source | 31 | 47.0k | { | 32 | 47.0k | return multi ? multi->space : NULL; | 33 | 47.0k | } |
isl_multi_union_pw_aff_peek_space Line | Count | Source | 31 | 44.5k | { | 32 | 44.5k | return multi ? multi->space : NULL; | 33 | 44.5k | } |
Line | Count | Source | 31 | 36.9k | { | 32 | 36.9k | return multi ? multi->space : NULL; | 33 | 36.9k | } |
|
34 | | |
35 | | __isl_give isl_space *FN(MULTI(BASE),get_space)(__isl_keep MULTI(BASE) *multi) |
36 | 1.96M | { |
37 | 1.96M | return isl_space_copy(FN(MULTI(BASE),peek_space)(multi)); |
38 | 1.96M | } Line | Count | Source | 36 | 1.87M | { | 37 | 1.87M | return isl_space_copy(FN(MULTI(BASE),peek_space)(multi)); | 38 | 1.87M | } |
isl_multi_pw_aff_get_space Line | Count | Source | 36 | 31.0k | { | 37 | 31.0k | return isl_space_copy(FN(MULTI(BASE),peek_space)(multi)); | 38 | 31.0k | } |
isl_multi_union_pw_aff_get_space Line | Count | Source | 36 | 32.8k | { | 37 | 32.8k | return isl_space_copy(FN(MULTI(BASE),peek_space)(multi)); | 38 | 32.8k | } |
Line | Count | Source | 36 | 22.0k | { | 37 | 22.0k | return isl_space_copy(FN(MULTI(BASE),peek_space)(multi)); | 38 | 22.0k | } |
|
39 | | |
40 | | /* Return the position of the dimension of the given type and name |
41 | | * in "multi". |
42 | | * Return -1 if no such dimension can be found. |
43 | | */ |
44 | | int FN(MULTI(BASE),find_dim_by_name)(__isl_keep MULTI(BASE) *multi, |
45 | | enum isl_dim_type type, const char *name) |
46 | 0 | { |
47 | 0 | if (!multi) |
48 | 0 | return -1; |
49 | 0 | return isl_space_find_dim_by_name(multi->space, type, name); |
50 | 0 | } Unexecuted instantiation: isl_multi_aff_find_dim_by_name Unexecuted instantiation: isl_multi_pw_aff_find_dim_by_name Unexecuted instantiation: isl_multi_union_pw_aff_find_dim_by_name Unexecuted instantiation: isl_multi_val_find_dim_by_name |
51 | | |
52 | | __isl_give isl_space *FN(MULTI(BASE),get_domain_space)( |
53 | | __isl_keep MULTI(BASE) *multi) |
54 | 150k | { |
55 | 150k | return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL; |
56 | 150k | } isl_multi_aff_get_domain_space Line | Count | Source | 54 | 146k | { | 55 | 146k | return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL; | 56 | 146k | } |
isl_multi_pw_aff_get_domain_space Line | Count | Source | 54 | 1.39k | { | 55 | 1.39k | return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL; | 56 | 1.39k | } |
isl_multi_union_pw_aff_get_domain_space Line | Count | Source | 54 | 223 | { | 55 | 223 | return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL; | 56 | 223 | } |
isl_multi_val_get_domain_space Line | Count | Source | 54 | 3.05k | { | 55 | 3.05k | return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL; | 56 | 3.05k | } |
|
57 | | |
58 | | /* Allocate a multi expression living in "space". |
59 | | * |
60 | | * If the number of base expressions is zero, then make sure |
61 | | * there is enough room in the structure for the explicit domain, |
62 | | * in case the type supports such an explicit domain. |
63 | | */ |
64 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),alloc)(__isl_take isl_space *space) |
65 | 262k | { |
66 | 262k | isl_ctx *ctx; |
67 | 262k | int n; |
68 | 262k | MULTI(BASE) *multi; |
69 | 262k | |
70 | 262k | if (!space) |
71 | 0 | return NULL; |
72 | 262k | |
73 | 262k | ctx = isl_space_get_ctx(space); |
74 | 262k | n = isl_space_dim(space, isl_dim_out); |
75 | 262k | if (n > 0) |
76 | 253k | multi = isl_calloc(ctx, MULTI(BASE), |
77 | 262k | sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *)); |
78 | 262k | else |
79 | 262k | multi = 9.34k isl_calloc9.34k (ctx, MULTI(BASE), sizeof(MULTI(BASE))); |
80 | 262k | if (!multi) |
81 | 0 | goto error; |
82 | 262k | |
83 | 262k | multi->space = space; |
84 | 262k | multi->n = n; |
85 | 262k | multi->ref = 1; |
86 | 262k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) |
87 | 5.39k | multi = FN(MULTI(BASE),init_explicit_domain)(multi); |
88 | 262k | return multi; |
89 | 262k | error: |
90 | 0 | isl_space_free(space); |
91 | 0 | return NULL; |
92 | 262k | } Line | Count | Source | 65 | 233k | { | 66 | 233k | isl_ctx *ctx; | 67 | 233k | int n; | 68 | 233k | MULTI(BASE) *multi; | 69 | 233k | | 70 | 233k | if (!space) | 71 | 0 | return NULL; | 72 | 233k | | 73 | 233k | ctx = isl_space_get_ctx(space); | 74 | 233k | n = isl_space_dim(space, isl_dim_out); | 75 | 233k | if (n > 0) | 76 | 229k | multi = isl_calloc(ctx, MULTI(BASE), | 77 | 233k | sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *)); | 78 | 233k | else | 79 | 233k | multi = 3.89k isl_calloc3.89k (ctx, MULTI(BASE), sizeof(MULTI(BASE))); | 80 | 233k | if (!multi) | 81 | 0 | goto error; | 82 | 233k | | 83 | 233k | multi->space = space; | 84 | 233k | multi->n = n; | 85 | 233k | multi->ref = 1; | 86 | 233k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 87 | 0 | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 88 | 233k | return multi; | 89 | 233k | error: | 90 | 0 | isl_space_free(space); | 91 | 0 | return NULL; | 92 | 233k | } |
Line | Count | Source | 65 | 10.1k | { | 66 | 10.1k | isl_ctx *ctx; | 67 | 10.1k | int n; | 68 | 10.1k | MULTI(BASE) *multi; | 69 | 10.1k | | 70 | 10.1k | if (!space) | 71 | 0 | return NULL; | 72 | 10.1k | | 73 | 10.1k | ctx = isl_space_get_ctx(space); | 74 | 10.1k | n = isl_space_dim(space, isl_dim_out); | 75 | 10.1k | if (n > 0) | 76 | 9.02k | multi = isl_calloc(ctx, MULTI(BASE), | 77 | 10.1k | sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *)); | 78 | 10.1k | else | 79 | 10.1k | multi = 1.14k isl_calloc1.14k (ctx, MULTI(BASE), sizeof(MULTI(BASE))); | 80 | 10.1k | if (!multi) | 81 | 0 | goto error; | 82 | 10.1k | | 83 | 10.1k | multi->space = space; | 84 | 10.1k | multi->n = n; | 85 | 10.1k | multi->ref = 1; | 86 | 10.1k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 87 | 1.14k | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 88 | 10.1k | return multi; | 89 | 10.1k | error: | 90 | 0 | isl_space_free(space); | 91 | 0 | return NULL; | 92 | 10.1k | } |
isl_multi_union_pw_aff_alloc Line | Count | Source | 65 | 12.1k | { | 66 | 12.1k | isl_ctx *ctx; | 67 | 12.1k | int n; | 68 | 12.1k | MULTI(BASE) *multi; | 69 | 12.1k | | 70 | 12.1k | if (!space) | 71 | 0 | return NULL; | 72 | 12.1k | | 73 | 12.1k | ctx = isl_space_get_ctx(space); | 74 | 12.1k | n = isl_space_dim(space, isl_dim_out); | 75 | 12.1k | if (n > 0) | 76 | 7.87k | multi = isl_calloc(ctx, MULTI(BASE), | 77 | 12.1k | sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *)); | 78 | 12.1k | else | 79 | 12.1k | multi = 4.24k isl_calloc4.24k (ctx, MULTI(BASE), sizeof(MULTI(BASE))); | 80 | 12.1k | if (!multi) | 81 | 0 | goto error; | 82 | 12.1k | | 83 | 12.1k | multi->space = space; | 84 | 12.1k | multi->n = n; | 85 | 12.1k | multi->ref = 1; | 86 | 12.1k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 87 | 4.24k | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 88 | 12.1k | return multi; | 89 | 12.1k | error: | 90 | 0 | isl_space_free(space); | 91 | 0 | return NULL; | 92 | 12.1k | } |
Line | Count | Source | 65 | 6.90k | { | 66 | 6.90k | isl_ctx *ctx; | 67 | 6.90k | int n; | 68 | 6.90k | MULTI(BASE) *multi; | 69 | 6.90k | | 70 | 6.90k | if (!space) | 71 | 0 | return NULL; | 72 | 6.90k | | 73 | 6.90k | ctx = isl_space_get_ctx(space); | 74 | 6.90k | n = isl_space_dim(space, isl_dim_out); | 75 | 6.90k | if (n > 0) | 76 | 6.84k | multi = isl_calloc(ctx, MULTI(BASE), | 77 | 6.90k | sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *)); | 78 | 6.90k | else | 79 | 6.90k | multi = 57 isl_calloc57 (ctx, MULTI(BASE), sizeof(MULTI(BASE))); | 80 | 6.90k | if (!multi) | 81 | 0 | goto error; | 82 | 6.90k | | 83 | 6.90k | multi->space = space; | 84 | 6.90k | multi->n = n; | 85 | 6.90k | multi->ref = 1; | 86 | 6.90k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 87 | 0 | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 88 | 6.90k | return multi; | 89 | 6.90k | error: | 90 | 0 | isl_space_free(space); | 91 | 0 | return NULL; | 92 | 6.90k | } |
|
93 | | |
94 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),dup)(__isl_keep MULTI(BASE) *multi) |
95 | 202k | { |
96 | 202k | int i; |
97 | 202k | MULTI(BASE) *dup; |
98 | 202k | |
99 | 202k | if (!multi) |
100 | 0 | return NULL; |
101 | 202k | |
102 | 202k | dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space)); |
103 | 202k | if (!dup) |
104 | 0 | return NULL; |
105 | 202k | |
106 | 1.67M | for (i = 0; 202k i < multi->n; ++i1.47M ) |
107 | 1.47M | dup = FN(FN(MULTI(BASE),set),BASE)(dup, i, |
108 | 1.47M | FN(EL,copy)(multi->u.p[i])); |
109 | 202k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) |
110 | 1 | dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi); |
111 | 202k | |
112 | 202k | return dup; |
113 | 202k | } Line | Count | Source | 95 | 195k | { | 96 | 195k | int i; | 97 | 195k | MULTI(BASE) *dup; | 98 | 195k | | 99 | 195k | if (!multi) | 100 | 0 | return NULL; | 101 | 195k | | 102 | 195k | dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space)); | 103 | 195k | if (!dup) | 104 | 0 | return NULL; | 105 | 195k | | 106 | 1.66M | for (i = 0; 195k i < multi->n; ++i1.47M ) | 107 | 1.47M | dup = FN(FN(MULTI(BASE),set),BASE)(dup, i, | 108 | 1.47M | FN(EL,copy)(multi->u.p[i])); | 109 | 195k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 110 | 0 | dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi); | 111 | 195k | | 112 | 195k | return dup; | 113 | 195k | } |
Line | Count | Source | 95 | 1 | { | 96 | 1 | int i; | 97 | 1 | MULTI(BASE) *dup; | 98 | 1 | | 99 | 1 | if (!multi) | 100 | 0 | return NULL; | 101 | 1 | | 102 | 1 | dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space)); | 103 | 1 | if (!dup) | 104 | 0 | return NULL; | 105 | 1 | | 106 | 1 | for (i = 0; i < multi->n; ++i0 ) | 107 | 0 | dup = FN(FN(MULTI(BASE),set),BASE)(dup, i, | 108 | 0 | FN(EL,copy)(multi->u.p[i])); | 109 | 1 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 110 | 1 | dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi); | 111 | 1 | | 112 | 1 | return dup; | 113 | 1 | } |
isl_multi_union_pw_aff_dup Line | Count | Source | 95 | 2.99k | { | 96 | 2.99k | int i; | 97 | 2.99k | MULTI(BASE) *dup; | 98 | 2.99k | | 99 | 2.99k | if (!multi) | 100 | 0 | return NULL; | 101 | 2.99k | | 102 | 2.99k | dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space)); | 103 | 2.99k | if (!dup) | 104 | 0 | return NULL; | 105 | 2.99k | | 106 | 6.98k | for (i = 0; 2.99k i < multi->n; ++i3.99k ) | 107 | 3.99k | dup = FN(FN(MULTI(BASE),set),BASE)(dup, i, | 108 | 3.99k | FN(EL,copy)(multi->u.p[i])); | 109 | 2.99k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 110 | 0 | dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi); | 111 | 2.99k | | 112 | 2.99k | return dup; | 113 | 2.99k | } |
Line | Count | Source | 95 | 3.22k | { | 96 | 3.22k | int i; | 97 | 3.22k | MULTI(BASE) *dup; | 98 | 3.22k | | 99 | 3.22k | if (!multi) | 100 | 0 | return NULL; | 101 | 3.22k | | 102 | 3.22k | dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space)); | 103 | 3.22k | if (!dup) | 104 | 0 | return NULL; | 105 | 3.22k | | 106 | 6.71k | for (i = 0; 3.22k i < multi->n; ++i3.48k ) | 107 | 3.48k | dup = FN(FN(MULTI(BASE),set),BASE)(dup, i, | 108 | 3.48k | FN(EL,copy)(multi->u.p[i])); | 109 | 3.22k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 110 | 0 | dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi); | 111 | 3.22k | | 112 | 3.22k | return dup; | 113 | 3.22k | } |
|
114 | | |
115 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),cow)(__isl_take MULTI(BASE) *multi) |
116 | 1.85M | { |
117 | 1.85M | if (!multi) |
118 | 0 | return NULL; |
119 | 1.85M | |
120 | 1.85M | if (multi->ref == 1) |
121 | 1.65M | return multi; |
122 | 202k | |
123 | 202k | multi->ref--; |
124 | 202k | return FN(MULTI(BASE),dup)(multi); |
125 | 202k | } Line | Count | Source | 116 | 1.76M | { | 117 | 1.76M | if (!multi) | 118 | 0 | return NULL; | 119 | 1.76M | | 120 | 1.76M | if (multi->ref == 1) | 121 | 1.56M | return multi; | 122 | 195k | | 123 | 195k | multi->ref--; | 124 | 195k | return FN(MULTI(BASE),dup)(multi); | 125 | 195k | } |
Line | Count | Source | 116 | 47.4k | { | 117 | 47.4k | if (!multi) | 118 | 0 | return NULL; | 119 | 47.4k | | 120 | 47.4k | if (multi->ref == 1) | 121 | 47.4k | return multi; | 122 | 1 | | 123 | 1 | multi->ref--; | 124 | 1 | return FN(MULTI(BASE),dup)(multi); | 125 | 1 | } |
isl_multi_union_pw_aff_cow Line | Count | Source | 116 | 19.3k | { | 117 | 19.3k | if (!multi) | 118 | 0 | return NULL; | 119 | 19.3k | | 120 | 19.3k | if (multi->ref == 1) | 121 | 16.3k | return multi; | 122 | 2.99k | | 123 | 2.99k | multi->ref--; | 124 | 2.99k | return FN(MULTI(BASE),dup)(multi); | 125 | 2.99k | } |
Line | Count | Source | 116 | 21.0k | { | 117 | 21.0k | if (!multi) | 118 | 0 | return NULL; | 119 | 21.0k | | 120 | 21.0k | if (multi->ref == 1) | 121 | 17.7k | return multi; | 122 | 3.22k | | 123 | 3.22k | multi->ref--; | 124 | 3.22k | return FN(MULTI(BASE),dup)(multi); | 125 | 3.22k | } |
|
126 | | |
127 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),copy)(__isl_keep MULTI(BASE) *multi) |
128 | 362k | { |
129 | 362k | if (!multi) |
130 | 526 | return NULL; |
131 | 362k | |
132 | 362k | multi->ref++; |
133 | 362k | return multi; |
134 | 362k | } Line | Count | Source | 128 | 331k | { | 129 | 331k | if (!multi) | 130 | 526 | return NULL; | 131 | 331k | | 132 | 331k | multi->ref++; | 133 | 331k | return multi; | 134 | 331k | } |
isl_multi_union_pw_aff_copy Line | Count | Source | 128 | 18.3k | { | 129 | 18.3k | if (!multi) | 130 | 0 | return NULL; | 131 | 18.3k | | 132 | 18.3k | multi->ref++; | 133 | 18.3k | return multi; | 134 | 18.3k | } |
Line | Count | Source | 128 | 12.9k | { | 129 | 12.9k | if (!multi) | 130 | 0 | return NULL; | 131 | 12.9k | | 132 | 12.9k | multi->ref++; | 133 | 12.9k | return multi; | 134 | 12.9k | } |
|
135 | | |
136 | | __isl_null MULTI(BASE) *FN(MULTI(BASE),free)(__isl_take MULTI(BASE) *multi) |
137 | 469k | { |
138 | 469k | int i; |
139 | 469k | |
140 | 469k | if (!multi) |
141 | 47.2k | return NULL; |
142 | 422k | |
143 | 422k | if (--multi->ref > 0) |
144 | 160k | return NULL; |
145 | 262k | |
146 | 262k | isl_space_free(multi->space); |
147 | 1.84M | for (i = 0; i < multi->n; ++i1.58M ) |
148 | 1.58M | FN(EL,free)(multi->u.p[i]); |
149 | 262k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) |
150 | 262k | FN5.39k (MULTI(BASE),free_explicit_domain)(multi)5.39k ; |
151 | 262k | free(multi); |
152 | 262k | |
153 | 262k | return NULL; |
154 | 262k | } Line | Count | Source | 137 | 415k | { | 138 | 415k | int i; | 139 | 415k | | 140 | 415k | if (!multi) | 141 | 47.2k | return NULL; | 142 | 368k | | 143 | 368k | if (--multi->ref > 0) | 144 | 135k | return NULL; | 145 | 233k | | 146 | 233k | isl_space_free(multi->space); | 147 | 1.77M | for (i = 0; i < multi->n; ++i1.54M ) | 148 | 1.54M | FN(EL,free)(multi->u.p[i]); | 149 | 233k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 150 | 233k | FN0 (MULTI(BASE),free_explicit_domain)(multi)0 ; | 151 | 233k | free(multi); | 152 | 233k | | 153 | 233k | return NULL; | 154 | 233k | } |
Line | Count | Source | 137 | 10.1k | { | 138 | 10.1k | int i; | 139 | 10.1k | | 140 | 10.1k | if (!multi) | 141 | 0 | return NULL; | 142 | 10.1k | | 143 | 10.1k | if (--multi->ref > 0) | 144 | 16 | return NULL; | 145 | 10.1k | | 146 | 10.1k | isl_space_free(multi->space); | 147 | 26.1k | for (i = 0; i < multi->n; ++i16.0k ) | 148 | 16.0k | FN(EL,free)(multi->u.p[i]); | 149 | 10.1k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 150 | 10.1k | FN1.14k (MULTI(BASE),free_explicit_domain)(multi)1.14k ; | 151 | 10.1k | free(multi); | 152 | 10.1k | | 153 | 10.1k | return NULL; | 154 | 10.1k | } |
isl_multi_union_pw_aff_free Line | Count | Source | 137 | 27.4k | { | 138 | 27.4k | int i; | 139 | 27.4k | | 140 | 27.4k | if (!multi) | 141 | 0 | return NULL; | 142 | 27.4k | | 143 | 27.4k | if (--multi->ref > 0) | 144 | 15.3k | return NULL; | 145 | 12.0k | | 146 | 12.0k | isl_space_free(multi->space); | 147 | 22.9k | for (i = 0; i < multi->n; ++i10.8k ) | 148 | 12.0k | FN10.8k (EL,free)(multi->u.p[i])10.8k ; | 149 | 12.0k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 150 | 12.0k | FN4.25k (MULTI(BASE),free_explicit_domain)(multi)4.25k ; | 151 | 12.0k | free(multi); | 152 | 12.0k | | 153 | 12.0k | return NULL; | 154 | 12.0k | } |
Line | Count | Source | 137 | 16.5k | { | 138 | 16.5k | int i; | 139 | 16.5k | | 140 | 16.5k | if (!multi) | 141 | 4 | return NULL; | 142 | 16.5k | | 143 | 16.5k | if (--multi->ref > 0) | 144 | 9.67k | return NULL; | 145 | 6.90k | | 146 | 6.90k | isl_space_free(multi->space); | 147 | 15.8k | for (i = 0; i < multi->n; ++i8.98k ) | 148 | 8.98k | FN(EL,free)(multi->u.p[i]); | 149 | 6.90k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 150 | 6.90k | FN0 (MULTI(BASE),free_explicit_domain)(multi)0 ; | 151 | 6.90k | free(multi); | 152 | 6.90k | | 153 | 6.90k | return NULL; | 154 | 6.90k | } |
|
155 | | |
156 | | unsigned FN(MULTI(BASE),dim)(__isl_keep MULTI(BASE) *multi, |
157 | | enum isl_dim_type type) |
158 | 3.73M | { |
159 | 3.73M | return multi ? isl_space_dim(multi->space, type) : 00 ; |
160 | 3.73M | } Line | Count | Source | 158 | 3.68M | { | 159 | 3.68M | return multi ? isl_space_dim(multi->space, type) : 00 ; | 160 | 3.68M | } |
Line | Count | Source | 158 | 13.2k | { | 159 | 13.2k | return multi ? isl_space_dim(multi->space, type) : 00 ; | 160 | 13.2k | } |
isl_multi_union_pw_aff_dim Line | Count | Source | 158 | 25.3k | { | 159 | 25.3k | return multi ? isl_space_dim(multi->space, type) : 00 ; | 160 | 25.3k | } |
Line | Count | Source | 158 | 8.24k | { | 159 | 8.24k | return multi ? isl_space_dim(multi->space, type) : 00 ; | 160 | 8.24k | } |
|
161 | | |
162 | | /* Return the position of the first dimension of "type" with id "id". |
163 | | * Return -1 if there is no such dimension. |
164 | | */ |
165 | | int FN(MULTI(BASE),find_dim_by_id)(__isl_keep MULTI(BASE) *multi, |
166 | | enum isl_dim_type type, __isl_keep isl_id *id) |
167 | 0 | { |
168 | 0 | if (!multi) |
169 | 0 | return -1; |
170 | 0 | return isl_space_find_dim_by_id(multi->space, type, id); |
171 | 0 | } Unexecuted instantiation: isl_multi_aff_find_dim_by_id Unexecuted instantiation: isl_multi_pw_aff_find_dim_by_id Unexecuted instantiation: isl_multi_union_pw_aff_find_dim_by_id Unexecuted instantiation: isl_multi_val_find_dim_by_id |
172 | | |
173 | | /* Return the id of the given dimension. |
174 | | */ |
175 | | __isl_give isl_id *FN(MULTI(BASE),get_dim_id)(__isl_keep MULTI(BASE) *multi, |
176 | | enum isl_dim_type type, unsigned pos) |
177 | 0 | { |
178 | 0 | return multi ? isl_space_get_dim_id(multi->space, type, pos) : NULL; |
179 | 0 | } Unexecuted instantiation: isl_multi_aff_get_dim_id Unexecuted instantiation: isl_multi_pw_aff_get_dim_id Unexecuted instantiation: isl_multi_union_pw_aff_get_dim_id Unexecuted instantiation: isl_multi_val_get_dim_id |
180 | | |
181 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_name)( |
182 | | __isl_take MULTI(BASE) *multi, |
183 | | enum isl_dim_type type, unsigned pos, const char *s) |
184 | 0 | { |
185 | 0 | int i; |
186 | 0 |
|
187 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
188 | 0 | if (!multi) |
189 | 0 | return NULL; |
190 | 0 | |
191 | 0 | multi->space = isl_space_set_dim_name(multi->space, type, pos, s); |
192 | 0 | if (!multi->space) |
193 | 0 | return FN(MULTI(BASE),free)(multi); |
194 | 0 |
|
195 | 0 | if (type == isl_dim_out) |
196 | 0 | return multi; |
197 | 0 | for (i = 0; i < multi->n; ++i) { |
198 | 0 | multi->u.p[i] = FN(EL,set_dim_name)(multi->u.p[i], |
199 | 0 | type, pos, s); |
200 | 0 | if (!multi->u.p[i]) |
201 | 0 | return FN(MULTI(BASE),free)(multi); |
202 | 0 | } |
203 | 0 |
|
204 | 0 | return multi; |
205 | 0 | } Unexecuted instantiation: isl_multi_aff_set_dim_name Unexecuted instantiation: isl_multi_pw_aff_set_dim_name Unexecuted instantiation: isl_multi_union_pw_aff_set_dim_name Unexecuted instantiation: isl_multi_val_set_dim_name |
206 | | |
207 | | const char *FN(MULTI(BASE),get_tuple_name)(__isl_keep MULTI(BASE) *multi, |
208 | | enum isl_dim_type type) |
209 | 0 | { |
210 | 0 | return multi ? isl_space_get_tuple_name(multi->space, type) : NULL; |
211 | 0 | } Unexecuted instantiation: isl_multi_aff_get_tuple_name Unexecuted instantiation: isl_multi_pw_aff_get_tuple_name Unexecuted instantiation: isl_multi_union_pw_aff_get_tuple_name Unexecuted instantiation: isl_multi_val_get_tuple_name |
212 | | |
213 | | /* Does the specified tuple have an id? |
214 | | */ |
215 | | isl_bool FN(MULTI(BASE),has_tuple_id)(__isl_keep MULTI(BASE) *multi, |
216 | | enum isl_dim_type type) |
217 | 5.61k | { |
218 | 5.61k | if (!multi) |
219 | 0 | return isl_bool_error; |
220 | 5.61k | return isl_space_has_tuple_id(multi->space, type); |
221 | 5.61k | } Unexecuted instantiation: isl_multi_aff_has_tuple_id isl_multi_pw_aff_has_tuple_id Line | Count | Source | 217 | 3.25k | { | 218 | 3.25k | if (!multi) | 219 | 0 | return isl_bool_error; | 220 | 3.25k | return isl_space_has_tuple_id(multi->space, type); | 221 | 3.25k | } |
isl_multi_union_pw_aff_has_tuple_id Line | Count | Source | 217 | 2.36k | { | 218 | 2.36k | if (!multi) | 219 | 0 | return isl_bool_error; | 220 | 2.36k | return isl_space_has_tuple_id(multi->space, type); | 221 | 2.36k | } |
Unexecuted instantiation: isl_multi_val_has_tuple_id |
222 | | |
223 | | /* Return the id of the specified tuple. |
224 | | */ |
225 | | __isl_give isl_id *FN(MULTI(BASE),get_tuple_id)(__isl_keep MULTI(BASE) *multi, |
226 | | enum isl_dim_type type) |
227 | 3.25k | { |
228 | 3.25k | return multi ? isl_space_get_tuple_id(multi->space, type) : NULL; |
229 | 3.25k | } Unexecuted instantiation: isl_multi_aff_get_tuple_id isl_multi_pw_aff_get_tuple_id Line | Count | Source | 227 | 3.25k | { | 228 | 3.25k | return multi ? isl_space_get_tuple_id(multi->space, type) : NULL; | 229 | 3.25k | } |
Unexecuted instantiation: isl_multi_union_pw_aff_get_tuple_id Unexecuted instantiation: isl_multi_val_get_tuple_id |
230 | | |
231 | | __isl_give EL *FN(FN(MULTI(BASE),get),BASE)(__isl_keep MULTI(BASE) *multi, |
232 | | int pos) |
233 | 85.6k | { |
234 | 85.6k | isl_ctx *ctx; |
235 | 85.6k | |
236 | 85.6k | if (!multi) |
237 | 0 | return NULL; |
238 | 85.6k | ctx = FN(MULTI(BASE),get_ctx)(multi); |
239 | 85.6k | if (pos < 0 || pos >= multi->n) |
240 | 85.6k | isl_die0 (ctx, isl_error_invalid, |
241 | 85.6k | "index out of bounds", return NULL); |
242 | 85.6k | return FN(EL,copy)(multi->u.p[pos]); |
243 | 85.6k | } Line | Count | Source | 233 | 39.7k | { | 234 | 39.7k | isl_ctx *ctx; | 235 | 39.7k | | 236 | 39.7k | if (!multi) | 237 | 0 | return NULL; | 238 | 39.7k | ctx = FN(MULTI(BASE),get_ctx)(multi); | 239 | 39.7k | if (pos < 0 || pos >= multi->n) | 240 | 39.7k | isl_die0 (ctx, isl_error_invalid, | 241 | 39.7k | "index out of bounds", return NULL); | 242 | 39.7k | return FN(EL,copy)(multi->u.p[pos]); | 243 | 39.7k | } |
isl_multi_pw_aff_get_pw_aff Line | Count | Source | 233 | 15.9k | { | 234 | 15.9k | isl_ctx *ctx; | 235 | 15.9k | | 236 | 15.9k | if (!multi) | 237 | 0 | return NULL; | 238 | 15.9k | ctx = FN(MULTI(BASE),get_ctx)(multi); | 239 | 15.9k | if (pos < 0 || pos >= multi->n) | 240 | 15.9k | isl_die0 (ctx, isl_error_invalid, | 241 | 15.9k | "index out of bounds", return NULL); | 242 | 15.9k | return FN(EL,copy)(multi->u.p[pos]); | 243 | 15.9k | } |
isl_multi_union_pw_aff_get_union_pw_aff Line | Count | Source | 233 | 20.9k | { | 234 | 20.9k | isl_ctx *ctx; | 235 | 20.9k | | 236 | 20.9k | if (!multi) | 237 | 0 | return NULL; | 238 | 20.9k | ctx = FN(MULTI(BASE),get_ctx)(multi); | 239 | 20.9k | if (pos < 0 || pos >= multi->n) | 240 | 20.9k | isl_die0 (ctx, isl_error_invalid, | 241 | 20.9k | "index out of bounds", return NULL); | 242 | 20.9k | return FN(EL,copy)(multi->u.p[pos]); | 243 | 20.9k | } |
Line | Count | Source | 233 | 8.98k | { | 234 | 8.98k | isl_ctx *ctx; | 235 | 8.98k | | 236 | 8.98k | if (!multi) | 237 | 0 | return NULL; | 238 | 8.98k | ctx = FN(MULTI(BASE),get_ctx)(multi); | 239 | 8.98k | if (pos < 0 || pos >= multi->n) | 240 | 8.98k | isl_die0 (ctx, isl_error_invalid, | 241 | 8.98k | "index out of bounds", return NULL); | 242 | 8.98k | return FN(EL,copy)(multi->u.p[pos]); | 243 | 8.98k | } |
|
244 | | |
245 | | /* Set the element at position "pos" of "multi" to "el", |
246 | | * where the position may be empty if "multi" has only a single reference. |
247 | | */ |
248 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),restore)( |
249 | | __isl_take MULTI(BASE) *multi, int pos, __isl_take EL *el) |
250 | 1.59M | { |
251 | 1.59M | multi = FN(MULTI(BASE),cow)(multi); |
252 | 1.59M | if (!multi || !el) |
253 | 0 | goto error; |
254 | 1.59M | |
255 | 1.59M | if (pos < 0 || pos >= multi->n) |
256 | 1.59M | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
257 | 1.59M | "index out of bounds", goto error); |
258 | 1.59M | |
259 | 1.59M | FN(EL,free)(multi->u.p[pos]); |
260 | 1.59M | multi->u.p[pos] = el; |
261 | 1.59M | |
262 | 1.59M | return multi; |
263 | 1.59M | error: |
264 | 0 | FN(MULTI(BASE),free)(multi); |
265 | 0 | FN(EL,free)(el); |
266 | 0 | return NULL; |
267 | 1.59M | } isl_aff.c:isl_multi_aff_restore Line | Count | Source | 250 | 1.55M | { | 251 | 1.55M | multi = FN(MULTI(BASE),cow)(multi); | 252 | 1.55M | if (!multi || !el) | 253 | 0 | goto error; | 254 | 1.55M | | 255 | 1.55M | if (pos < 0 || pos >= multi->n) | 256 | 1.55M | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 257 | 1.55M | "index out of bounds", goto error); | 258 | 1.55M | | 259 | 1.55M | FN(EL,free)(multi->u.p[pos]); | 260 | 1.55M | multi->u.p[pos] = el; | 261 | 1.55M | | 262 | 1.55M | return multi; | 263 | 1.55M | error: | 264 | 0 | FN(MULTI(BASE),free)(multi); | 265 | 0 | FN(EL,free)(el); | 266 | 0 | return NULL; | 267 | 1.55M | } |
isl_aff.c:isl_multi_pw_aff_restore Line | Count | Source | 250 | 16.0k | { | 251 | 16.0k | multi = FN(MULTI(BASE),cow)(multi); | 252 | 16.0k | if (!multi || !el) | 253 | 0 | goto error; | 254 | 16.0k | | 255 | 16.0k | if (pos < 0 || pos >= multi->n) | 256 | 16.0k | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 257 | 16.0k | "index out of bounds", goto error); | 258 | 16.0k | | 259 | 16.0k | FN(EL,free)(multi->u.p[pos]); | 260 | 16.0k | multi->u.p[pos] = el; | 261 | 16.0k | | 262 | 16.0k | return multi; | 263 | 16.0k | error: | 264 | 0 | FN(MULTI(BASE),free)(multi); | 265 | 0 | FN(EL,free)(el); | 266 | 0 | return NULL; | 267 | 16.0k | } |
isl_aff.c:isl_multi_union_pw_aff_restore Line | Count | Source | 250 | 11.6k | { | 251 | 11.6k | multi = FN(MULTI(BASE),cow)(multi); | 252 | 11.6k | if (!multi || !el) | 253 | 0 | goto error; | 254 | 11.6k | | 255 | 11.6k | if (pos < 0 || pos >= multi->n) | 256 | 11.6k | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 257 | 11.6k | "index out of bounds", goto error); | 258 | 11.6k | | 259 | 11.6k | FN(EL,free)(multi->u.p[pos]); | 260 | 11.6k | multi->u.p[pos] = el; | 261 | 11.6k | | 262 | 11.6k | return multi; | 263 | 11.6k | error: | 264 | 0 | FN(MULTI(BASE),free)(multi); | 265 | 0 | FN(EL,free)(el); | 266 | 0 | return NULL; | 267 | 11.6k | } |
isl_val.c:isl_multi_val_restore Line | Count | Source | 250 | 14.8k | { | 251 | 14.8k | multi = FN(MULTI(BASE),cow)(multi); | 252 | 14.8k | if (!multi || !el) | 253 | 0 | goto error; | 254 | 14.8k | | 255 | 14.8k | if (pos < 0 || pos >= multi->n) | 256 | 14.8k | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 257 | 14.8k | "index out of bounds", goto error); | 258 | 14.8k | | 259 | 14.8k | FN(EL,free)(multi->u.p[pos]); | 260 | 14.8k | multi->u.p[pos] = el; | 261 | 14.8k | | 262 | 14.8k | return multi; | 263 | 14.8k | error: | 264 | 0 | FN(MULTI(BASE),free)(multi); | 265 | 0 | FN(EL,free)(el); | 266 | 0 | return NULL; | 267 | 14.8k | } |
|
268 | | |
269 | | /* Set the element at position "pos" of "multi" to "el", |
270 | | * where the position may be empty if "multi" has only a single reference. |
271 | | * However, the space of "multi" is available and is checked |
272 | | * for compatibility with "el". |
273 | | */ |
274 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),restore_check_space)( |
275 | | __isl_take MULTI(BASE) *multi, int pos, __isl_take EL *el) |
276 | 1.59M | { |
277 | 1.59M | isl_space *space; |
278 | 1.59M | |
279 | 1.59M | space = FN(MULTI(BASE),peek_space)(multi); |
280 | 1.59M | if (FN(EL,check_match_domain_space)(el, space) < 0) |
281 | 0 | multi = FN(MULTI(BASE),free)(multi); |
282 | 1.59M | return FN(MULTI(BASE),restore)(multi, pos, el); |
283 | 1.59M | } isl_aff.c:isl_multi_aff_restore_check_space Line | Count | Source | 276 | 1.55M | { | 277 | 1.55M | isl_space *space; | 278 | 1.55M | | 279 | 1.55M | space = FN(MULTI(BASE),peek_space)(multi); | 280 | 1.55M | if (FN(EL,check_match_domain_space)(el, space) < 0) | 281 | 0 | multi = FN(MULTI(BASE),free)(multi); | 282 | 1.55M | return FN(MULTI(BASE),restore)(multi, pos, el); | 283 | 1.55M | } |
isl_aff.c:isl_multi_pw_aff_restore_check_space Line | Count | Source | 276 | 16.0k | { | 277 | 16.0k | isl_space *space; | 278 | 16.0k | | 279 | 16.0k | space = FN(MULTI(BASE),peek_space)(multi); | 280 | 16.0k | if (FN(EL,check_match_domain_space)(el, space) < 0) | 281 | 0 | multi = FN(MULTI(BASE),free)(multi); | 282 | 16.0k | return FN(MULTI(BASE),restore)(multi, pos, el); | 283 | 16.0k | } |
isl_aff.c:isl_multi_union_pw_aff_restore_check_space Line | Count | Source | 276 | 11.6k | { | 277 | 11.6k | isl_space *space; | 278 | 11.6k | | 279 | 11.6k | space = FN(MULTI(BASE),peek_space)(multi); | 280 | 11.6k | if (FN(EL,check_match_domain_space)(el, space) < 0) | 281 | 0 | multi = FN(MULTI(BASE),free)(multi); | 282 | 11.6k | return FN(MULTI(BASE),restore)(multi, pos, el); | 283 | 11.6k | } |
isl_val.c:isl_multi_val_restore_check_space Line | Count | Source | 276 | 14.8k | { | 277 | 14.8k | isl_space *space; | 278 | 14.8k | | 279 | 14.8k | space = FN(MULTI(BASE),peek_space)(multi); | 280 | 14.8k | if (FN(EL,check_match_domain_space)(el, space) < 0) | 281 | 0 | multi = FN(MULTI(BASE),free)(multi); | 282 | 14.8k | return FN(MULTI(BASE),restore)(multi, pos, el); | 283 | 14.8k | } |
|
284 | | |
285 | | __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),set),BASE)( |
286 | | __isl_take MULTI(BASE) *multi, int pos, __isl_take EL *el) |
287 | 1.58M | { |
288 | 1.58M | isl_space *multi_space = NULL; |
289 | 1.58M | isl_space *el_space = NULL; |
290 | 1.58M | isl_bool match; |
291 | 1.58M | |
292 | 1.58M | multi_space = FN(MULTI(BASE),get_space)(multi); |
293 | 1.58M | match = FN(EL,matching_params)(el, multi_space); |
294 | 1.58M | if (match < 0) |
295 | 0 | goto error; |
296 | 1.58M | if (!match) { |
297 | 0 | multi = FN(MULTI(BASE),align_params)(multi, |
298 | 0 | FN(EL,get_space)(el)); |
299 | 0 | isl_space_free(multi_space); |
300 | 0 | multi_space = FN(MULTI(BASE),get_space)(multi); |
301 | 0 | el = FN(EL,align_params)(el, isl_space_copy(multi_space)); |
302 | 0 | } |
303 | 1.58M | |
304 | 1.58M | multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el); |
305 | 1.58M | |
306 | 1.58M | isl_space_free(multi_space); |
307 | 1.58M | isl_space_free(el_space); |
308 | 1.58M | |
309 | 1.58M | return multi; |
310 | 1.58M | error: |
311 | 0 | FN(MULTI(BASE),free)(multi); |
312 | 0 | FN(EL,free)(el); |
313 | 0 | isl_space_free(multi_space); |
314 | 0 | isl_space_free(el_space); |
315 | 0 | return NULL; |
316 | 1.58M | } Line | Count | Source | 287 | 1.55M | { | 288 | 1.55M | isl_space *multi_space = NULL; | 289 | 1.55M | isl_space *el_space = NULL; | 290 | 1.55M | isl_bool match; | 291 | 1.55M | | 292 | 1.55M | multi_space = FN(MULTI(BASE),get_space)(multi); | 293 | 1.55M | match = FN(EL,matching_params)(el, multi_space); | 294 | 1.55M | if (match < 0) | 295 | 0 | goto error; | 296 | 1.55M | if (!match) { | 297 | 0 | multi = FN(MULTI(BASE),align_params)(multi, | 298 | 0 | FN(EL,get_space)(el)); | 299 | 0 | isl_space_free(multi_space); | 300 | 0 | multi_space = FN(MULTI(BASE),get_space)(multi); | 301 | 0 | el = FN(EL,align_params)(el, isl_space_copy(multi_space)); | 302 | 0 | } | 303 | 1.55M | | 304 | 1.55M | multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el); | 305 | 1.55M | | 306 | 1.55M | isl_space_free(multi_space); | 307 | 1.55M | isl_space_free(el_space); | 308 | 1.55M | | 309 | 1.55M | return multi; | 310 | 1.55M | error: | 311 | 0 | FN(MULTI(BASE),free)(multi); | 312 | 0 | FN(EL,free)(el); | 313 | 0 | isl_space_free(multi_space); | 314 | 0 | isl_space_free(el_space); | 315 | 0 | return NULL; | 316 | 1.55M | } |
isl_multi_pw_aff_set_pw_aff Line | Count | Source | 287 | 7.36k | { | 288 | 7.36k | isl_space *multi_space = NULL; | 289 | 7.36k | isl_space *el_space = NULL; | 290 | 7.36k | isl_bool match; | 291 | 7.36k | | 292 | 7.36k | multi_space = FN(MULTI(BASE),get_space)(multi); | 293 | 7.36k | match = FN(EL,matching_params)(el, multi_space); | 294 | 7.36k | if (match < 0) | 295 | 0 | goto error; | 296 | 7.36k | if (!match) { | 297 | 0 | multi = FN(MULTI(BASE),align_params)(multi, | 298 | 0 | FN(EL,get_space)(el)); | 299 | 0 | isl_space_free(multi_space); | 300 | 0 | multi_space = FN(MULTI(BASE),get_space)(multi); | 301 | 0 | el = FN(EL,align_params)(el, isl_space_copy(multi_space)); | 302 | 0 | } | 303 | 7.36k | | 304 | 7.36k | multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el); | 305 | 7.36k | | 306 | 7.36k | isl_space_free(multi_space); | 307 | 7.36k | isl_space_free(el_space); | 308 | 7.36k | | 309 | 7.36k | return multi; | 310 | 7.36k | error: | 311 | 0 | FN(MULTI(BASE),free)(multi); | 312 | 0 | FN(EL,free)(el); | 313 | 0 | isl_space_free(multi_space); | 314 | 0 | isl_space_free(el_space); | 315 | 0 | return NULL; | 316 | 7.36k | } |
isl_multi_union_pw_aff_set_union_pw_aff Line | Count | Source | 287 | 11.5k | { | 288 | 11.5k | isl_space *multi_space = NULL; | 289 | 11.5k | isl_space *el_space = NULL; | 290 | 11.5k | isl_bool match; | 291 | 11.5k | | 292 | 11.5k | multi_space = FN(MULTI(BASE),get_space)(multi); | 293 | 11.5k | match = FN(EL,matching_params)(el, multi_space); | 294 | 11.5k | if (match < 0) | 295 | 0 | goto error; | 296 | 11.5k | if (!match) { | 297 | 0 | multi = FN(MULTI(BASE),align_params)(multi, | 298 | 0 | FN(EL,get_space)(el)); | 299 | 0 | isl_space_free(multi_space); | 300 | 0 | multi_space = FN(MULTI(BASE),get_space)(multi); | 301 | 0 | el = FN(EL,align_params)(el, isl_space_copy(multi_space)); | 302 | 0 | } | 303 | 11.5k | | 304 | 11.5k | multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el); | 305 | 11.5k | | 306 | 11.5k | isl_space_free(multi_space); | 307 | 11.5k | isl_space_free(el_space); | 308 | 11.5k | | 309 | 11.5k | return multi; | 310 | 11.5k | error: | 311 | 0 | FN(MULTI(BASE),free)(multi); | 312 | 0 | FN(EL,free)(el); | 313 | 0 | isl_space_free(multi_space); | 314 | 0 | isl_space_free(el_space); | 315 | 0 | return NULL; | 316 | 11.5k | } |
Line | Count | Source | 287 | 14.8k | { | 288 | 14.8k | isl_space *multi_space = NULL; | 289 | 14.8k | isl_space *el_space = NULL; | 290 | 14.8k | isl_bool match; | 291 | 14.8k | | 292 | 14.8k | multi_space = FN(MULTI(BASE),get_space)(multi); | 293 | 14.8k | match = FN(EL,matching_params)(el, multi_space); | 294 | 14.8k | if (match < 0) | 295 | 0 | goto error; | 296 | 14.8k | if (!match) { | 297 | 0 | multi = FN(MULTI(BASE),align_params)(multi, | 298 | 0 | FN(EL,get_space)(el)); | 299 | 0 | isl_space_free(multi_space); | 300 | 0 | multi_space = FN(MULTI(BASE),get_space)(multi); | 301 | 0 | el = FN(EL,align_params)(el, isl_space_copy(multi_space)); | 302 | 0 | } | 303 | 14.8k | | 304 | 14.8k | multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el); | 305 | 14.8k | | 306 | 14.8k | isl_space_free(multi_space); | 307 | 14.8k | isl_space_free(el_space); | 308 | 14.8k | | 309 | 14.8k | return multi; | 310 | 14.8k | error: | 311 | 0 | FN(MULTI(BASE),free)(multi); | 312 | 0 | FN(EL,free)(el); | 313 | 0 | isl_space_free(multi_space); | 314 | 0 | isl_space_free(el_space); | 315 | 0 | return NULL; | 316 | 14.8k | } |
|
317 | | |
318 | | /* Reset the space of "multi". This function is called from isl_pw_templ.c |
319 | | * and doesn't know if the space of an element object is represented |
320 | | * directly or through its domain. It therefore passes along both, |
321 | | * which we pass along to the element function since we don't know how |
322 | | * that is represented either. |
323 | | * |
324 | | * If "multi" has an explicit domain, then the caller is expected |
325 | | * to make sure that any modification that would change the dimensions |
326 | | * of the explicit domain has bee applied before this function is called. |
327 | | */ |
328 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space_and_domain)( |
329 | | __isl_take MULTI(BASE) *multi, __isl_take isl_space *space, |
330 | | __isl_take isl_space *domain) |
331 | 24.5k | { |
332 | 24.5k | int i; |
333 | 24.5k | |
334 | 24.5k | multi = FN(MULTI(BASE),cow)(multi); |
335 | 24.5k | if (!multi || !space || !domain) |
336 | 0 | goto error; |
337 | 24.5k | |
338 | 85.1k | for (i = 0; 24.5k i < multi->n; ++i60.6k ) { |
339 | 60.6k | multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i], |
340 | 60.6k | isl_space_copy(domain)); |
341 | 60.6k | if (!multi->u.p[i]) |
342 | 0 | goto error; |
343 | 60.6k | } |
344 | 24.5k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { |
345 | 63 | multi = FN(MULTI(BASE),reset_explicit_domain_space)(multi, |
346 | 63 | isl_space_copy(domain)); |
347 | 63 | if (!multi) |
348 | 0 | goto error; |
349 | 24.5k | } |
350 | 24.5k | isl_space_free(domain); |
351 | 24.5k | isl_space_free(multi->space); |
352 | 24.5k | multi->space = space; |
353 | 24.5k | |
354 | 24.5k | return multi; |
355 | 24.5k | error: |
356 | 0 | isl_space_free(domain); |
357 | 0 | isl_space_free(space); |
358 | 0 | FN(MULTI(BASE),free)(multi); |
359 | 0 | return NULL; |
360 | 24.5k | } isl_multi_aff_reset_space_and_domain Line | Count | Source | 331 | 5.74k | { | 332 | 5.74k | int i; | 333 | 5.74k | | 334 | 5.74k | multi = FN(MULTI(BASE),cow)(multi); | 335 | 5.74k | if (!multi || !space || !domain) | 336 | 0 | goto error; | 337 | 5.74k | | 338 | 19.4k | for (i = 0; 5.74k i < multi->n; ++i13.7k ) { | 339 | 13.7k | multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i], | 340 | 13.7k | isl_space_copy(domain)); | 341 | 13.7k | if (!multi->u.p[i]) | 342 | 0 | goto error; | 343 | 13.7k | } | 344 | 5.74k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 345 | 0 | multi = FN(MULTI(BASE),reset_explicit_domain_space)(multi, | 346 | 0 | isl_space_copy(domain)); | 347 | 0 | if (!multi) | 348 | 0 | goto error; | 349 | 5.74k | } | 350 | 5.74k | isl_space_free(domain); | 351 | 5.74k | isl_space_free(multi->space); | 352 | 5.74k | multi->space = space; | 353 | 5.74k | | 354 | 5.74k | return multi; | 355 | 5.74k | error: | 356 | 0 | isl_space_free(domain); | 357 | 0 | isl_space_free(space); | 358 | 0 | FN(MULTI(BASE),free)(multi); | 359 | 0 | return NULL; | 360 | 5.74k | } |
isl_multi_pw_aff_reset_space_and_domain Line | Count | Source | 331 | 15.4k | { | 332 | 15.4k | int i; | 333 | 15.4k | | 334 | 15.4k | multi = FN(MULTI(BASE),cow)(multi); | 335 | 15.4k | if (!multi || !space || !domain) | 336 | 0 | goto error; | 337 | 15.4k | | 338 | 59.0k | for (i = 0; 15.4k i < multi->n; ++i43.6k ) { | 339 | 43.6k | multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i], | 340 | 43.6k | isl_space_copy(domain)); | 341 | 43.6k | if (!multi->u.p[i]) | 342 | 0 | goto error; | 343 | 43.6k | } | 344 | 15.4k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 345 | 22 | multi = FN(MULTI(BASE),reset_explicit_domain_space)(multi, | 346 | 22 | isl_space_copy(domain)); | 347 | 22 | if (!multi) | 348 | 0 | goto error; | 349 | 15.4k | } | 350 | 15.4k | isl_space_free(domain); | 351 | 15.4k | isl_space_free(multi->space); | 352 | 15.4k | multi->space = space; | 353 | 15.4k | | 354 | 15.4k | return multi; | 355 | 15.4k | error: | 356 | 0 | isl_space_free(domain); | 357 | 0 | isl_space_free(space); | 358 | 0 | FN(MULTI(BASE),free)(multi); | 359 | 0 | return NULL; | 360 | 15.4k | } |
isl_multi_union_pw_aff_reset_space_and_domain Line | Count | Source | 331 | 247 | { | 332 | 247 | int i; | 333 | 247 | | 334 | 247 | multi = FN(MULTI(BASE),cow)(multi); | 335 | 247 | if (!multi || !space || !domain) | 336 | 0 | goto error; | 337 | 247 | | 338 | 481 | for (i = 0; 247 i < multi->n; ++i234 ) { | 339 | 234 | multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i], | 340 | 234 | isl_space_copy(domain)); | 341 | 234 | if (!multi->u.p[i]) | 342 | 0 | goto error; | 343 | 234 | } | 344 | 247 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 345 | 41 | multi = FN(MULTI(BASE),reset_explicit_domain_space)(multi, | 346 | 41 | isl_space_copy(domain)); | 347 | 41 | if (!multi) | 348 | 0 | goto error; | 349 | 247 | } | 350 | 247 | isl_space_free(domain); | 351 | 247 | isl_space_free(multi->space); | 352 | 247 | multi->space = space; | 353 | 247 | | 354 | 247 | return multi; | 355 | 247 | error: | 356 | 0 | isl_space_free(domain); | 357 | 0 | isl_space_free(space); | 358 | 0 | FN(MULTI(BASE),free)(multi); | 359 | 0 | return NULL; | 360 | 247 | } |
isl_multi_val_reset_space_and_domain Line | Count | Source | 331 | 3.05k | { | 332 | 3.05k | int i; | 333 | 3.05k | | 334 | 3.05k | multi = FN(MULTI(BASE),cow)(multi); | 335 | 3.05k | if (!multi || !space || !domain) | 336 | 0 | goto error; | 337 | 3.05k | | 338 | 6.11k | for (i = 0; 3.05k i < multi->n; ++i3.05k ) { | 339 | 3.05k | multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i], | 340 | 3.05k | isl_space_copy(domain)); | 341 | 3.05k | if (!multi->u.p[i]) | 342 | 0 | goto error; | 343 | 3.05k | } | 344 | 3.05k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 345 | 0 | multi = FN(MULTI(BASE),reset_explicit_domain_space)(multi, | 346 | 0 | isl_space_copy(domain)); | 347 | 0 | if (!multi) | 348 | 0 | goto error; | 349 | 3.05k | } | 350 | 3.05k | isl_space_free(domain); | 351 | 3.05k | isl_space_free(multi->space); | 352 | 3.05k | multi->space = space; | 353 | 3.05k | | 354 | 3.05k | return multi; | 355 | 3.05k | error: | 356 | 0 | isl_space_free(domain); | 357 | 0 | isl_space_free(space); | 358 | 0 | FN(MULTI(BASE),free)(multi); | 359 | 0 | return NULL; | 360 | 3.05k | } |
|
361 | | |
362 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_domain_space)( |
363 | | __isl_take MULTI(BASE) *multi, __isl_take isl_space *domain) |
364 | 3.31k | { |
365 | 3.31k | isl_space *space; |
366 | 3.31k | |
367 | 3.31k | space = isl_space_extend_domain_with_range(isl_space_copy(domain), |
368 | 3.31k | isl_space_copy(multi->space)); |
369 | 3.31k | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); |
370 | 3.31k | } isl_multi_aff_reset_domain_space Line | Count | Source | 364 | 25 | { | 365 | 25 | isl_space *space; | 366 | 25 | | 367 | 25 | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 368 | 25 | isl_space_copy(multi->space)); | 369 | 25 | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 370 | 25 | } |
isl_multi_pw_aff_reset_domain_space Line | Count | Source | 364 | 11 | { | 365 | 11 | isl_space *space; | 366 | 11 | | 367 | 11 | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 368 | 11 | isl_space_copy(multi->space)); | 369 | 11 | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 370 | 11 | } |
isl_multi_union_pw_aff_reset_domain_space Line | Count | Source | 364 | 223 | { | 365 | 223 | isl_space *space; | 366 | 223 | | 367 | 223 | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 368 | 223 | isl_space_copy(multi->space)); | 369 | 223 | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 370 | 223 | } |
isl_multi_val_reset_domain_space Line | Count | Source | 364 | 3.05k | { | 365 | 3.05k | isl_space *space; | 366 | 3.05k | | 367 | 3.05k | space = isl_space_extend_domain_with_range(isl_space_copy(domain), | 368 | 3.05k | isl_space_copy(multi->space)); | 369 | 3.05k | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 370 | 3.05k | } |
|
371 | | |
372 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space)( |
373 | | __isl_take MULTI(BASE) *multi, __isl_take isl_space *space) |
374 | 18.2k | { |
375 | 18.2k | isl_space *domain; |
376 | 18.2k | |
377 | 18.2k | domain = isl_space_domain(isl_space_copy(space)); |
378 | 18.2k | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); |
379 | 18.2k | } isl_multi_aff_reset_space Line | Count | Source | 374 | 2.70k | { | 375 | 2.70k | isl_space *domain; | 376 | 2.70k | | 377 | 2.70k | domain = isl_space_domain(isl_space_copy(space)); | 378 | 2.70k | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 379 | 2.70k | } |
isl_multi_pw_aff_reset_space Line | Count | Source | 374 | 15.4k | { | 375 | 15.4k | isl_space *domain; | 376 | 15.4k | | 377 | 15.4k | domain = isl_space_domain(isl_space_copy(space)); | 378 | 15.4k | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 379 | 15.4k | } |
isl_multi_union_pw_aff_reset_space Line | Count | Source | 374 | 24 | { | 375 | 24 | isl_space *domain; | 376 | 24 | | 377 | 24 | domain = isl_space_domain(isl_space_copy(space)); | 378 | 24 | return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain); | 379 | 24 | } |
Unexecuted instantiation: isl_multi_val_reset_space |
380 | | |
381 | | /* Set the id of the given dimension of "multi" to "id". |
382 | | */ |
383 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_id)( |
384 | | __isl_take MULTI(BASE) *multi, |
385 | | enum isl_dim_type type, unsigned pos, __isl_take isl_id *id) |
386 | 15.4k | { |
387 | 15.4k | isl_space *space; |
388 | 15.4k | |
389 | 15.4k | multi = FN(MULTI(BASE),cow)(multi); |
390 | 15.4k | if (!multi || !id) |
391 | 0 | goto error; |
392 | 15.4k | |
393 | 15.4k | space = FN(MULTI(BASE),get_space)(multi); |
394 | 15.4k | space = isl_space_set_dim_id(space, type, pos, id); |
395 | 15.4k | |
396 | 15.4k | return FN(MULTI(BASE),reset_space)(multi, space); |
397 | 15.4k | error: |
398 | 0 | isl_id_free(id); |
399 | 0 | FN(MULTI(BASE),free)(multi); |
400 | 0 | return NULL; |
401 | 15.4k | } Unexecuted instantiation: isl_multi_aff_set_dim_id isl_multi_pw_aff_set_dim_id Line | Count | Source | 386 | 15.4k | { | 387 | 15.4k | isl_space *space; | 388 | 15.4k | | 389 | 15.4k | multi = FN(MULTI(BASE),cow)(multi); | 390 | 15.4k | if (!multi || !id) | 391 | 0 | goto error; | 392 | 15.4k | | 393 | 15.4k | space = FN(MULTI(BASE),get_space)(multi); | 394 | 15.4k | space = isl_space_set_dim_id(space, type, pos, id); | 395 | 15.4k | | 396 | 15.4k | return FN(MULTI(BASE),reset_space)(multi, space); | 397 | 15.4k | error: | 398 | 0 | isl_id_free(id); | 399 | 0 | FN(MULTI(BASE),free)(multi); | 400 | 0 | return NULL; | 401 | 15.4k | } |
Unexecuted instantiation: isl_multi_union_pw_aff_set_dim_id Unexecuted instantiation: isl_multi_val_set_dim_id |
402 | | |
403 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_name)( |
404 | | __isl_keep MULTI(BASE) *multi, enum isl_dim_type type, |
405 | | const char *s) |
406 | 1 | { |
407 | 1 | isl_space *space; |
408 | 1 | |
409 | 1 | multi = FN(MULTI(BASE),cow)(multi); |
410 | 1 | if (!multi) |
411 | 0 | return NULL; |
412 | 1 | |
413 | 1 | space = FN(MULTI(BASE),get_space)(multi); |
414 | 1 | space = isl_space_set_tuple_name(space, type, s); |
415 | 1 | |
416 | 1 | return FN(MULTI(BASE),reset_space)(multi, space); |
417 | 1 | } Unexecuted instantiation: isl_multi_aff_set_tuple_name isl_multi_pw_aff_set_tuple_name Line | Count | Source | 406 | 1 | { | 407 | 1 | isl_space *space; | 408 | 1 | | 409 | 1 | multi = FN(MULTI(BASE),cow)(multi); | 410 | 1 | if (!multi) | 411 | 0 | return NULL; | 412 | 1 | | 413 | 1 | space = FN(MULTI(BASE),get_space)(multi); | 414 | 1 | space = isl_space_set_tuple_name(space, type, s); | 415 | 1 | | 416 | 1 | return FN(MULTI(BASE),reset_space)(multi, space); | 417 | 1 | } |
Unexecuted instantiation: isl_multi_union_pw_aff_set_tuple_name Unexecuted instantiation: isl_multi_val_set_tuple_name |
418 | | |
419 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_id)( |
420 | | __isl_take MULTI(BASE) *multi, enum isl_dim_type type, |
421 | | __isl_take isl_id *id) |
422 | 116 | { |
423 | 116 | isl_space *space; |
424 | 116 | |
425 | 116 | multi = FN(MULTI(BASE),cow)(multi); |
426 | 116 | if (!multi) |
427 | 0 | goto error; |
428 | 116 | |
429 | 116 | space = FN(MULTI(BASE),get_space)(multi); |
430 | 116 | space = isl_space_set_tuple_id(space, type, id); |
431 | 116 | |
432 | 116 | return FN(MULTI(BASE),reset_space)(multi, space); |
433 | 116 | error: |
434 | 0 | isl_id_free(id); |
435 | 0 | return NULL; |
436 | 116 | } isl_multi_aff_set_tuple_id Line | Count | Source | 422 | 113 | { | 423 | 113 | isl_space *space; | 424 | 113 | | 425 | 113 | multi = FN(MULTI(BASE),cow)(multi); | 426 | 113 | if (!multi) | 427 | 0 | goto error; | 428 | 113 | | 429 | 113 | space = FN(MULTI(BASE),get_space)(multi); | 430 | 113 | space = isl_space_set_tuple_id(space, type, id); | 431 | 113 | | 432 | 113 | return FN(MULTI(BASE),reset_space)(multi, space); | 433 | 113 | error: | 434 | 0 | isl_id_free(id); | 435 | 0 | return NULL; | 436 | 113 | } |
Unexecuted instantiation: isl_multi_pw_aff_set_tuple_id isl_multi_union_pw_aff_set_tuple_id Line | Count | Source | 422 | 3 | { | 423 | 3 | isl_space *space; | 424 | 3 | | 425 | 3 | multi = FN(MULTI(BASE),cow)(multi); | 426 | 3 | if (!multi) | 427 | 0 | goto error; | 428 | 3 | | 429 | 3 | space = FN(MULTI(BASE),get_space)(multi); | 430 | 3 | space = isl_space_set_tuple_id(space, type, id); | 431 | 3 | | 432 | 3 | return FN(MULTI(BASE),reset_space)(multi, space); | 433 | 3 | error: | 434 | 0 | isl_id_free(id); | 435 | 0 | return NULL; | 436 | 3 | } |
Unexecuted instantiation: isl_multi_val_set_tuple_id |
437 | | |
438 | | /* Drop the id on the specified tuple. |
439 | | */ |
440 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_tuple_id)( |
441 | | __isl_take MULTI(BASE) *multi, enum isl_dim_type type) |
442 | 2.36k | { |
443 | 2.36k | isl_space *space; |
444 | 2.36k | |
445 | 2.36k | if (!multi) |
446 | 0 | return NULL; |
447 | 2.36k | if (!FN(MULTI(BASE),has_tuple_id)(multi, type)) |
448 | 2.35k | return multi; |
449 | 14 | |
450 | 14 | multi = FN(MULTI(BASE),cow)(multi); |
451 | 14 | if (!multi) |
452 | 0 | return NULL; |
453 | 14 | |
454 | 14 | space = FN(MULTI(BASE),get_space)(multi); |
455 | 14 | space = isl_space_reset_tuple_id(space, type); |
456 | 14 | |
457 | 14 | return FN(MULTI(BASE),reset_space)(multi, space); |
458 | 14 | } Unexecuted instantiation: isl_multi_aff_reset_tuple_id Unexecuted instantiation: isl_multi_pw_aff_reset_tuple_id isl_multi_union_pw_aff_reset_tuple_id Line | Count | Source | 442 | 2.36k | { | 443 | 2.36k | isl_space *space; | 444 | 2.36k | | 445 | 2.36k | if (!multi) | 446 | 0 | return NULL; | 447 | 2.36k | if (!FN(MULTI(BASE),has_tuple_id)(multi, type)) | 448 | 2.35k | return multi; | 449 | 14 | | 450 | 14 | multi = FN(MULTI(BASE),cow)(multi); | 451 | 14 | if (!multi) | 452 | 0 | return NULL; | 453 | 14 | | 454 | 14 | space = FN(MULTI(BASE),get_space)(multi); | 455 | 14 | space = isl_space_reset_tuple_id(space, type); | 456 | 14 | | 457 | 14 | return FN(MULTI(BASE),reset_space)(multi, space); | 458 | 14 | } |
Unexecuted instantiation: isl_multi_val_reset_tuple_id |
459 | | |
460 | | /* Reset the user pointer on all identifiers of parameters and tuples |
461 | | * of the space of "multi". |
462 | | */ |
463 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_user)( |
464 | | __isl_take MULTI(BASE) *multi) |
465 | 0 | { |
466 | 0 | isl_space *space; |
467 | 0 |
|
468 | 0 | space = FN(MULTI(BASE),get_space)(multi); |
469 | 0 | space = isl_space_reset_user(space); |
470 | 0 |
|
471 | 0 | return FN(MULTI(BASE),reset_space)(multi, space); |
472 | 0 | } Unexecuted instantiation: isl_multi_aff_reset_user Unexecuted instantiation: isl_multi_pw_aff_reset_user Unexecuted instantiation: isl_multi_union_pw_aff_reset_user Unexecuted instantiation: isl_multi_val_reset_user |
473 | | |
474 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),realign_domain)( |
475 | | __isl_take MULTI(BASE) *multi, __isl_take isl_reordering *exp) |
476 | 3.31k | { |
477 | 3.31k | int i; |
478 | 3.31k | isl_space *space; |
479 | 3.31k | |
480 | 3.31k | multi = FN(MULTI(BASE),cow)(multi); |
481 | 3.31k | if (!multi || !exp) |
482 | 0 | goto error; |
483 | 3.31k | |
484 | 6.56k | for (i = 0; 3.31k i < multi->n; ++i3.25k ) { |
485 | 3.25k | multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i], |
486 | 3.25k | isl_reordering_copy(exp)); |
487 | 3.25k | if (!multi->u.p[i]) |
488 | 0 | goto error; |
489 | 3.25k | } |
490 | 3.31k | |
491 | 3.31k | space = isl_reordering_get_space(exp); |
492 | 3.31k | multi = FN(MULTI(BASE),reset_domain_space)(multi, space); |
493 | 3.31k | |
494 | 3.31k | isl_reordering_free(exp); |
495 | 3.31k | return multi; |
496 | 3.31k | error: |
497 | 0 | isl_reordering_free(exp); |
498 | 0 | FN(MULTI(BASE),free)(multi); |
499 | 0 | return NULL; |
500 | 3.31k | } isl_multi_aff_realign_domain Line | Count | Source | 476 | 19 | { | 477 | 19 | int i; | 478 | 19 | isl_space *space; | 479 | 19 | | 480 | 19 | multi = FN(MULTI(BASE),cow)(multi); | 481 | 19 | if (!multi || !exp) | 482 | 0 | goto error; | 483 | 19 | | 484 | 26 | for (i = 0; 19 i < multi->n; ++i7 ) { | 485 | 7 | multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i], | 486 | 7 | isl_reordering_copy(exp)); | 487 | 7 | if (!multi->u.p[i]) | 488 | 0 | goto error; | 489 | 7 | } | 490 | 19 | | 491 | 19 | space = isl_reordering_get_space(exp); | 492 | 19 | multi = FN(MULTI(BASE),reset_domain_space)(multi, space); | 493 | 19 | | 494 | 19 | isl_reordering_free(exp); | 495 | 19 | return multi; | 496 | 19 | error: | 497 | 0 | isl_reordering_free(exp); | 498 | 0 | FN(MULTI(BASE),free)(multi); | 499 | 0 | return NULL; | 500 | 19 | } |
isl_multi_pw_aff_realign_domain Line | Count | Source | 476 | 11 | { | 477 | 11 | int i; | 478 | 11 | isl_space *space; | 479 | 11 | | 480 | 11 | multi = FN(MULTI(BASE),cow)(multi); | 481 | 11 | if (!multi || !exp) | 482 | 0 | goto error; | 483 | 11 | | 484 | 18 | for (i = 0; 11 i < multi->n; ++i7 ) { | 485 | 7 | multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i], | 486 | 7 | isl_reordering_copy(exp)); | 487 | 7 | if (!multi->u.p[i]) | 488 | 0 | goto error; | 489 | 7 | } | 490 | 11 | | 491 | 11 | space = isl_reordering_get_space(exp); | 492 | 11 | multi = FN(MULTI(BASE),reset_domain_space)(multi, space); | 493 | 11 | | 494 | 11 | isl_reordering_free(exp); | 495 | 11 | return multi; | 496 | 11 | error: | 497 | 0 | isl_reordering_free(exp); | 498 | 0 | FN(MULTI(BASE),free)(multi); | 499 | 0 | return NULL; | 500 | 11 | } |
isl_multi_union_pw_aff_realign_domain Line | Count | Source | 476 | 223 | { | 477 | 223 | int i; | 478 | 223 | isl_space *space; | 479 | 223 | | 480 | 223 | multi = FN(MULTI(BASE),cow)(multi); | 481 | 223 | if (!multi || !exp) | 482 | 0 | goto error; | 483 | 223 | | 484 | 410 | for (i = 0; 223 i < multi->n; ++i187 ) { | 485 | 187 | multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i], | 486 | 187 | isl_reordering_copy(exp)); | 487 | 187 | if (!multi->u.p[i]) | 488 | 0 | goto error; | 489 | 187 | } | 490 | 223 | | 491 | 223 | space = isl_reordering_get_space(exp); | 492 | 223 | multi = FN(MULTI(BASE),reset_domain_space)(multi, space); | 493 | 223 | | 494 | 223 | isl_reordering_free(exp); | 495 | 223 | return multi; | 496 | 223 | error: | 497 | 0 | isl_reordering_free(exp); | 498 | 0 | FN(MULTI(BASE),free)(multi); | 499 | 0 | return NULL; | 500 | 223 | } |
isl_multi_val_realign_domain Line | Count | Source | 476 | 3.05k | { | 477 | 3.05k | int i; | 478 | 3.05k | isl_space *space; | 479 | 3.05k | | 480 | 3.05k | multi = FN(MULTI(BASE),cow)(multi); | 481 | 3.05k | if (!multi || !exp) | 482 | 0 | goto error; | 483 | 3.05k | | 484 | 6.11k | for (i = 0; 3.05k i < multi->n; ++i3.05k ) { | 485 | 3.05k | multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i], | 486 | 3.05k | isl_reordering_copy(exp)); | 487 | 3.05k | if (!multi->u.p[i]) | 488 | 0 | goto error; | 489 | 3.05k | } | 490 | 3.05k | | 491 | 3.05k | space = isl_reordering_get_space(exp); | 492 | 3.05k | multi = FN(MULTI(BASE),reset_domain_space)(multi, space); | 493 | 3.05k | | 494 | 3.05k | isl_reordering_free(exp); | 495 | 3.05k | return multi; | 496 | 3.05k | error: | 497 | 0 | isl_reordering_free(exp); | 498 | 0 | FN(MULTI(BASE),free)(multi); | 499 | 0 | return NULL; | 500 | 3.05k | } |
|
501 | | |
502 | | /* Align the parameters of "multi" to those of "model". |
503 | | * |
504 | | * If "multi" has an explicit domain, then align the parameters |
505 | | * of the domain first. |
506 | | */ |
507 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),align_params)( |
508 | | __isl_take MULTI(BASE) *multi, __isl_take isl_space *model) |
509 | 8.43k | { |
510 | 8.43k | isl_ctx *ctx; |
511 | 8.43k | isl_bool equal_params; |
512 | 8.43k | isl_reordering *exp; |
513 | 8.43k | |
514 | 8.43k | if (!multi || !model) |
515 | 0 | goto error; |
516 | 8.43k | |
517 | 8.43k | equal_params = isl_space_has_equal_params(multi->space, model); |
518 | 8.43k | if (equal_params < 0) |
519 | 0 | goto error; |
520 | 8.43k | if (equal_params) { |
521 | 5.13k | isl_space_free(model); |
522 | 5.13k | return multi; |
523 | 5.13k | } |
524 | 3.30k | |
525 | 3.30k | ctx = isl_space_get_ctx(model); |
526 | 3.30k | if (!isl_space_has_named_params(model)) |
527 | 3.30k | isl_die0 (ctx, isl_error_invalid, |
528 | 3.30k | "model has unnamed parameters", goto error); |
529 | 3.30k | if (!isl_space_has_named_params(multi->space)) |
530 | 3.30k | isl_die0 (ctx, isl_error_invalid, |
531 | 3.30k | "input has unnamed parameters", goto error); |
532 | 3.30k | |
533 | 3.30k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { |
534 | 41 | multi = FN(MULTI(BASE),align_explicit_domain_params)(multi, |
535 | 41 | isl_space_copy(model)); |
536 | 41 | if (!multi) |
537 | 0 | goto error; |
538 | 3.30k | } |
539 | 3.30k | exp = isl_parameter_alignment_reordering(multi->space, model); |
540 | 3.30k | exp = isl_reordering_extend_space(exp, |
541 | 3.30k | FN(MULTI(BASE),get_domain_space)(multi)); |
542 | 3.30k | multi = FN(MULTI(BASE),realign_domain)(multi, exp); |
543 | 3.30k | |
544 | 3.30k | isl_space_free(model); |
545 | 3.30k | return multi; |
546 | 3.30k | error: |
547 | 0 | isl_space_free(model); |
548 | 0 | FN(MULTI(BASE),free)(multi); |
549 | 0 | return NULL; |
550 | 3.30k | } isl_multi_aff_align_params Line | Count | Source | 509 | 1.82k | { | 510 | 1.82k | isl_ctx *ctx; | 511 | 1.82k | isl_bool equal_params; | 512 | 1.82k | isl_reordering *exp; | 513 | 1.82k | | 514 | 1.82k | if (!multi || !model) | 515 | 0 | goto error; | 516 | 1.82k | | 517 | 1.82k | equal_params = isl_space_has_equal_params(multi->space, model); | 518 | 1.82k | if (equal_params < 0) | 519 | 0 | goto error; | 520 | 1.82k | if (equal_params) { | 521 | 1.81k | isl_space_free(model); | 522 | 1.81k | return multi; | 523 | 1.81k | } | 524 | 12 | | 525 | 12 | ctx = isl_space_get_ctx(model); | 526 | 12 | if (!isl_space_has_named_params(model)) | 527 | 12 | isl_die0 (ctx, isl_error_invalid, | 528 | 12 | "model has unnamed parameters", goto error); | 529 | 12 | if (!isl_space_has_named_params(multi->space)) | 530 | 12 | isl_die0 (ctx, isl_error_invalid, | 531 | 12 | "input has unnamed parameters", goto error); | 532 | 12 | | 533 | 12 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 534 | 0 | multi = FN(MULTI(BASE),align_explicit_domain_params)(multi, | 535 | 0 | isl_space_copy(model)); | 536 | 0 | if (!multi) | 537 | 0 | goto error; | 538 | 12 | } | 539 | 12 | exp = isl_parameter_alignment_reordering(multi->space, model); | 540 | 12 | exp = isl_reordering_extend_space(exp, | 541 | 12 | FN(MULTI(BASE),get_domain_space)(multi)); | 542 | 12 | multi = FN(MULTI(BASE),realign_domain)(multi, exp); | 543 | 12 | | 544 | 12 | isl_space_free(model); | 545 | 12 | return multi; | 546 | 12 | error: | 547 | 0 | isl_space_free(model); | 548 | 0 | FN(MULTI(BASE),free)(multi); | 549 | 0 | return NULL; | 550 | 12 | } |
isl_multi_pw_aff_align_params Line | Count | Source | 509 | 46 | { | 510 | 46 | isl_ctx *ctx; | 511 | 46 | isl_bool equal_params; | 512 | 46 | isl_reordering *exp; | 513 | 46 | | 514 | 46 | if (!multi || !model) | 515 | 0 | goto error; | 516 | 46 | | 517 | 46 | equal_params = isl_space_has_equal_params(multi->space, model); | 518 | 46 | if (equal_params < 0) | 519 | 0 | goto error; | 520 | 46 | if (equal_params) { | 521 | 35 | isl_space_free(model); | 522 | 35 | return multi; | 523 | 35 | } | 524 | 11 | | 525 | 11 | ctx = isl_space_get_ctx(model); | 526 | 11 | if (!isl_space_has_named_params(model)) | 527 | 11 | isl_die0 (ctx, isl_error_invalid, | 528 | 11 | "model has unnamed parameters", goto error); | 529 | 11 | if (!isl_space_has_named_params(multi->space)) | 530 | 11 | isl_die0 (ctx, isl_error_invalid, | 531 | 11 | "input has unnamed parameters", goto error); | 532 | 11 | | 533 | 11 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 534 | 5 | multi = FN(MULTI(BASE),align_explicit_domain_params)(multi, | 535 | 5 | isl_space_copy(model)); | 536 | 5 | if (!multi) | 537 | 0 | goto error; | 538 | 11 | } | 539 | 11 | exp = isl_parameter_alignment_reordering(multi->space, model); | 540 | 11 | exp = isl_reordering_extend_space(exp, | 541 | 11 | FN(MULTI(BASE),get_domain_space)(multi)); | 542 | 11 | multi = FN(MULTI(BASE),realign_domain)(multi, exp); | 543 | 11 | | 544 | 11 | isl_space_free(model); | 545 | 11 | return multi; | 546 | 11 | error: | 547 | 0 | isl_space_free(model); | 548 | 0 | FN(MULTI(BASE),free)(multi); | 549 | 0 | return NULL; | 550 | 11 | } |
isl_multi_union_pw_aff_align_params Line | Count | Source | 509 | 1.20k | { | 510 | 1.20k | isl_ctx *ctx; | 511 | 1.20k | isl_bool equal_params; | 512 | 1.20k | isl_reordering *exp; | 513 | 1.20k | | 514 | 1.20k | if (!multi || !model) | 515 | 0 | goto error; | 516 | 1.20k | | 517 | 1.20k | equal_params = isl_space_has_equal_params(multi->space, model); | 518 | 1.20k | if (equal_params < 0) | 519 | 0 | goto error; | 520 | 1.20k | if (equal_params) { | 521 | 985 | isl_space_free(model); | 522 | 985 | return multi; | 523 | 985 | } | 524 | 223 | | 525 | 223 | ctx = isl_space_get_ctx(model); | 526 | 223 | if (!isl_space_has_named_params(model)) | 527 | 223 | isl_die0 (ctx, isl_error_invalid, | 528 | 223 | "model has unnamed parameters", goto error); | 529 | 223 | if (!isl_space_has_named_params(multi->space)) | 530 | 223 | isl_die0 (ctx, isl_error_invalid, | 531 | 223 | "input has unnamed parameters", goto error); | 532 | 223 | | 533 | 223 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 534 | 36 | multi = FN(MULTI(BASE),align_explicit_domain_params)(multi, | 535 | 36 | isl_space_copy(model)); | 536 | 36 | if (!multi) | 537 | 0 | goto error; | 538 | 223 | } | 539 | 223 | exp = isl_parameter_alignment_reordering(multi->space, model); | 540 | 223 | exp = isl_reordering_extend_space(exp, | 541 | 223 | FN(MULTI(BASE),get_domain_space)(multi)); | 542 | 223 | multi = FN(MULTI(BASE),realign_domain)(multi, exp); | 543 | 223 | | 544 | 223 | isl_space_free(model); | 545 | 223 | return multi; | 546 | 223 | error: | 547 | 0 | isl_space_free(model); | 548 | 0 | FN(MULTI(BASE),free)(multi); | 549 | 0 | return NULL; | 550 | 223 | } |
isl_multi_val_align_params Line | Count | Source | 509 | 5.35k | { | 510 | 5.35k | isl_ctx *ctx; | 511 | 5.35k | isl_bool equal_params; | 512 | 5.35k | isl_reordering *exp; | 513 | 5.35k | | 514 | 5.35k | if (!multi || !model) | 515 | 0 | goto error; | 516 | 5.35k | | 517 | 5.35k | equal_params = isl_space_has_equal_params(multi->space, model); | 518 | 5.35k | if (equal_params < 0) | 519 | 0 | goto error; | 520 | 5.35k | if (equal_params) { | 521 | 2.30k | isl_space_free(model); | 522 | 2.30k | return multi; | 523 | 2.30k | } | 524 | 3.05k | | 525 | 3.05k | ctx = isl_space_get_ctx(model); | 526 | 3.05k | if (!isl_space_has_named_params(model)) | 527 | 3.05k | isl_die0 (ctx, isl_error_invalid, | 528 | 3.05k | "model has unnamed parameters", goto error); | 529 | 3.05k | if (!isl_space_has_named_params(multi->space)) | 530 | 3.05k | isl_die0 (ctx, isl_error_invalid, | 531 | 3.05k | "input has unnamed parameters", goto error); | 532 | 3.05k | | 533 | 3.05k | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { | 534 | 0 | multi = FN(MULTI(BASE),align_explicit_domain_params)(multi, | 535 | 0 | isl_space_copy(model)); | 536 | 0 | if (!multi) | 537 | 0 | goto error; | 538 | 3.05k | } | 539 | 3.05k | exp = isl_parameter_alignment_reordering(multi->space, model); | 540 | 3.05k | exp = isl_reordering_extend_space(exp, | 541 | 3.05k | FN(MULTI(BASE),get_domain_space)(multi)); | 542 | 3.05k | multi = FN(MULTI(BASE),realign_domain)(multi, exp); | 543 | 3.05k | | 544 | 3.05k | isl_space_free(model); | 545 | 3.05k | return multi; | 546 | 3.05k | error: | 547 | 0 | isl_space_free(model); | 548 | 0 | FN(MULTI(BASE),free)(multi); | 549 | 0 | return NULL; | 550 | 3.05k | } |
|
551 | | |
552 | | /* Create a multi expression in the given space with the elements of "list" |
553 | | * as base expressions. |
554 | | * |
555 | | * Since isl_multi_*_restore_* assumes that the element and |
556 | | * the multi expression have matching spaces, the alignment |
557 | | * (if any) needs to be performed beforehand. |
558 | | */ |
559 | | __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),LIST(BASE))( |
560 | | __isl_take isl_space *space, __isl_take LIST(EL) *list) |
561 | 6.66k | { |
562 | 6.66k | int i; |
563 | 6.66k | int n; |
564 | 6.66k | isl_ctx *ctx; |
565 | 6.66k | MULTI(BASE) *multi; |
566 | 6.66k | |
567 | 6.66k | if (!space || !list6.66k ) |
568 | 2 | goto error; |
569 | 6.66k | |
570 | 6.66k | ctx = isl_space_get_ctx(space); |
571 | 6.66k | n = FN(FN(LIST(EL),n),BASE)(list); |
572 | 6.66k | if (n != isl_space_dim(space, isl_dim_out)) |
573 | 6.66k | isl_die0 (ctx, isl_error_invalid, |
574 | 6.66k | "invalid number of elements in list", goto error); |
575 | 6.66k | |
576 | 15.5k | for (i = 0; 6.66k i < n; ++i8.83k ) { |
577 | 8.83k | EL *el = FN(LIST(EL),peek)(list, i); |
578 | 8.83k | space = isl_space_align_params(space, FN(EL,get_space)(el)); |
579 | 8.83k | } |
580 | 6.66k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); |
581 | 15.5k | for (i = 0; i < n; ++i8.83k ) { |
582 | 8.83k | EL *el = FN(FN(LIST(EL),get),BASE)(list, i); |
583 | 8.83k | el = FN(EL,align_params)(el, isl_space_copy(space)); |
584 | 8.83k | multi = FN(MULTI(BASE),restore_check_space)(multi, i, el); |
585 | 8.83k | } |
586 | 6.66k | |
587 | 6.66k | isl_space_free(space); |
588 | 6.66k | FN(LIST(EL),free)(list); |
589 | 6.66k | return multi; |
590 | 6.66k | error: |
591 | 2 | isl_space_free(space); |
592 | 2 | FN(LIST(EL),free)(list); |
593 | 2 | return NULL; |
594 | 6.66k | } isl_multi_aff_from_aff_list Line | Count | Source | 561 | 1 | { | 562 | 1 | int i; | 563 | 1 | int n; | 564 | 1 | isl_ctx *ctx; | 565 | 1 | MULTI(BASE) *multi; | 566 | 1 | | 567 | 1 | if (!space || !list) | 568 | 0 | goto error; | 569 | 1 | | 570 | 1 | ctx = isl_space_get_ctx(space); | 571 | 1 | n = FN(FN(LIST(EL),n),BASE)(list); | 572 | 1 | if (n != isl_space_dim(space, isl_dim_out)) | 573 | 1 | isl_die0 (ctx, isl_error_invalid, | 574 | 1 | "invalid number of elements in list", goto error); | 575 | 1 | | 576 | 2 | for (i = 0; 1 i < n; ++i1 ) { | 577 | 1 | EL *el = FN(LIST(EL),peek)(list, i); | 578 | 1 | space = isl_space_align_params(space, FN(EL,get_space)(el)); | 579 | 1 | } | 580 | 1 | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 581 | 2 | for (i = 0; i < n; ++i1 ) { | 582 | 1 | EL *el = FN(FN(LIST(EL),get),BASE)(list, i); | 583 | 1 | el = FN(EL,align_params)(el, isl_space_copy(space)); | 584 | 1 | multi = FN(MULTI(BASE),restore_check_space)(multi, i, el); | 585 | 1 | } | 586 | 1 | | 587 | 1 | isl_space_free(space); | 588 | 1 | FN(LIST(EL),free)(list); | 589 | 1 | return multi; | 590 | 1 | error: | 591 | 0 | isl_space_free(space); | 592 | 0 | FN(LIST(EL),free)(list); | 593 | 0 | return NULL; | 594 | 1 | } |
isl_multi_pw_aff_from_pw_aff_list Line | Count | Source | 561 | 6.40k | { | 562 | 6.40k | int i; | 563 | 6.40k | int n; | 564 | 6.40k | isl_ctx *ctx; | 565 | 6.40k | MULTI(BASE) *multi; | 566 | 6.40k | | 567 | 6.40k | if (!space || !list6.39k ) | 568 | 2 | goto error; | 569 | 6.39k | | 570 | 6.39k | ctx = isl_space_get_ctx(space); | 571 | 6.39k | n = FN(FN(LIST(EL),n),BASE)(list); | 572 | 6.39k | if (n != isl_space_dim(space, isl_dim_out)) | 573 | 6.39k | isl_die0 (ctx, isl_error_invalid, | 574 | 6.39k | "invalid number of elements in list", goto error); | 575 | 6.39k | | 576 | 15.0k | for (i = 0; 6.39k i < n; ++i8.67k ) { | 577 | 8.67k | EL *el = FN(LIST(EL),peek)(list, i); | 578 | 8.67k | space = isl_space_align_params(space, FN(EL,get_space)(el)); | 579 | 8.67k | } | 580 | 6.39k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 581 | 15.0k | for (i = 0; i < n; ++i8.67k ) { | 582 | 8.67k | EL *el = FN(FN(LIST(EL),get),BASE)(list, i); | 583 | 8.67k | el = FN(EL,align_params)(el, isl_space_copy(space)); | 584 | 8.67k | multi = FN(MULTI(BASE),restore_check_space)(multi, i, el); | 585 | 8.67k | } | 586 | 6.39k | | 587 | 6.39k | isl_space_free(space); | 588 | 6.39k | FN(LIST(EL),free)(list); | 589 | 6.39k | return multi; | 590 | 6.39k | error: | 591 | 2 | isl_space_free(space); | 592 | 2 | FN(LIST(EL),free)(list); | 593 | 2 | return NULL; | 594 | 6.39k | } |
isl_multi_union_pw_aff_from_union_pw_aff_list Line | Count | Source | 561 | 260 | { | 562 | 260 | int i; | 563 | 260 | int n; | 564 | 260 | isl_ctx *ctx; | 565 | 260 | MULTI(BASE) *multi; | 566 | 260 | | 567 | 260 | if (!space || !list) | 568 | 0 | goto error; | 569 | 260 | | 570 | 260 | ctx = isl_space_get_ctx(space); | 571 | 260 | n = FN(FN(LIST(EL),n),BASE)(list); | 572 | 260 | if (n != isl_space_dim(space, isl_dim_out)) | 573 | 260 | isl_die0 (ctx, isl_error_invalid, | 574 | 260 | "invalid number of elements in list", goto error); | 575 | 260 | | 576 | 404 | for (i = 0; 260 i < n; ++i144 ) { | 577 | 144 | EL *el = FN(LIST(EL),peek)(list, i); | 578 | 144 | space = isl_space_align_params(space, FN(EL,get_space)(el)); | 579 | 144 | } | 580 | 260 | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 581 | 404 | for (i = 0; i < n; ++i144 ) { | 582 | 144 | EL *el = FN(FN(LIST(EL),get),BASE)(list, i); | 583 | 144 | el = FN(EL,align_params)(el, isl_space_copy(space)); | 584 | 144 | multi = FN(MULTI(BASE),restore_check_space)(multi, i, el); | 585 | 144 | } | 586 | 260 | | 587 | 260 | isl_space_free(space); | 588 | 260 | FN(LIST(EL),free)(list); | 589 | 260 | return multi; | 590 | 260 | error: | 591 | 0 | isl_space_free(space); | 592 | 0 | FN(LIST(EL),free)(list); | 593 | 0 | return NULL; | 594 | 260 | } |
isl_multi_val_from_val_list Line | Count | Source | 561 | 7 | { | 562 | 7 | int i; | 563 | 7 | int n; | 564 | 7 | isl_ctx *ctx; | 565 | 7 | MULTI(BASE) *multi; | 566 | 7 | | 567 | 7 | if (!space || !list) | 568 | 0 | goto error; | 569 | 7 | | 570 | 7 | ctx = isl_space_get_ctx(space); | 571 | 7 | n = FN(FN(LIST(EL),n),BASE)(list); | 572 | 7 | if (n != isl_space_dim(space, isl_dim_out)) | 573 | 7 | isl_die0 (ctx, isl_error_invalid, | 574 | 7 | "invalid number of elements in list", goto error); | 575 | 7 | | 576 | 24 | for (i = 0; 7 i < n; ++i17 ) { | 577 | 17 | EL *el = FN(LIST(EL),peek)(list, i); | 578 | 17 | space = isl_space_align_params(space, FN(EL,get_space)(el)); | 579 | 17 | } | 580 | 7 | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 581 | 24 | for (i = 0; i < n; ++i17 ) { | 582 | 17 | EL *el = FN(FN(LIST(EL),get),BASE)(list, i); | 583 | 17 | el = FN(EL,align_params)(el, isl_space_copy(space)); | 584 | 17 | multi = FN(MULTI(BASE),restore_check_space)(multi, i, el); | 585 | 17 | } | 586 | 7 | | 587 | 7 | isl_space_free(space); | 588 | 7 | FN(LIST(EL),free)(list); | 589 | 7 | return multi; | 590 | 7 | error: | 591 | 0 | isl_space_free(space); | 592 | 0 | FN(LIST(EL),free)(list); | 593 | 0 | return NULL; | 594 | 7 | } |
|
595 | | |
596 | | #ifndef NO_IDENTITY |
597 | | /* Create a multi expression in the given space that maps each |
598 | | * input dimension to the corresponding output dimension. |
599 | | */ |
600 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),identity)(__isl_take isl_space *space) |
601 | 6.52k | { |
602 | 6.52k | int i, n; |
603 | 6.52k | isl_local_space *ls; |
604 | 6.52k | MULTI(BASE) *multi; |
605 | 6.52k | |
606 | 6.52k | if (!space) |
607 | 0 | return NULL; |
608 | 6.52k | |
609 | 6.52k | if (isl_space_is_set(space)) |
610 | 6.52k | isl_die0 (isl_space_get_ctx(space), isl_error_invalid, |
611 | 6.52k | "expecting map space", goto error); |
612 | 6.52k | |
613 | 6.52k | n = isl_space_dim(space, isl_dim_out); |
614 | 6.52k | if (n != isl_space_dim(space, isl_dim_in)) |
615 | 6.52k | isl_die0 (isl_space_get_ctx(space), isl_error_invalid, |
616 | 6.52k | "number of input and output dimensions needs to be " |
617 | 6.52k | "the same", goto error); |
618 | 6.52k | |
619 | 6.52k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); |
620 | 6.52k | |
621 | 6.52k | if (!n) { |
622 | 2.15k | isl_space_free(space); |
623 | 2.15k | return multi; |
624 | 2.15k | } |
625 | 4.37k | |
626 | 4.37k | space = isl_space_domain(space); |
627 | 4.37k | ls = isl_local_space_from_space(space); |
628 | 4.37k | |
629 | 29.6k | for (i = 0; i < n; ++i25.2k ) { |
630 | 25.2k | EL *el; |
631 | 25.2k | el = FN(EL,var_on_domain)(isl_local_space_copy(ls), |
632 | 25.2k | isl_dim_set, i); |
633 | 25.2k | multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el); |
634 | 25.2k | } |
635 | 4.37k | |
636 | 4.37k | isl_local_space_free(ls); |
637 | 4.37k | |
638 | 4.37k | return multi; |
639 | 4.37k | error: |
640 | 0 | isl_space_free(space); |
641 | 0 | return NULL; |
642 | 4.37k | } Line | Count | Source | 601 | 6.52k | { | 602 | 6.52k | int i, n; | 603 | 6.52k | isl_local_space *ls; | 604 | 6.52k | MULTI(BASE) *multi; | 605 | 6.52k | | 606 | 6.52k | if (!space) | 607 | 0 | return NULL; | 608 | 6.52k | | 609 | 6.52k | if (isl_space_is_set(space)) | 610 | 6.52k | isl_die0 (isl_space_get_ctx(space), isl_error_invalid, | 611 | 6.52k | "expecting map space", goto error); | 612 | 6.52k | | 613 | 6.52k | n = isl_space_dim(space, isl_dim_out); | 614 | 6.52k | if (n != isl_space_dim(space, isl_dim_in)) | 615 | 6.52k | isl_die0 (isl_space_get_ctx(space), isl_error_invalid, | 616 | 6.52k | "number of input and output dimensions needs to be " | 617 | 6.52k | "the same", goto error); | 618 | 6.52k | | 619 | 6.52k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 620 | 6.52k | | 621 | 6.52k | if (!n) { | 622 | 2.15k | isl_space_free(space); | 623 | 2.15k | return multi; | 624 | 2.15k | } | 625 | 4.37k | | 626 | 4.37k | space = isl_space_domain(space); | 627 | 4.37k | ls = isl_local_space_from_space(space); | 628 | 4.37k | | 629 | 29.6k | for (i = 0; i < n; ++i25.2k ) { | 630 | 25.2k | EL *el; | 631 | 25.2k | el = FN(EL,var_on_domain)(isl_local_space_copy(ls), | 632 | 25.2k | isl_dim_set, i); | 633 | 25.2k | multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el); | 634 | 25.2k | } | 635 | 4.37k | | 636 | 4.37k | isl_local_space_free(ls); | 637 | 4.37k | | 638 | 4.37k | return multi; | 639 | 4.37k | error: | 640 | 0 | isl_space_free(space); | 641 | 0 | return NULL; | 642 | 4.37k | } |
Unexecuted instantiation: isl_multi_pw_aff_identity |
643 | | #endif |
644 | | |
645 | | #ifndef NO_ZERO |
646 | | /* Construct a multi expression in the given space with value zero in |
647 | | * each of the output dimensions. |
648 | | */ |
649 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space) |
650 | 6.35k | { |
651 | 6.35k | int n; |
652 | 6.35k | MULTI(BASE) *multi; |
653 | 6.35k | |
654 | 6.35k | if (!space) |
655 | 0 | return NULL; |
656 | 6.35k | |
657 | 6.35k | n = isl_space_dim(space , isl_dim_out); |
658 | 6.35k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); |
659 | 6.35k | |
660 | 6.35k | if (!n) |
661 | 1.32k | isl_space_free(space); |
662 | 5.02k | else { |
663 | 5.02k | int i; |
664 | 5.02k | isl_local_space *ls; |
665 | 5.02k | EL *el; |
666 | 5.02k | |
667 | 5.02k | space = isl_space_domain(space); |
668 | 5.02k | ls = isl_local_space_from_space(space); |
669 | 5.02k | el = FN(EL,zero_on_domain)(ls); |
670 | 5.02k | |
671 | 12.5k | for (i = 0; i < n; ++i7.48k ) |
672 | 7.48k | multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, |
673 | 7.48k | FN(EL,copy)(el)); |
674 | 5.02k | |
675 | 5.02k | FN(EL,free)(el); |
676 | 5.02k | } |
677 | 6.35k | |
678 | 6.35k | return multi; |
679 | 6.35k | } Line | Count | Source | 650 | 2.68k | { | 651 | 2.68k | int n; | 652 | 2.68k | MULTI(BASE) *multi; | 653 | 2.68k | | 654 | 2.68k | if (!space) | 655 | 0 | return NULL; | 656 | 2.68k | | 657 | 2.68k | n = isl_space_dim(space , isl_dim_out); | 658 | 2.68k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 659 | 2.68k | | 660 | 2.68k | if (!n) | 661 | 1.27k | isl_space_free(space); | 662 | 1.41k | else { | 663 | 1.41k | int i; | 664 | 1.41k | isl_local_space *ls; | 665 | 1.41k | EL *el; | 666 | 1.41k | | 667 | 1.41k | space = isl_space_domain(space); | 668 | 1.41k | ls = isl_local_space_from_space(space); | 669 | 1.41k | el = FN(EL,zero_on_domain)(ls); | 670 | 1.41k | | 671 | 3.41k | for (i = 0; i < n; ++i2.00k ) | 672 | 2.00k | multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, | 673 | 2.00k | FN(EL,copy)(el)); | 674 | 1.41k | | 675 | 1.41k | FN(EL,free)(el); | 676 | 1.41k | } | 677 | 2.68k | | 678 | 2.68k | return multi; | 679 | 2.68k | } |
Line | Count | Source | 650 | 2 | { | 651 | 2 | int n; | 652 | 2 | MULTI(BASE) *multi; | 653 | 2 | | 654 | 2 | if (!space) | 655 | 0 | return NULL; | 656 | 2 | | 657 | 2 | n = isl_space_dim(space , isl_dim_out); | 658 | 2 | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 659 | 2 | | 660 | 2 | if (!n) | 661 | 2 | isl_space_free(space); | 662 | 0 | else { | 663 | 0 | int i; | 664 | 0 | isl_local_space *ls; | 665 | 0 | EL *el; | 666 | 0 |
| 667 | 0 | space = isl_space_domain(space); | 668 | 0 | ls = isl_local_space_from_space(space); | 669 | 0 | el = FN(EL,zero_on_domain)(ls); | 670 | 0 |
| 671 | 0 | for (i = 0; i < n; ++i) | 672 | 0 | multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, | 673 | 0 | FN(EL,copy)(el)); | 674 | 0 |
| 675 | 0 | FN(EL,free)(el); | 676 | 0 | } | 677 | 2 | | 678 | 2 | return multi; | 679 | 2 | } |
Line | Count | Source | 650 | 3.67k | { | 651 | 3.67k | int n; | 652 | 3.67k | MULTI(BASE) *multi; | 653 | 3.67k | | 654 | 3.67k | if (!space) | 655 | 0 | return NULL; | 656 | 3.67k | | 657 | 3.67k | n = isl_space_dim(space , isl_dim_out); | 658 | 3.67k | multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 659 | 3.67k | | 660 | 3.67k | if (!n) | 661 | 57 | isl_space_free(space); | 662 | 3.61k | else { | 663 | 3.61k | int i; | 664 | 3.61k | isl_local_space *ls; | 665 | 3.61k | EL *el; | 666 | 3.61k | | 667 | 3.61k | space = isl_space_domain(space); | 668 | 3.61k | ls = isl_local_space_from_space(space); | 669 | 3.61k | el = FN(EL,zero_on_domain)(ls); | 670 | 3.61k | | 671 | 9.09k | for (i = 0; i < n; ++i5.48k ) | 672 | 5.48k | multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, | 673 | 5.48k | FN(EL,copy)(el)); | 674 | 3.61k | | 675 | 3.61k | FN(EL,free)(el); | 676 | 3.61k | } | 677 | 3.67k | | 678 | 3.67k | return multi; | 679 | 3.67k | } |
|
680 | | #endif |
681 | | |
682 | | #ifndef NO_FROM_BASE |
683 | | /* Create a multiple expression with a single output/set dimension |
684 | | * equal to "el". |
685 | | * For most multiple expression types, the base type has a single |
686 | | * output/set dimension and the space of the result is therefore |
687 | | * the same as the space of the input. |
688 | | * In the case of isl_multi_union_pw_aff, however, the base type |
689 | | * lives in a parameter space and we therefore need to add |
690 | | * a single set dimension. |
691 | | */ |
692 | | __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el) |
693 | 730 | { |
694 | 730 | isl_space *space; |
695 | 730 | MULTI(BASE) *multi; |
696 | 730 | |
697 | 730 | space = FN(EL,get_space(el)); |
698 | 730 | if (isl_space_is_params(space)) { |
699 | 0 | space = isl_space_set_from_params(space); |
700 | 0 | space = isl_space_add_dims(space, isl_dim_set, 1); |
701 | 0 | } |
702 | 730 | multi = FN(MULTI(BASE),alloc)(space); |
703 | 730 | multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el); |
704 | 730 | |
705 | 730 | return multi; |
706 | 730 | } Line | Count | Source | 693 | 730 | { | 694 | 730 | isl_space *space; | 695 | 730 | MULTI(BASE) *multi; | 696 | 730 | | 697 | 730 | space = FN(EL,get_space(el)); | 698 | 730 | if (isl_space_is_params(space)) { | 699 | 0 | space = isl_space_set_from_params(space); | 700 | 0 | space = isl_space_add_dims(space, isl_dim_set, 1); | 701 | 0 | } | 702 | 730 | multi = FN(MULTI(BASE),alloc)(space); | 703 | 730 | multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el); | 704 | 730 | | 705 | 730 | return multi; | 706 | 730 | } |
Unexecuted instantiation: isl_multi_pw_aff_from_pw_aff Unexecuted instantiation: isl_multi_union_pw_aff_from_union_pw_aff |
707 | | #endif |
708 | | |
709 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),drop_dims)( |
710 | | __isl_take MULTI(BASE) *multi, |
711 | | enum isl_dim_type type, unsigned first, unsigned n) |
712 | 1.63k | { |
713 | 1.63k | int i; |
714 | 1.63k | unsigned dim; |
715 | 1.63k | |
716 | 1.63k | multi = FN(MULTI(BASE),cow)(multi); |
717 | 1.63k | if (!multi) |
718 | 0 | return NULL; |
719 | 1.63k | |
720 | 1.63k | dim = FN(MULTI(BASE),dim)(multi, type); |
721 | 1.63k | if (first + n > dim || first + n < first) |
722 | 1.63k | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
723 | 1.63k | "index out of bounds", |
724 | 1.63k | return FN(MULTI(BASE),free)(multi)); |
725 | 1.63k | |
726 | 1.63k | multi->space = isl_space_drop_dims(multi->space, type, first, n); |
727 | 1.63k | if (!multi->space) |
728 | 0 | return FN(MULTI(BASE),free)(multi); |
729 | 1.63k | |
730 | 1.63k | if (type == isl_dim_out) { |
731 | 2.48k | for (i = 0; i < n; ++i1.24k ) |
732 | 1.24k | FN(EL,free)(multi->u.p[first + i]); |
733 | 2.24k | for (i = first; i + n < multi->n; ++i1.00k ) |
734 | 1.00k | multi->u.p[i] = multi->u.p[i + n]; |
735 | 1.23k | multi->n -= n; |
736 | 1.23k | if (n > 0 && FN1.08k (MULTI(BASE),has_explicit_domain)(multi)1.08k ) |
737 | 3 | multi = FN(MULTI(BASE),init_explicit_domain)(multi); |
738 | 1.23k | |
739 | 1.23k | return multi; |
740 | 1.23k | } |
741 | 393 | |
742 | 393 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) |
743 | 1 | multi = FN(MULTI(BASE),drop_explicit_domain_dims)(multi, |
744 | 1 | type, first, n); |
745 | 393 | if (!multi) |
746 | 0 | return NULL; |
747 | 393 | |
748 | 1.66k | for (i = 0; 393 i < multi->n; ++i1.27k ) { |
749 | 1.27k | multi->u.p[i] = FN(EL,drop_dims)(multi->u.p[i], type, first, n); |
750 | 1.27k | if (!multi->u.p[i]) |
751 | 0 | return FN(MULTI(BASE),free)(multi); |
752 | 1.27k | } |
753 | 393 | |
754 | 393 | return multi; |
755 | 393 | } Line | Count | Source | 712 | 1.53k | { | 713 | 1.53k | int i; | 714 | 1.53k | unsigned dim; | 715 | 1.53k | | 716 | 1.53k | multi = FN(MULTI(BASE),cow)(multi); | 717 | 1.53k | if (!multi) | 718 | 0 | return NULL; | 719 | 1.53k | | 720 | 1.53k | dim = FN(MULTI(BASE),dim)(multi, type); | 721 | 1.53k | if (first + n > dim || first + n < first) | 722 | 1.53k | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 723 | 1.53k | "index out of bounds", | 724 | 1.53k | return FN(MULTI(BASE),free)(multi)); | 725 | 1.53k | | 726 | 1.53k | multi->space = isl_space_drop_dims(multi->space, type, first, n); | 727 | 1.53k | if (!multi->space) | 728 | 0 | return FN(MULTI(BASE),free)(multi); | 729 | 1.53k | | 730 | 1.53k | if (type == isl_dim_out) { | 731 | 2.29k | for (i = 0; i < n; ++i1.14k ) | 732 | 1.14k | FN1.14k (EL,free)(multi->u.p[first + i])1.14k ; | 733 | 2.10k | for (i = first; i + n < multi->n; ++i959 ) | 734 | 959 | multi->u.p[i] = multi->u.p[i + n]; | 735 | 1.14k | multi->n -= n; | 736 | 1.14k | if (n > 0 && FN1.00k (MULTI(BASE),has_explicit_domain)(multi)1.00k ) | 737 | 0 | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 738 | 1.14k | | 739 | 1.14k | return multi; | 740 | 1.14k | } | 741 | 392 | | 742 | 392 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 743 | 0 | multi = FN(MULTI(BASE),drop_explicit_domain_dims)(multi, | 744 | 0 | type, first, n); | 745 | 392 | if (!multi) | 746 | 0 | return NULL; | 747 | 392 | | 748 | 1.66k | for (i = 0; 392 i < multi->n; ++i1.27k ) { | 749 | 1.27k | multi->u.p[i] = FN(EL,drop_dims)(multi->u.p[i], type, first, n); | 750 | 1.27k | if (!multi->u.p[i]) | 751 | 0 | return FN(MULTI(BASE),free)(multi); | 752 | 1.27k | } | 753 | 392 | | 754 | 392 | return multi; | 755 | 392 | } |
isl_multi_pw_aff_drop_dims Line | Count | Source | 712 | 13 | { | 713 | 13 | int i; | 714 | 13 | unsigned dim; | 715 | 13 | | 716 | 13 | multi = FN(MULTI(BASE),cow)(multi); | 717 | 13 | if (!multi) | 718 | 0 | return NULL; | 719 | 13 | | 720 | 13 | dim = FN(MULTI(BASE),dim)(multi, type); | 721 | 13 | if (first + n > dim || first + n < first) | 722 | 13 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 723 | 13 | "index out of bounds", | 724 | 13 | return FN(MULTI(BASE),free)(multi)); | 725 | 13 | | 726 | 13 | multi->space = isl_space_drop_dims(multi->space, type, first, n); | 727 | 13 | if (!multi->space) | 728 | 0 | return FN(MULTI(BASE),free)(multi); | 729 | 13 | | 730 | 13 | if (type == isl_dim_out) { | 731 | 16 | for (i = 0; i < n; ++i4 ) | 732 | 12 | FN4 (EL,free)(multi->u.p[first + i])4 ; | 733 | 14 | for (i = first; i + n < multi->n; ++i2 ) | 734 | 2 | multi->u.p[i] = multi->u.p[i + n]; | 735 | 12 | multi->n -= n; | 736 | 12 | if (n > 0 && FN4 (MULTI(BASE),has_explicit_domain)(multi)4 ) | 737 | 2 | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 738 | 12 | | 739 | 12 | return multi; | 740 | 12 | } | 741 | 1 | | 742 | 1 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 743 | 1 | multi = FN(MULTI(BASE),drop_explicit_domain_dims)(multi, | 744 | 1 | type, first, n); | 745 | 1 | if (!multi) | 746 | 0 | return NULL; | 747 | 1 | | 748 | 1 | for (i = 0; i < multi->n; ++i0 ) { | 749 | 0 | multi->u.p[i] = FN(EL,drop_dims)(multi->u.p[i], type, first, n); | 750 | 0 | if (!multi->u.p[i]) | 751 | 0 | return FN(MULTI(BASE),free)(multi); | 752 | 0 | } | 753 | 1 | | 754 | 1 | return multi; | 755 | 1 | } |
isl_multi_union_pw_aff_drop_dims Line | Count | Source | 712 | 79 | { | 713 | 79 | int i; | 714 | 79 | unsigned dim; | 715 | 79 | | 716 | 79 | multi = FN(MULTI(BASE),cow)(multi); | 717 | 79 | if (!multi) | 718 | 0 | return NULL; | 719 | 79 | | 720 | 79 | dim = FN(MULTI(BASE),dim)(multi, type); | 721 | 79 | if (first + n > dim || first + n < first) | 722 | 79 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 723 | 79 | "index out of bounds", | 724 | 79 | return FN(MULTI(BASE),free)(multi)); | 725 | 79 | | 726 | 79 | multi->space = isl_space_drop_dims(multi->space, type, first, n); | 727 | 79 | if (!multi->space) | 728 | 0 | return FN(MULTI(BASE),free)(multi); | 729 | 79 | | 730 | 79 | if (type == isl_dim_out) { | 731 | 172 | for (i = 0; i < n; ++i93 ) | 732 | 93 | FN(EL,free)(multi->u.p[first + i]); | 733 | 124 | for (i = first; i + n < multi->n; ++i45 ) | 734 | 45 | multi->u.p[i] = multi->u.p[i + n]; | 735 | 79 | multi->n -= n; | 736 | 79 | if (n > 0 && FN74 (MULTI(BASE),has_explicit_domain)(multi)74 ) | 737 | 1 | multi = FN(MULTI(BASE),init_explicit_domain)(multi); | 738 | 79 | | 739 | 79 | return multi; | 740 | 79 | } | 741 | 0 | | 742 | 0 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) | 743 | 0 | multi = FN(MULTI(BASE),drop_explicit_domain_dims)(multi, | 744 | 0 | type, first, n); | 745 | 0 | if (!multi) | 746 | 0 | return NULL; | 747 | 0 | | 748 | 0 | for (i = 0; i < multi->n; ++i) { | 749 | 0 | multi->u.p[i] = FN(EL,drop_dims)(multi->u.p[i], type, first, n); | 750 | 0 | if (!multi->u.p[i]) | 751 | 0 | return FN(MULTI(BASE),free)(multi); | 752 | 0 | } | 753 | 0 |
| 754 | 0 | return multi; | 755 | 0 | } |
Unexecuted instantiation: isl_multi_val_drop_dims |
756 | | |
757 | | /* Align the parameters of "multi1" and "multi2" (if needed) and call "fn". |
758 | | */ |
759 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),align_params_multi_multi_and)( |
760 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2, |
761 | | __isl_give MULTI(BASE) *(*fn)(__isl_take MULTI(BASE) *multi1, |
762 | | __isl_take MULTI(BASE) *multi2)) |
763 | 7.79k | { |
764 | 7.79k | isl_ctx *ctx; |
765 | 7.79k | isl_bool equal_params; |
766 | 7.79k | |
767 | 7.79k | if (!multi1 || !multi2) |
768 | 0 | goto error; |
769 | 7.79k | equal_params = isl_space_has_equal_params(multi1->space, multi2->space); |
770 | 7.79k | if (equal_params < 0) |
771 | 0 | goto error; |
772 | 7.79k | if (equal_params) |
773 | 7.75k | return fn(multi1, multi2); |
774 | 36 | ctx = FN(MULTI(BASE),get_ctx)(multi1); |
775 | 36 | if (!isl_space_has_named_params(multi1->space) || |
776 | 36 | !isl_space_has_named_params(multi2->space)) |
777 | 36 | isl_die0 (ctx, isl_error_invalid, |
778 | 36 | "unaligned unnamed parameters", goto error); |
779 | 36 | multi1 = FN(MULTI(BASE),align_params)(multi1, |
780 | 36 | FN(MULTI(BASE),get_space)(multi2)); |
781 | 36 | multi2 = FN(MULTI(BASE),align_params)(multi2, |
782 | 36 | FN(MULTI(BASE),get_space)(multi1)); |
783 | 36 | return fn(multi1, multi2); |
784 | 36 | error: |
785 | 0 | FN(MULTI(BASE),free)(multi1); |
786 | 0 | FN(MULTI(BASE),free)(multi2); |
787 | 0 | return NULL; |
788 | 36 | } isl_aff.c:isl_multi_aff_align_params_multi_multi_and Line | Count | Source | 763 | 5.06k | { | 764 | 5.06k | isl_ctx *ctx; | 765 | 5.06k | isl_bool equal_params; | 766 | 5.06k | | 767 | 5.06k | if (!multi1 || !multi2) | 768 | 0 | goto error; | 769 | 5.06k | equal_params = isl_space_has_equal_params(multi1->space, multi2->space); | 770 | 5.06k | if (equal_params < 0) | 771 | 0 | goto error; | 772 | 5.06k | if (equal_params) | 773 | 5.06k | return fn(multi1, multi2); | 774 | 0 | ctx = FN(MULTI(BASE),get_ctx)(multi1); | 775 | 0 | if (!isl_space_has_named_params(multi1->space) || | 776 | 0 | !isl_space_has_named_params(multi2->space)) | 777 | 0 | isl_die(ctx, isl_error_invalid, | 778 | 0 | "unaligned unnamed parameters", goto error); | 779 | 0 | multi1 = FN(MULTI(BASE),align_params)(multi1, | 780 | 0 | FN(MULTI(BASE),get_space)(multi2)); | 781 | 0 | multi2 = FN(MULTI(BASE),align_params)(multi2, | 782 | 0 | FN(MULTI(BASE),get_space)(multi1)); | 783 | 0 | return fn(multi1, multi2); | 784 | 0 | error: | 785 | 0 | FN(MULTI(BASE),free)(multi1); | 786 | 0 | FN(MULTI(BASE),free)(multi2); | 787 | 0 | return NULL; | 788 | 0 | } |
isl_aff.c:isl_multi_pw_aff_align_params_multi_multi_and Line | Count | Source | 763 | 36 | { | 764 | 36 | isl_ctx *ctx; | 765 | 36 | isl_bool equal_params; | 766 | 36 | | 767 | 36 | if (!multi1 || !multi2) | 768 | 0 | goto error; | 769 | 36 | equal_params = isl_space_has_equal_params(multi1->space, multi2->space); | 770 | 36 | if (equal_params < 0) | 771 | 0 | goto error; | 772 | 36 | if (equal_params) | 773 | 29 | return fn(multi1, multi2); | 774 | 7 | ctx = FN(MULTI(BASE),get_ctx)(multi1); | 775 | 7 | if (!isl_space_has_named_params(multi1->space) || | 776 | 7 | !isl_space_has_named_params(multi2->space)) | 777 | 7 | isl_die0 (ctx, isl_error_invalid, | 778 | 7 | "unaligned unnamed parameters", goto error); | 779 | 7 | multi1 = FN(MULTI(BASE),align_params)(multi1, | 780 | 7 | FN(MULTI(BASE),get_space)(multi2)); | 781 | 7 | multi2 = FN(MULTI(BASE),align_params)(multi2, | 782 | 7 | FN(MULTI(BASE),get_space)(multi1)); | 783 | 7 | return fn(multi1, multi2); | 784 | 7 | error: | 785 | 0 | FN(MULTI(BASE),free)(multi1); | 786 | 0 | FN(MULTI(BASE),free)(multi2); | 787 | 0 | return NULL; | 788 | 7 | } |
isl_aff.c:isl_multi_union_pw_aff_align_params_multi_multi_and Line | Count | Source | 763 | 2.69k | { | 764 | 2.69k | isl_ctx *ctx; | 765 | 2.69k | isl_bool equal_params; | 766 | 2.69k | | 767 | 2.69k | if (!multi1 || !multi2) | 768 | 0 | goto error; | 769 | 2.69k | equal_params = isl_space_has_equal_params(multi1->space, multi2->space); | 770 | 2.69k | if (equal_params < 0) | 771 | 0 | goto error; | 772 | 2.69k | if (equal_params) | 773 | 2.66k | return fn(multi1, multi2); | 774 | 29 | ctx = FN(MULTI(BASE),get_ctx)(multi1); | 775 | 29 | if (!isl_space_has_named_params(multi1->space) || | 776 | 29 | !isl_space_has_named_params(multi2->space)) | 777 | 29 | isl_die0 (ctx, isl_error_invalid, | 778 | 29 | "unaligned unnamed parameters", goto error); | 779 | 29 | multi1 = FN(MULTI(BASE),align_params)(multi1, | 780 | 29 | FN(MULTI(BASE),get_space)(multi2)); | 781 | 29 | multi2 = FN(MULTI(BASE),align_params)(multi2, | 782 | 29 | FN(MULTI(BASE),get_space)(multi1)); | 783 | 29 | return fn(multi1, multi2); | 784 | 29 | error: | 785 | 0 | FN(MULTI(BASE),free)(multi1); | 786 | 0 | FN(MULTI(BASE),free)(multi2); | 787 | 0 | return NULL; | 788 | 29 | } |
Unexecuted instantiation: isl_val.c:isl_multi_val_align_params_multi_multi_and |
789 | | |
790 | | /* Given two MULTI(BASE)s A -> B and C -> D, |
791 | | * construct a MULTI(BASE) (A * C) -> [B -> D]. |
792 | | * |
793 | | * The parameters are assumed to have been aligned. |
794 | | * |
795 | | * If "multi1" and/or "multi2" has an explicit domain, then |
796 | | * intersect the domain of the result with these explicit domains. |
797 | | */ |
798 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),range_product_aligned)( |
799 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
800 | 2.96k | { |
801 | 2.96k | int i, n1, n2; |
802 | 2.96k | EL *el; |
803 | 2.96k | isl_space *space; |
804 | 2.96k | MULTI(BASE) *res; |
805 | 2.96k | |
806 | 2.96k | if (!multi1 || !multi2) |
807 | 0 | goto error; |
808 | 2.96k | |
809 | 2.96k | space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1), |
810 | 2.96k | FN(MULTI(BASE),get_space)(multi2)); |
811 | 2.96k | res = FN(MULTI(BASE),alloc)(space); |
812 | 2.96k | |
813 | 2.96k | n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); |
814 | 2.96k | n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); |
815 | 2.96k | |
816 | 6.83k | for (i = 0; i < n1; ++i3.86k ) { |
817 | 3.86k | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); |
818 | 3.86k | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); |
819 | 3.86k | } |
820 | 2.96k | |
821 | 5.21k | for (i = 0; i < n2; ++i2.24k ) { |
822 | 2.24k | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); |
823 | 2.24k | res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el); |
824 | 2.24k | } |
825 | 2.96k | |
826 | 2.96k | if (FN(MULTI(BASE),has_explicit_domain)(multi1)) |
827 | 7 | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1); |
828 | 2.96k | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) |
829 | 1.32k | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2); |
830 | 2.96k | |
831 | 2.96k | FN(MULTI(BASE),free)(multi1); |
832 | 2.96k | FN(MULTI(BASE),free)(multi2); |
833 | 2.96k | return res; |
834 | 2.96k | error: |
835 | 0 | FN(MULTI(BASE),free)(multi1); |
836 | 0 | FN(MULTI(BASE),free)(multi2); |
837 | 0 | return NULL; |
838 | 2.96k | } isl_aff.c:isl_multi_aff_range_product_aligned Line | Count | Source | 800 | 430 | { | 801 | 430 | int i, n1, n2; | 802 | 430 | EL *el; | 803 | 430 | isl_space *space; | 804 | 430 | MULTI(BASE) *res; | 805 | 430 | | 806 | 430 | if (!multi1 || !multi2) | 807 | 0 | goto error; | 808 | 430 | | 809 | 430 | space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1), | 810 | 430 | FN(MULTI(BASE),get_space)(multi2)); | 811 | 430 | res = FN(MULTI(BASE),alloc)(space); | 812 | 430 | | 813 | 430 | n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); | 814 | 430 | n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); | 815 | 430 | | 816 | 1.64k | for (i = 0; i < n1; ++i1.21k ) { | 817 | 1.21k | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); | 818 | 1.21k | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); | 819 | 1.21k | } | 820 | 430 | | 821 | 1.02k | for (i = 0; i < n2; ++i594 ) { | 822 | 594 | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); | 823 | 594 | res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el); | 824 | 594 | } | 825 | 430 | | 826 | 430 | if (FN(MULTI(BASE),has_explicit_domain)(multi1)) | 827 | 0 | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1); | 828 | 430 | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) | 829 | 0 | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2); | 830 | 430 | | 831 | 430 | FN(MULTI(BASE),free)(multi1); | 832 | 430 | FN(MULTI(BASE),free)(multi2); | 833 | 430 | return res; | 834 | 430 | error: | 835 | 0 | FN(MULTI(BASE),free)(multi1); | 836 | 0 | FN(MULTI(BASE),free)(multi2); | 837 | 0 | return NULL; | 838 | 430 | } |
isl_aff.c:isl_multi_pw_aff_range_product_aligned Line | Count | Source | 800 | 15 | { | 801 | 15 | int i, n1, n2; | 802 | 15 | EL *el; | 803 | 15 | isl_space *space; | 804 | 15 | MULTI(BASE) *res; | 805 | 15 | | 806 | 15 | if (!multi1 || !multi2) | 807 | 0 | goto error; | 808 | 15 | | 809 | 15 | space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1), | 810 | 15 | FN(MULTI(BASE),get_space)(multi2)); | 811 | 15 | res = FN(MULTI(BASE),alloc)(space); | 812 | 15 | | 813 | 15 | n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); | 814 | 15 | n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); | 815 | 15 | | 816 | 34 | for (i = 0; i < n1; ++i19 ) { | 817 | 19 | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); | 818 | 19 | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); | 819 | 19 | } | 820 | 15 | | 821 | 34 | for (i = 0; i < n2; ++i19 ) { | 822 | 19 | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); | 823 | 19 | res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el); | 824 | 19 | } | 825 | 15 | | 826 | 15 | if (FN(MULTI(BASE),has_explicit_domain)(multi1)) | 827 | 2 | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1); | 828 | 15 | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) | 829 | 2 | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2); | 830 | 15 | | 831 | 15 | FN(MULTI(BASE),free)(multi1); | 832 | 15 | FN(MULTI(BASE),free)(multi2); | 833 | 15 | return res; | 834 | 15 | error: | 835 | 0 | FN(MULTI(BASE),free)(multi1); | 836 | 0 | FN(MULTI(BASE),free)(multi2); | 837 | 0 | return NULL; | 838 | 15 | } |
isl_aff.c:isl_multi_union_pw_aff_range_product_aligned Line | Count | Source | 800 | 2.52k | { | 801 | 2.52k | int i, n1, n2; | 802 | 2.52k | EL *el; | 803 | 2.52k | isl_space *space; | 804 | 2.52k | MULTI(BASE) *res; | 805 | 2.52k | | 806 | 2.52k | if (!multi1 || !multi2) | 807 | 0 | goto error; | 808 | 2.52k | | 809 | 2.52k | space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1), | 810 | 2.52k | FN(MULTI(BASE),get_space)(multi2)); | 811 | 2.52k | res = FN(MULTI(BASE),alloc)(space); | 812 | 2.52k | | 813 | 2.52k | n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); | 814 | 2.52k | n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); | 815 | 2.52k | | 816 | 5.16k | for (i = 0; i < n1; ++i2.63k ) { | 817 | 2.63k | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); | 818 | 2.63k | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); | 819 | 2.63k | } | 820 | 2.52k | | 821 | 4.15k | for (i = 0; i < n2; ++i1.63k ) { | 822 | 1.63k | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); | 823 | 1.63k | res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el); | 824 | 1.63k | } | 825 | 2.52k | | 826 | 2.52k | if (FN(MULTI(BASE),has_explicit_domain)(multi1)) | 827 | 5 | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1); | 828 | 2.52k | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) | 829 | 1.32k | res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2); | 830 | 2.52k | | 831 | 2.52k | FN(MULTI(BASE),free)(multi1); | 832 | 2.52k | FN(MULTI(BASE),free)(multi2); | 833 | 2.52k | return res; | 834 | 2.52k | error: | 835 | 0 | FN(MULTI(BASE),free)(multi1); | 836 | 0 | FN(MULTI(BASE),free)(multi2); | 837 | 0 | return NULL; | 838 | 2.52k | } |
Unexecuted instantiation: isl_val.c:isl_multi_val_range_product_aligned |
839 | | |
840 | | /* Given two MULTI(BASE)s A -> B and C -> D, |
841 | | * construct a MULTI(BASE) (A * C) -> [B -> D]. |
842 | | */ |
843 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),range_product)( |
844 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
845 | 2.96k | { |
846 | 2.96k | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, |
847 | 2.96k | &FN(MULTI(BASE),range_product_aligned)); |
848 | 2.96k | } isl_multi_aff_range_product Line | Count | Source | 845 | 430 | { | 846 | 430 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 847 | 430 | &FN(MULTI(BASE),range_product_aligned)); | 848 | 430 | } |
isl_multi_pw_aff_range_product Line | Count | Source | 845 | 15 | { | 846 | 15 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 847 | 15 | &FN(MULTI(BASE),range_product_aligned)); | 848 | 15 | } |
isl_multi_union_pw_aff_range_product Line | Count | Source | 845 | 2.52k | { | 846 | 2.52k | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 847 | 2.52k | &FN(MULTI(BASE),range_product_aligned)); | 848 | 2.52k | } |
Unexecuted instantiation: isl_multi_val_range_product |
849 | | |
850 | | /* Is the range of "multi" a wrapped relation? |
851 | | */ |
852 | | isl_bool FN(MULTI(BASE),range_is_wrapping)(__isl_keep MULTI(BASE) *multi) |
853 | 1.01k | { |
854 | 1.01k | if (!multi) |
855 | 0 | return isl_bool_error; |
856 | 1.01k | return isl_space_range_is_wrapping(multi->space); |
857 | 1.01k | } Unexecuted instantiation: isl_multi_aff_range_is_wrapping isl_multi_pw_aff_range_is_wrapping Line | Count | Source | 853 | 1.01k | { | 854 | 1.01k | if (!multi) | 855 | 0 | return isl_bool_error; | 856 | 1.01k | return isl_space_range_is_wrapping(multi->space); | 857 | 1.01k | } |
Unexecuted instantiation: isl_multi_union_pw_aff_range_is_wrapping Unexecuted instantiation: isl_multi_val_range_is_wrapping |
858 | | |
859 | | /* Given a function A -> [B -> C], extract the function A -> B. |
860 | | */ |
861 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),range_factor_domain)( |
862 | | __isl_take MULTI(BASE) *multi) |
863 | 5 | { |
864 | 5 | isl_space *space; |
865 | 5 | int total, keep; |
866 | 5 | |
867 | 5 | if (!multi) |
868 | 0 | return NULL; |
869 | 5 | if (!isl_space_range_is_wrapping(multi->space)) |
870 | 5 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
871 | 5 | "range is not a product", |
872 | 5 | return FN(MULTI(BASE),free)(multi)); |
873 | 5 | |
874 | 5 | space = FN(MULTI(BASE),get_space)(multi); |
875 | 5 | total = isl_space_dim(space, isl_dim_out); |
876 | 5 | space = isl_space_range_factor_domain(space); |
877 | 5 | keep = isl_space_dim(space, isl_dim_out); |
878 | 5 | multi = FN(MULTI(BASE),drop_dims)(multi, |
879 | 5 | isl_dim_out, keep, total - keep); |
880 | 5 | multi = FN(MULTI(BASE),reset_space)(multi, space); |
881 | 5 | |
882 | 5 | return multi; |
883 | 5 | } Unexecuted instantiation: isl_multi_aff_range_factor_domain isl_multi_pw_aff_range_factor_domain Line | Count | Source | 863 | 5 | { | 864 | 5 | isl_space *space; | 865 | 5 | int total, keep; | 866 | 5 | | 867 | 5 | if (!multi) | 868 | 0 | return NULL; | 869 | 5 | if (!isl_space_range_is_wrapping(multi->space)) | 870 | 5 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 871 | 5 | "range is not a product", | 872 | 5 | return FN(MULTI(BASE),free)(multi)); | 873 | 5 | | 874 | 5 | space = FN(MULTI(BASE),get_space)(multi); | 875 | 5 | total = isl_space_dim(space, isl_dim_out); | 876 | 5 | space = isl_space_range_factor_domain(space); | 877 | 5 | keep = isl_space_dim(space, isl_dim_out); | 878 | 5 | multi = FN(MULTI(BASE),drop_dims)(multi, | 879 | 5 | isl_dim_out, keep, total - keep); | 880 | 5 | multi = FN(MULTI(BASE),reset_space)(multi, space); | 881 | 5 | | 882 | 5 | return multi; | 883 | 5 | } |
Unexecuted instantiation: isl_multi_union_pw_aff_range_factor_domain Unexecuted instantiation: isl_multi_val_range_factor_domain |
884 | | |
885 | | /* Given a function A -> [B -> C], extract the function A -> C. |
886 | | */ |
887 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),range_factor_range)( |
888 | | __isl_take MULTI(BASE) *multi) |
889 | 5 | { |
890 | 5 | isl_space *space; |
891 | 5 | int total, keep; |
892 | 5 | |
893 | 5 | if (!multi) |
894 | 0 | return NULL; |
895 | 5 | if (!isl_space_range_is_wrapping(multi->space)) |
896 | 5 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
897 | 5 | "range is not a product", |
898 | 5 | return FN(MULTI(BASE),free)(multi)); |
899 | 5 | |
900 | 5 | space = FN(MULTI(BASE),get_space)(multi); |
901 | 5 | total = isl_space_dim(space, isl_dim_out); |
902 | 5 | space = isl_space_range_factor_range(space); |
903 | 5 | keep = isl_space_dim(space, isl_dim_out); |
904 | 5 | multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep); |
905 | 5 | multi = FN(MULTI(BASE),reset_space)(multi, space); |
906 | 5 | |
907 | 5 | return multi; |
908 | 5 | } Unexecuted instantiation: isl_multi_aff_range_factor_range isl_multi_pw_aff_range_factor_range Line | Count | Source | 889 | 5 | { | 890 | 5 | isl_space *space; | 891 | 5 | int total, keep; | 892 | 5 | | 893 | 5 | if (!multi) | 894 | 0 | return NULL; | 895 | 5 | if (!isl_space_range_is_wrapping(multi->space)) | 896 | 5 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 897 | 5 | "range is not a product", | 898 | 5 | return FN(MULTI(BASE),free)(multi)); | 899 | 5 | | 900 | 5 | space = FN(MULTI(BASE),get_space)(multi); | 901 | 5 | total = isl_space_dim(space, isl_dim_out); | 902 | 5 | space = isl_space_range_factor_range(space); | 903 | 5 | keep = isl_space_dim(space, isl_dim_out); | 904 | 5 | multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep); | 905 | 5 | multi = FN(MULTI(BASE),reset_space)(multi, space); | 906 | 5 | | 907 | 5 | return multi; | 908 | 5 | } |
Unexecuted instantiation: isl_multi_union_pw_aff_range_factor_range Unexecuted instantiation: isl_multi_val_range_factor_range |
909 | | |
910 | | /* Given a function [B -> C], extract the function C. |
911 | | */ |
912 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),factor_range)( |
913 | | __isl_take MULTI(BASE) *multi) |
914 | 9 | { |
915 | 9 | isl_space *space; |
916 | 9 | int total, keep; |
917 | 9 | |
918 | 9 | if (!multi) |
919 | 0 | return NULL; |
920 | 9 | if (!isl_space_is_wrapping(multi->space)) |
921 | 9 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
922 | 9 | "not a product", return FN(MULTI(BASE),free)(multi)); |
923 | 9 | |
924 | 9 | space = FN(MULTI(BASE),get_space)(multi); |
925 | 9 | total = isl_space_dim(space, isl_dim_out); |
926 | 9 | space = isl_space_factor_range(space); |
927 | 9 | keep = isl_space_dim(space, isl_dim_out); |
928 | 9 | multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep); |
929 | 9 | multi = FN(MULTI(BASE),reset_space)(multi, space); |
930 | 9 | |
931 | 9 | return multi; |
932 | 9 | } Unexecuted instantiation: isl_multi_aff_factor_range isl_multi_pw_aff_factor_range Line | Count | Source | 914 | 2 | { | 915 | 2 | isl_space *space; | 916 | 2 | int total, keep; | 917 | 2 | | 918 | 2 | if (!multi) | 919 | 0 | return NULL; | 920 | 2 | if (!isl_space_is_wrapping(multi->space)) | 921 | 2 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 922 | 2 | "not a product", return FN(MULTI(BASE),free)(multi)); | 923 | 2 | | 924 | 2 | space = FN(MULTI(BASE),get_space)(multi); | 925 | 2 | total = isl_space_dim(space, isl_dim_out); | 926 | 2 | space = isl_space_factor_range(space); | 927 | 2 | keep = isl_space_dim(space, isl_dim_out); | 928 | 2 | multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep); | 929 | 2 | multi = FN(MULTI(BASE),reset_space)(multi, space); | 930 | 2 | | 931 | 2 | return multi; | 932 | 2 | } |
isl_multi_union_pw_aff_factor_range Line | Count | Source | 914 | 7 | { | 915 | 7 | isl_space *space; | 916 | 7 | int total, keep; | 917 | 7 | | 918 | 7 | if (!multi) | 919 | 0 | return NULL; | 920 | 7 | if (!isl_space_is_wrapping(multi->space)) | 921 | 7 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, | 922 | 7 | "not a product", return FN(MULTI(BASE),free)(multi)); | 923 | 7 | | 924 | 7 | space = FN(MULTI(BASE),get_space)(multi); | 925 | 7 | total = isl_space_dim(space, isl_dim_out); | 926 | 7 | space = isl_space_factor_range(space); | 927 | 7 | keep = isl_space_dim(space, isl_dim_out); | 928 | 7 | multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep); | 929 | 7 | multi = FN(MULTI(BASE),reset_space)(multi, space); | 930 | 7 | | 931 | 7 | return multi; | 932 | 7 | } |
Unexecuted instantiation: isl_multi_val_factor_range |
933 | | |
934 | | #ifndef NO_PRODUCT |
935 | | /* Given two MULTI(BASE)s A -> B and C -> D, |
936 | | * construct a MULTI(BASE) [A -> C] -> [B -> D]. |
937 | | * |
938 | | * The parameters are assumed to have been aligned. |
939 | | * |
940 | | * If "multi1" and/or "multi2" has an explicit domain, then |
941 | | * intersect the domain of the result with these explicit domains. |
942 | | */ |
943 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),product_aligned)( |
944 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
945 | 2.04k | { |
946 | 2.04k | int i; |
947 | 2.04k | EL *el; |
948 | 2.04k | isl_space *space; |
949 | 2.04k | MULTI(BASE) *res; |
950 | 2.04k | int in1, in2, out1, out2; |
951 | 2.04k | |
952 | 2.04k | in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in); |
953 | 2.04k | in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in); |
954 | 2.04k | out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); |
955 | 2.04k | out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); |
956 | 2.04k | space = isl_space_product(FN(MULTI(BASE),get_space)(multi1), |
957 | 2.04k | FN(MULTI(BASE),get_space)(multi2)); |
958 | 2.04k | res = FN(MULTI(BASE),alloc)(isl_space_copy(space)); |
959 | 2.04k | space = isl_space_domain(space); |
960 | 2.04k | |
961 | 4.23k | for (i = 0; i < out1; ++i2.19k ) { |
962 | 2.19k | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); |
963 | 2.19k | el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2); |
964 | 2.19k | el = FN(EL,reset_domain_space)(el, isl_space_copy(space)); |
965 | 2.19k | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); |
966 | 2.19k | } |
967 | 2.04k | |
968 | 4.82k | for (i = 0; i < out2; ++i2.78k ) { |
969 | 2.78k | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); |
970 | 2.78k | el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1); |
971 | 2.78k | el = FN(EL,reset_domain_space)(el, isl_space_copy(space)); |
972 | 2.78k | res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el); |
973 | 2.78k | } |
974 | 2.04k | |
975 | 2.04k | if (FN(MULTI(BASE),has_explicit_domain)(multi1) || |
976 | 2.04k | FN2.04k (MULTI(BASE),has_explicit_domain)(multi2)2.04k ) |
977 | 6 | res = FN(MULTI(BASE),intersect_explicit_domain_product)(res, |
978 | 6 | multi1, multi2); |
979 | 2.04k | |
980 | 2.04k | isl_space_free(space); |
981 | 2.04k | FN(MULTI(BASE),free)(multi1); |
982 | 2.04k | FN(MULTI(BASE),free)(multi2); |
983 | 2.04k | return res; |
984 | 2.04k | } isl_multi_aff_product_aligned Line | Count | Source | 945 | 2.03k | { | 946 | 2.03k | int i; | 947 | 2.03k | EL *el; | 948 | 2.03k | isl_space *space; | 949 | 2.03k | MULTI(BASE) *res; | 950 | 2.03k | int in1, in2, out1, out2; | 951 | 2.03k | | 952 | 2.03k | in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in); | 953 | 2.03k | in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in); | 954 | 2.03k | out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); | 955 | 2.03k | out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); | 956 | 2.03k | space = isl_space_product(FN(MULTI(BASE),get_space)(multi1), | 957 | 2.03k | FN(MULTI(BASE),get_space)(multi2)); | 958 | 2.03k | res = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 959 | 2.03k | space = isl_space_domain(space); | 960 | 2.03k | | 961 | 4.22k | for (i = 0; i < out1; ++i2.18k ) { | 962 | 2.18k | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); | 963 | 2.18k | el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2); | 964 | 2.18k | el = FN(EL,reset_domain_space)(el, isl_space_copy(space)); | 965 | 2.18k | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); | 966 | 2.18k | } | 967 | 2.03k | | 968 | 4.81k | for (i = 0; i < out2; ++i2.78k ) { | 969 | 2.78k | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); | 970 | 2.78k | el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1); | 971 | 2.78k | el = FN(EL,reset_domain_space)(el, isl_space_copy(space)); | 972 | 2.78k | res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el); | 973 | 2.78k | } | 974 | 2.03k | | 975 | 2.03k | if (FN(MULTI(BASE),has_explicit_domain)(multi1) || | 976 | 2.03k | FN(MULTI(BASE),has_explicit_domain)(multi2)) | 977 | 0 | res = FN(MULTI(BASE),intersect_explicit_domain_product)(res, | 978 | 0 | multi1, multi2); | 979 | 2.03k | | 980 | 2.03k | isl_space_free(space); | 981 | 2.03k | FN(MULTI(BASE),free)(multi1); | 982 | 2.03k | FN(MULTI(BASE),free)(multi2); | 983 | 2.03k | return res; | 984 | 2.03k | } |
isl_multi_pw_aff_product_aligned Line | Count | Source | 945 | 8 | { | 946 | 8 | int i; | 947 | 8 | EL *el; | 948 | 8 | isl_space *space; | 949 | 8 | MULTI(BASE) *res; | 950 | 8 | int in1, in2, out1, out2; | 951 | 8 | | 952 | 8 | in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in); | 953 | 8 | in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in); | 954 | 8 | out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out); | 955 | 8 | out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out); | 956 | 8 | space = isl_space_product(FN(MULTI(BASE),get_space)(multi1), | 957 | 8 | FN(MULTI(BASE),get_space)(multi2)); | 958 | 8 | res = FN(MULTI(BASE),alloc)(isl_space_copy(space)); | 959 | 8 | space = isl_space_domain(space); | 960 | 8 | | 961 | 12 | for (i = 0; i < out1; ++i4 ) { | 962 | 4 | el = FN(FN(MULTI(BASE),get),BASE)(multi1, i); | 963 | 4 | el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2); | 964 | 4 | el = FN(EL,reset_domain_space)(el, isl_space_copy(space)); | 965 | 4 | res = FN(FN(MULTI(BASE),set),BASE)(res, i, el); | 966 | 4 | } | 967 | 8 | | 968 | 12 | for (i = 0; i < out2; ++i4 ) { | 969 | 4 | el = FN(FN(MULTI(BASE),get),BASE)(multi2, i); | 970 | 4 | el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1); | 971 | 4 | el = FN(EL,reset_domain_space)(el, isl_space_copy(space)); | 972 | 4 | res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el); | 973 | 4 | } | 974 | 8 | | 975 | 8 | if (FN(MULTI(BASE),has_explicit_domain)(multi1) || | 976 | 8 | FN4 (MULTI(BASE),has_explicit_domain)(multi2)4 ) | 977 | 6 | res = FN(MULTI(BASE),intersect_explicit_domain_product)(res, | 978 | 6 | multi1, multi2); | 979 | 8 | | 980 | 8 | isl_space_free(space); | 981 | 8 | FN(MULTI(BASE),free)(multi1); | 982 | 8 | FN(MULTI(BASE),free)(multi2); | 983 | 8 | return res; | 984 | 8 | } |
Unexecuted instantiation: isl_multi_val_product_aligned |
985 | | |
986 | | /* Given two MULTI(BASE)s A -> B and C -> D, |
987 | | * construct a MULTI(BASE) [A -> C] -> [B -> D]. |
988 | | */ |
989 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),product)( |
990 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
991 | 2.04k | { |
992 | 2.04k | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, |
993 | 2.04k | &FN(MULTI(BASE),product_aligned)); |
994 | 2.04k | } Line | Count | Source | 991 | 2.03k | { | 992 | 2.03k | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 993 | 2.03k | &FN(MULTI(BASE),product_aligned)); | 994 | 2.03k | } |
Line | Count | Source | 991 | 8 | { | 992 | 8 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 993 | 8 | &FN(MULTI(BASE),product_aligned)); | 994 | 8 | } |
Unexecuted instantiation: isl_multi_val_product |
995 | | #endif |
996 | | |
997 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),flatten_range)( |
998 | | __isl_take MULTI(BASE) *multi) |
999 | 3.33k | { |
1000 | 3.33k | if (!multi) |
1001 | 0 | return NULL; |
1002 | 3.33k | |
1003 | 3.33k | if (!multi->space->nested[1]) |
1004 | 0 | return multi; |
1005 | 3.33k | |
1006 | 3.33k | multi = FN(MULTI(BASE),cow)(multi); |
1007 | 3.33k | if (!multi) |
1008 | 0 | return NULL; |
1009 | 3.33k | |
1010 | 3.33k | multi->space = isl_space_flatten_range(multi->space); |
1011 | 3.33k | if (!multi->space) |
1012 | 0 | return FN(MULTI(BASE),free)(multi); |
1013 | 3.33k | |
1014 | 3.33k | return multi; |
1015 | 3.33k | } isl_multi_aff_flatten_range Line | Count | Source | 999 | 816 | { | 1000 | 816 | if (!multi) | 1001 | 0 | return NULL; | 1002 | 816 | | 1003 | 816 | if (!multi->space->nested[1]) | 1004 | 0 | return multi; | 1005 | 816 | | 1006 | 816 | multi = FN(MULTI(BASE),cow)(multi); | 1007 | 816 | if (!multi) | 1008 | 0 | return NULL; | 1009 | 816 | | 1010 | 816 | multi->space = isl_space_flatten_range(multi->space); | 1011 | 816 | if (!multi->space) | 1012 | 0 | return FN(MULTI(BASE),free)(multi); | 1013 | 816 | | 1014 | 816 | return multi; | 1015 | 816 | } |
isl_multi_pw_aff_flatten_range Line | Count | Source | 999 | 1 | { | 1000 | 1 | if (!multi) | 1001 | 0 | return NULL; | 1002 | 1 | | 1003 | 1 | if (!multi->space->nested[1]) | 1004 | 0 | return multi; | 1005 | 1 | | 1006 | 1 | multi = FN(MULTI(BASE),cow)(multi); | 1007 | 1 | if (!multi) | 1008 | 0 | return NULL; | 1009 | 1 | | 1010 | 1 | multi->space = isl_space_flatten_range(multi->space); | 1011 | 1 | if (!multi->space) | 1012 | 0 | return FN(MULTI(BASE),free)(multi); | 1013 | 1 | | 1014 | 1 | return multi; | 1015 | 1 | } |
isl_multi_union_pw_aff_flatten_range Line | Count | Source | 999 | 2.51k | { | 1000 | 2.51k | if (!multi) | 1001 | 0 | return NULL; | 1002 | 2.51k | | 1003 | 2.51k | if (!multi->space->nested[1]) | 1004 | 0 | return multi; | 1005 | 2.51k | | 1006 | 2.51k | multi = FN(MULTI(BASE),cow)(multi); | 1007 | 2.51k | if (!multi) | 1008 | 0 | return NULL; | 1009 | 2.51k | | 1010 | 2.51k | multi->space = isl_space_flatten_range(multi->space); | 1011 | 2.51k | if (!multi->space) | 1012 | 0 | return FN(MULTI(BASE),free)(multi); | 1013 | 2.51k | | 1014 | 2.51k | return multi; | 1015 | 2.51k | } |
Unexecuted instantiation: isl_multi_val_flatten_range |
1016 | | |
1017 | | /* Given two MULTI(BASE)s A -> B and C -> D, |
1018 | | * construct a MULTI(BASE) (A * C) -> (B, D). |
1019 | | */ |
1020 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),flat_range_product)( |
1021 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
1022 | 2.65k | { |
1023 | 2.65k | MULTI(BASE) *multi; |
1024 | 2.65k | |
1025 | 2.65k | multi = FN(MULTI(BASE),range_product)(multi1, multi2); |
1026 | 2.65k | multi = FN(MULTI(BASE),flatten_range)(multi); |
1027 | 2.65k | return multi; |
1028 | 2.65k | } isl_multi_aff_flat_range_product Line | Count | Source | 1022 | 138 | { | 1023 | 138 | MULTI(BASE) *multi; | 1024 | 138 | | 1025 | 138 | multi = FN(MULTI(BASE),range_product)(multi1, multi2); | 1026 | 138 | multi = FN(MULTI(BASE),flatten_range)(multi); | 1027 | 138 | return multi; | 1028 | 138 | } |
isl_multi_pw_aff_flat_range_product Line | Count | Source | 1022 | 1 | { | 1023 | 1 | MULTI(BASE) *multi; | 1024 | 1 | | 1025 | 1 | multi = FN(MULTI(BASE),range_product)(multi1, multi2); | 1026 | 1 | multi = FN(MULTI(BASE),flatten_range)(multi); | 1027 | 1 | return multi; | 1028 | 1 | } |
isl_multi_union_pw_aff_flat_range_product Line | Count | Source | 1022 | 2.51k | { | 1023 | 2.51k | MULTI(BASE) *multi; | 1024 | 2.51k | | 1025 | 2.51k | multi = FN(MULTI(BASE),range_product)(multi1, multi2); | 1026 | 2.51k | multi = FN(MULTI(BASE),flatten_range)(multi); | 1027 | 2.51k | return multi; | 1028 | 2.51k | } |
Unexecuted instantiation: isl_multi_val_flat_range_product |
1029 | | |
1030 | | /* Given two multi expressions, "multi1" |
1031 | | * |
1032 | | * [A] -> [B1 B2] |
1033 | | * |
1034 | | * where B2 starts at position "pos", and "multi2" |
1035 | | * |
1036 | | * [A] -> [D] |
1037 | | * |
1038 | | * return the multi expression |
1039 | | * |
1040 | | * [A] -> [B1 D B2] |
1041 | | */ |
1042 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),range_splice)( |
1043 | | __isl_take MULTI(BASE) *multi1, unsigned pos, |
1044 | | __isl_take MULTI(BASE) *multi2) |
1045 | 9 | { |
1046 | 9 | MULTI(BASE) *res; |
1047 | 9 | unsigned dim; |
1048 | 9 | |
1049 | 9 | if (!multi1 || !multi2) |
1050 | 0 | goto error; |
1051 | 9 | |
1052 | 9 | dim = FN(MULTI(BASE),dim)(multi1, isl_dim_out); |
1053 | 9 | if (pos > dim) |
1054 | 9 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, |
1055 | 9 | "index out of bounds", goto error); |
1056 | 9 | |
1057 | 9 | res = FN(MULTI(BASE),copy)(multi1); |
1058 | 9 | res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos); |
1059 | 9 | multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos); |
1060 | 9 | |
1061 | 9 | res = FN(MULTI(BASE),flat_range_product)(res, multi2); |
1062 | 9 | res = FN(MULTI(BASE),flat_range_product)(res, multi1); |
1063 | 9 | |
1064 | 9 | return res; |
1065 | 9 | error: |
1066 | 0 | FN(MULTI(BASE),free)(multi1); |
1067 | 0 | FN(MULTI(BASE),free)(multi2); |
1068 | 0 | return NULL; |
1069 | 9 | } isl_multi_aff_range_splice Line | Count | Source | 1045 | 9 | { | 1046 | 9 | MULTI(BASE) *res; | 1047 | 9 | unsigned dim; | 1048 | 9 | | 1049 | 9 | if (!multi1 || !multi2) | 1050 | 0 | goto error; | 1051 | 9 | | 1052 | 9 | dim = FN(MULTI(BASE),dim)(multi1, isl_dim_out); | 1053 | 9 | if (pos > dim) | 1054 | 9 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, | 1055 | 9 | "index out of bounds", goto error); | 1056 | 9 | | 1057 | 9 | res = FN(MULTI(BASE),copy)(multi1); | 1058 | 9 | res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos); | 1059 | 9 | multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos); | 1060 | 9 | | 1061 | 9 | res = FN(MULTI(BASE),flat_range_product)(res, multi2); | 1062 | 9 | res = FN(MULTI(BASE),flat_range_product)(res, multi1); | 1063 | 9 | | 1064 | 9 | return res; | 1065 | 9 | error: | 1066 | 0 | FN(MULTI(BASE),free)(multi1); | 1067 | 0 | FN(MULTI(BASE),free)(multi2); | 1068 | 0 | return NULL; | 1069 | 9 | } |
Unexecuted instantiation: isl_multi_pw_aff_range_splice Unexecuted instantiation: isl_multi_union_pw_aff_range_splice Unexecuted instantiation: isl_multi_val_range_splice |
1070 | | |
1071 | | #ifndef NO_SPLICE |
1072 | | /* Given two multi expressions, "multi1" |
1073 | | * |
1074 | | * [A1 A2] -> [B1 B2] |
1075 | | * |
1076 | | * where A2 starts at position "in_pos" and B2 starts at position "out_pos", |
1077 | | * and "multi2" |
1078 | | * |
1079 | | * [C] -> [D] |
1080 | | * |
1081 | | * return the multi expression |
1082 | | * |
1083 | | * [A1 C A2] -> [B1 D B2] |
1084 | | * |
1085 | | * We first insert input dimensions to obtain |
1086 | | * |
1087 | | * [A1 C A2] -> [B1 B2] |
1088 | | * |
1089 | | * and |
1090 | | * |
1091 | | * [A1 C A2] -> [D] |
1092 | | * |
1093 | | * and then apply range_splice. |
1094 | | */ |
1095 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),splice)( |
1096 | | __isl_take MULTI(BASE) *multi1, unsigned in_pos, unsigned out_pos, |
1097 | | __isl_take MULTI(BASE) *multi2) |
1098 | 6 | { |
1099 | 6 | unsigned n_in1; |
1100 | 6 | unsigned n_in2; |
1101 | 6 | |
1102 | 6 | if (!multi1 || !multi2) |
1103 | 0 | goto error; |
1104 | 6 | |
1105 | 6 | n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in); |
1106 | 6 | if (in_pos > n_in1) |
1107 | 6 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, |
1108 | 6 | "index out of bounds", goto error); |
1109 | 6 | |
1110 | 6 | n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in); |
1111 | 6 | |
1112 | 6 | multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2); |
1113 | 6 | multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2, |
1114 | 6 | n_in1 - in_pos); |
1115 | 6 | multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos); |
1116 | 6 | |
1117 | 6 | return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2); |
1118 | 6 | error: |
1119 | 0 | FN(MULTI(BASE),free)(multi1); |
1120 | 0 | FN(MULTI(BASE),free)(multi2); |
1121 | 0 | return NULL; |
1122 | 6 | } Line | Count | Source | 1098 | 6 | { | 1099 | 6 | unsigned n_in1; | 1100 | 6 | unsigned n_in2; | 1101 | 6 | | 1102 | 6 | if (!multi1 || !multi2) | 1103 | 0 | goto error; | 1104 | 6 | | 1105 | 6 | n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in); | 1106 | 6 | if (in_pos > n_in1) | 1107 | 6 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, | 1108 | 6 | "index out of bounds", goto error); | 1109 | 6 | | 1110 | 6 | n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in); | 1111 | 6 | | 1112 | 6 | multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2); | 1113 | 6 | multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2, | 1114 | 6 | n_in1 - in_pos); | 1115 | 6 | multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos); | 1116 | 6 | | 1117 | 6 | return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2); | 1118 | 6 | error: | 1119 | 0 | FN(MULTI(BASE),free)(multi1); | 1120 | 0 | FN(MULTI(BASE),free)(multi2); | 1121 | 0 | return NULL; | 1122 | 6 | } |
Unexecuted instantiation: isl_multi_pw_aff_splice Unexecuted instantiation: isl_multi_val_splice |
1123 | | #endif |
1124 | | |
1125 | | /* Check that "multi1" and "multi2" live in the same space, |
1126 | | * reporting an error if they do not. |
1127 | | */ |
1128 | | static isl_stat FN(MULTI(BASE),check_equal_space)( |
1129 | | __isl_keep MULTI(BASE) *multi1, __isl_keep MULTI(BASE) *multi2) |
1130 | 259 | { |
1131 | 259 | isl_bool equal; |
1132 | 259 | |
1133 | 259 | if (!multi1 || !multi2) |
1134 | 0 | return isl_stat_error; |
1135 | 259 | |
1136 | 259 | equal = isl_space_is_equal(multi1->space, multi2->space); |
1137 | 259 | if (equal < 0) |
1138 | 0 | return isl_stat_error; |
1139 | 259 | if (!equal) |
1140 | 259 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, |
1141 | 259 | "spaces don't match", return isl_stat_error); |
1142 | 259 | |
1143 | 259 | return isl_stat_ok; |
1144 | 259 | } isl_aff.c:isl_multi_aff_check_equal_space Line | Count | Source | 1130 | 3 | { | 1131 | 3 | isl_bool equal; | 1132 | 3 | | 1133 | 3 | if (!multi1 || !multi2) | 1134 | 0 | return isl_stat_error; | 1135 | 3 | | 1136 | 3 | equal = isl_space_is_equal(multi1->space, multi2->space); | 1137 | 3 | if (equal < 0) | 1138 | 0 | return isl_stat_error; | 1139 | 3 | if (!equal) | 1140 | 3 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, | 1141 | 3 | "spaces don't match", return isl_stat_error); | 1142 | 3 | | 1143 | 3 | return isl_stat_ok; | 1144 | 3 | } |
isl_aff.c:isl_multi_pw_aff_check_equal_space Line | Count | Source | 1130 | 5 | { | 1131 | 5 | isl_bool equal; | 1132 | 5 | | 1133 | 5 | if (!multi1 || !multi2) | 1134 | 0 | return isl_stat_error; | 1135 | 5 | | 1136 | 5 | equal = isl_space_is_equal(multi1->space, multi2->space); | 1137 | 5 | if (equal < 0) | 1138 | 0 | return isl_stat_error; | 1139 | 5 | if (!equal) | 1140 | 5 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, | 1141 | 5 | "spaces don't match", return isl_stat_error); | 1142 | 5 | | 1143 | 5 | return isl_stat_ok; | 1144 | 5 | } |
isl_aff.c:isl_multi_union_pw_aff_check_equal_space Line | Count | Source | 1130 | 251 | { | 1131 | 251 | isl_bool equal; | 1132 | 251 | | 1133 | 251 | if (!multi1 || !multi2) | 1134 | 0 | return isl_stat_error; | 1135 | 251 | | 1136 | 251 | equal = isl_space_is_equal(multi1->space, multi2->space); | 1137 | 251 | if (equal < 0) | 1138 | 0 | return isl_stat_error; | 1139 | 251 | if (!equal) | 1140 | 251 | isl_die0 (FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid, | 1141 | 251 | "spaces don't match", return isl_stat_error); | 1142 | 251 | | 1143 | 251 | return isl_stat_ok; | 1144 | 251 | } |
Unexecuted instantiation: isl_val.c:isl_multi_val_check_equal_space |
1145 | | |
1146 | | /* This function is currently only used from isl_aff.c |
1147 | | */ |
1148 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),bin_op)( |
1149 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2, |
1150 | | __isl_give EL *(*fn)(__isl_take EL *, __isl_take EL *)) |
1151 | | __attribute__ ((unused)); |
1152 | | |
1153 | | /* Pairwise perform "fn" to the elements of "multi1" and "multi2" and |
1154 | | * return the result. |
1155 | | * |
1156 | | * If "multi2" has an explicit domain, then |
1157 | | * intersect the domain of the result with this explicit domain. |
1158 | | */ |
1159 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),bin_op)( |
1160 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2, |
1161 | | __isl_give EL *(*fn)(__isl_take EL *, __isl_take EL *)) |
1162 | 173 | { |
1163 | 173 | int i; |
1164 | 173 | |
1165 | 173 | multi1 = FN(MULTI(BASE),cow)(multi1); |
1166 | 173 | if (FN(MULTI(BASE),check_equal_space)(multi1, multi2) < 0) |
1167 | 0 | goto error; |
1168 | 173 | |
1169 | 458 | for (i = 0; 173 i < multi1->n; ++i285 ) { |
1170 | 285 | multi1->u.p[i] = fn(multi1->u.p[i], |
1171 | 285 | FN(EL,copy)(multi2->u.p[i])); |
1172 | 285 | if (!multi1->u.p[i]) |
1173 | 0 | goto error; |
1174 | 285 | } |
1175 | 173 | |
1176 | 173 | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) |
1177 | 6 | multi1 = FN(MULTI(BASE),intersect_explicit_domain)(multi1, |
1178 | 6 | multi2); |
1179 | 173 | |
1180 | 173 | FN(MULTI(BASE),free)(multi2); |
1181 | 173 | return multi1; |
1182 | 173 | error: |
1183 | 0 | FN(MULTI(BASE),free)(multi1); |
1184 | 0 | FN(MULTI(BASE),free)(multi2); |
1185 | 0 | return NULL; |
1186 | 173 | } isl_aff.c:isl_multi_aff_bin_op Line | Count | Source | 1162 | 3 | { | 1163 | 3 | int i; | 1164 | 3 | | 1165 | 3 | multi1 = FN(MULTI(BASE),cow)(multi1); | 1166 | 3 | if (FN(MULTI(BASE),check_equal_space)(multi1, multi2) < 0) | 1167 | 0 | goto error; | 1168 | 3 | | 1169 | 6 | for (i = 0; 3 i < multi1->n; ++i3 ) { | 1170 | 3 | multi1->u.p[i] = fn(multi1->u.p[i], | 1171 | 3 | FN(EL,copy)(multi2->u.p[i])); | 1172 | 3 | if (!multi1->u.p[i]) | 1173 | 0 | goto error; | 1174 | 3 | } | 1175 | 3 | | 1176 | 3 | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) | 1177 | 0 | multi1 = FN(MULTI(BASE),intersect_explicit_domain)(multi1, | 1178 | 0 | multi2); | 1179 | 3 | | 1180 | 3 | FN(MULTI(BASE),free)(multi2); | 1181 | 3 | return multi1; | 1182 | 3 | error: | 1183 | 0 | FN(MULTI(BASE),free)(multi1); | 1184 | 0 | FN(MULTI(BASE),free)(multi2); | 1185 | 0 | return NULL; | 1186 | 3 | } |
isl_aff.c:isl_multi_pw_aff_bin_op Line | Count | Source | 1162 | 5 | { | 1163 | 5 | int i; | 1164 | 5 | | 1165 | 5 | multi1 = FN(MULTI(BASE),cow)(multi1); | 1166 | 5 | if (FN(MULTI(BASE),check_equal_space)(multi1, multi2) < 0) | 1167 | 0 | goto error; | 1168 | 5 | | 1169 | 7 | for (i = 0; 5 i < multi1->n; ++i2 ) { | 1170 | 2 | multi1->u.p[i] = fn(multi1->u.p[i], | 1171 | 2 | FN(EL,copy)(multi2->u.p[i])); | 1172 | 2 | if (!multi1->u.p[i]) | 1173 | 0 | goto error; | 1174 | 2 | } | 1175 | 5 | | 1176 | 5 | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) | 1177 | 3 | multi1 = FN(MULTI(BASE),intersect_explicit_domain)(multi1, | 1178 | 3 | multi2); | 1179 | 5 | | 1180 | 5 | FN(MULTI(BASE),free)(multi2); | 1181 | 5 | return multi1; | 1182 | 5 | error: | 1183 | 0 | FN(MULTI(BASE),free)(multi1); | 1184 | 0 | FN(MULTI(BASE),free)(multi2); | 1185 | 0 | return NULL; | 1186 | 5 | } |
isl_aff.c:isl_multi_union_pw_aff_bin_op Line | Count | Source | 1162 | 165 | { | 1163 | 165 | int i; | 1164 | 165 | | 1165 | 165 | multi1 = FN(MULTI(BASE),cow)(multi1); | 1166 | 165 | if (FN(MULTI(BASE),check_equal_space)(multi1, multi2) < 0) | 1167 | 0 | goto error; | 1168 | 165 | | 1169 | 445 | for (i = 0; 165 i < multi1->n; ++i280 ) { | 1170 | 280 | multi1->u.p[i] = fn(multi1->u.p[i], | 1171 | 280 | FN(EL,copy)(multi2->u.p[i])); | 1172 | 280 | if (!multi1->u.p[i]) | 1173 | 0 | goto error; | 1174 | 280 | } | 1175 | 165 | | 1176 | 165 | if (FN(MULTI(BASE),has_explicit_domain)(multi2)) | 1177 | 3 | multi1 = FN(MULTI(BASE),intersect_explicit_domain)(multi1, | 1178 | 3 | multi2); | 1179 | 165 | | 1180 | 165 | FN(MULTI(BASE),free)(multi2); | 1181 | 165 | return multi1; | 1182 | 165 | error: | 1183 | 0 | FN(MULTI(BASE),free)(multi1); | 1184 | 0 | FN(MULTI(BASE),free)(multi2); | 1185 | 0 | return NULL; | 1186 | 165 | } |
Unexecuted instantiation: isl_val.c:isl_multi_val_bin_op |
1187 | | |
1188 | | /* Add "multi2" from "multi1" and return the result. |
1189 | | * |
1190 | | * The parameters of "multi1" and "multi2" are assumed to have been aligned. |
1191 | | */ |
1192 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),add_aligned)( |
1193 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
1194 | 14 | { |
1195 | 14 | return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,add)); |
1196 | 14 | } isl_aff.c:isl_multi_aff_add_aligned Line | Count | Source | 1194 | 3 | { | 1195 | 3 | return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,add)); | 1196 | 3 | } |
isl_aff.c:isl_multi_pw_aff_add_aligned Line | Count | Source | 1194 | 5 | { | 1195 | 5 | return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,add)); | 1196 | 5 | } |
isl_aff.c:isl_multi_union_pw_aff_add_aligned Line | Count | Source | 1194 | 6 | { | 1195 | 6 | return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,add)); | 1196 | 6 | } |
Unexecuted instantiation: isl_val.c:isl_multi_val_add_aligned |
1197 | | |
1198 | | /* Add "multi2" from "multi1" and return the result. |
1199 | | */ |
1200 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),add)(__isl_take MULTI(BASE) *multi1, |
1201 | | __isl_take MULTI(BASE) *multi2) |
1202 | 14 | { |
1203 | 14 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, |
1204 | 14 | &FN(MULTI(BASE),add_aligned)); |
1205 | 14 | } Line | Count | Source | 1202 | 3 | { | 1203 | 3 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 1204 | 3 | &FN(MULTI(BASE),add_aligned)); | 1205 | 3 | } |
Line | Count | Source | 1202 | 5 | { | 1203 | 5 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 1204 | 5 | &FN(MULTI(BASE),add_aligned)); | 1205 | 5 | } |
isl_multi_union_pw_aff_add Line | Count | Source | 1202 | 6 | { | 1203 | 6 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 1204 | 6 | &FN(MULTI(BASE),add_aligned)); | 1205 | 6 | } |
Unexecuted instantiation: isl_multi_val_add |
1206 | | |
1207 | | /* Subtract "multi2" from "multi1" and return the result. |
1208 | | * |
1209 | | * The parameters of "multi1" and "multi2" are assumed to have been aligned. |
1210 | | */ |
1211 | | static __isl_give MULTI(BASE) *FN(MULTI(BASE),sub_aligned)( |
1212 | | __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2) |
1213 | 79 | { |
1214 | 79 | return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,sub)); |
1215 | 79 | } Unexecuted instantiation: isl_aff.c:isl_multi_aff_sub_aligned Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_sub_aligned isl_aff.c:isl_multi_union_pw_aff_sub_aligned Line | Count | Source | 1213 | 79 | { | 1214 | 79 | return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,sub)); | 1215 | 79 | } |
Unexecuted instantiation: isl_val.c:isl_multi_val_sub_aligned |
1216 | | |
1217 | | /* Subtract "multi2" from "multi1" and return the result. |
1218 | | */ |
1219 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),sub)(__isl_take MULTI(BASE) *multi1, |
1220 | | __isl_take MULTI(BASE) *multi2) |
1221 | 79 | { |
1222 | 79 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, |
1223 | 79 | &FN(MULTI(BASE),sub_aligned)); |
1224 | 79 | } Unexecuted instantiation: isl_multi_aff_sub Unexecuted instantiation: isl_multi_pw_aff_sub isl_multi_union_pw_aff_sub Line | Count | Source | 1221 | 79 | { | 1222 | 79 | return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2, | 1223 | 79 | &FN(MULTI(BASE),sub_aligned)); | 1224 | 79 | } |
Unexecuted instantiation: isl_multi_val_sub |
1225 | | |
1226 | | /* Multiply the elements of "multi" by "v" and return the result. |
1227 | | */ |
1228 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),scale_val)(__isl_take MULTI(BASE) *multi, |
1229 | | __isl_take isl_val *v) |
1230 | 0 | { |
1231 | 0 | int i; |
1232 | 0 |
|
1233 | 0 | if (!multi || !v) |
1234 | 0 | goto error; |
1235 | 0 | |
1236 | 0 | if (isl_val_is_one(v)) { |
1237 | 0 | isl_val_free(v); |
1238 | 0 | return multi; |
1239 | 0 | } |
1240 | 0 | |
1241 | 0 | if (!isl_val_is_rat(v)) |
1242 | 0 | isl_die(isl_val_get_ctx(v), isl_error_invalid, |
1243 | 0 | "expecting rational factor", goto error); |
1244 | 0 |
|
1245 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
1246 | 0 | if (!multi) |
1247 | 0 | return NULL; |
1248 | 0 | |
1249 | 0 | for (i = 0; i < multi->n; ++i) { |
1250 | 0 | multi->u.p[i] = FN(EL,scale_val)(multi->u.p[i], |
1251 | 0 | isl_val_copy(v)); |
1252 | 0 | if (!multi->u.p[i]) |
1253 | 0 | goto error; |
1254 | 0 | } |
1255 | 0 |
|
1256 | 0 | isl_val_free(v); |
1257 | 0 | return multi; |
1258 | 0 | error: |
1259 | 0 | isl_val_free(v); |
1260 | 0 | return FN(MULTI(BASE),free)(multi); |
1261 | 0 | } Unexecuted instantiation: isl_multi_aff_scale_val Unexecuted instantiation: isl_multi_pw_aff_scale_val Unexecuted instantiation: isl_multi_union_pw_aff_scale_val Unexecuted instantiation: isl_multi_val_scale_val |
1262 | | |
1263 | | /* Divide the elements of "multi" by "v" and return the result. |
1264 | | */ |
1265 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),scale_down_val)( |
1266 | | __isl_take MULTI(BASE) *multi, __isl_take isl_val *v) |
1267 | 0 | { |
1268 | 0 | int i; |
1269 | 0 |
|
1270 | 0 | if (!multi || !v) |
1271 | 0 | goto error; |
1272 | 0 | |
1273 | 0 | if (isl_val_is_one(v)) { |
1274 | 0 | isl_val_free(v); |
1275 | 0 | return multi; |
1276 | 0 | } |
1277 | 0 | |
1278 | 0 | if (!isl_val_is_rat(v)) |
1279 | 0 | isl_die(isl_val_get_ctx(v), isl_error_invalid, |
1280 | 0 | "expecting rational factor", goto error); |
1281 | 0 | if (isl_val_is_zero(v)) |
1282 | 0 | isl_die(isl_val_get_ctx(v), isl_error_invalid, |
1283 | 0 | "cannot scale down by zero", goto error); |
1284 | 0 |
|
1285 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
1286 | 0 | if (!multi) |
1287 | 0 | return NULL; |
1288 | 0 | |
1289 | 0 | for (i = 0; i < multi->n; ++i) { |
1290 | 0 | multi->u.p[i] = FN(EL,scale_down_val)(multi->u.p[i], |
1291 | 0 | isl_val_copy(v)); |
1292 | 0 | if (!multi->u.p[i]) |
1293 | 0 | goto error; |
1294 | 0 | } |
1295 | 0 |
|
1296 | 0 | isl_val_free(v); |
1297 | 0 | return multi; |
1298 | 0 | error: |
1299 | 0 | isl_val_free(v); |
1300 | 0 | return FN(MULTI(BASE),free)(multi); |
1301 | 0 | } Unexecuted instantiation: isl_multi_aff_scale_down_val Unexecuted instantiation: isl_multi_pw_aff_scale_down_val Unexecuted instantiation: isl_multi_union_pw_aff_scale_down_val Unexecuted instantiation: isl_multi_val_scale_down_val |
1302 | | |
1303 | | /* Multiply the elements of "multi" by the corresponding element of "mv" |
1304 | | * and return the result. |
1305 | | */ |
1306 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),scale_multi_val)( |
1307 | | __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv) |
1308 | 77 | { |
1309 | 77 | int i; |
1310 | 77 | |
1311 | 77 | if (!multi || !mv) |
1312 | 0 | goto error; |
1313 | 77 | |
1314 | 77 | if (!isl_space_tuple_is_equal(multi->space, isl_dim_out, |
1315 | 77 | mv->space, isl_dim_set)) |
1316 | 77 | isl_die0 (isl_multi_val_get_ctx(mv), isl_error_invalid, |
1317 | 77 | "spaces don't match", goto error); |
1318 | 77 | |
1319 | 77 | multi = FN(MULTI(BASE),cow)(multi); |
1320 | 77 | if (!multi) |
1321 | 0 | goto error; |
1322 | 77 | |
1323 | 247 | for (i = 0; 77 i < multi->n; ++i170 ) { |
1324 | 170 | isl_val *v; |
1325 | 170 | |
1326 | 170 | v = isl_multi_val_get_val(mv, i); |
1327 | 170 | multi->u.p[i] = FN(EL,scale_val)(multi->u.p[i], v); |
1328 | 170 | if (!multi->u.p[i]) |
1329 | 0 | goto error; |
1330 | 170 | } |
1331 | 77 | |
1332 | 77 | isl_multi_val_free(mv); |
1333 | 77 | return multi; |
1334 | 77 | error: |
1335 | 0 | isl_multi_val_free(mv); |
1336 | 0 | return FN(MULTI(BASE),free)(multi); |
1337 | 77 | } Unexecuted instantiation: isl_multi_aff_scale_multi_val Unexecuted instantiation: isl_multi_pw_aff_scale_multi_val isl_multi_union_pw_aff_scale_multi_val Line | Count | Source | 1308 | 77 | { | 1309 | 77 | int i; | 1310 | 77 | | 1311 | 77 | if (!multi || !mv) | 1312 | 0 | goto error; | 1313 | 77 | | 1314 | 77 | if (!isl_space_tuple_is_equal(multi->space, isl_dim_out, | 1315 | 77 | mv->space, isl_dim_set)) | 1316 | 77 | isl_die0 (isl_multi_val_get_ctx(mv), isl_error_invalid, | 1317 | 77 | "spaces don't match", goto error); | 1318 | 77 | | 1319 | 77 | multi = FN(MULTI(BASE),cow)(multi); | 1320 | 77 | if (!multi) | 1321 | 0 | goto error; | 1322 | 77 | | 1323 | 247 | for (i = 0; 77 i < multi->n; ++i170 ) { | 1324 | 170 | isl_val *v; | 1325 | 170 | | 1326 | 170 | v = isl_multi_val_get_val(mv, i); | 1327 | 170 | multi->u.p[i] = FN(EL,scale_val)(multi->u.p[i], v); | 1328 | 170 | if (!multi->u.p[i]) | 1329 | 0 | goto error; | 1330 | 170 | } | 1331 | 77 | | 1332 | 77 | isl_multi_val_free(mv); | 1333 | 77 | return multi; | 1334 | 77 | error: | 1335 | 0 | isl_multi_val_free(mv); | 1336 | 0 | return FN(MULTI(BASE),free)(multi); | 1337 | 77 | } |
Unexecuted instantiation: isl_multi_val_scale_multi_val |
1338 | | |
1339 | | /* Divide the elements of "multi" by the corresponding element of "mv" |
1340 | | * and return the result. |
1341 | | */ |
1342 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),scale_down_multi_val)( |
1343 | | __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv) |
1344 | 0 | { |
1345 | 0 | int i; |
1346 | 0 |
|
1347 | 0 | if (!multi || !mv) |
1348 | 0 | goto error; |
1349 | 0 | |
1350 | 0 | if (!isl_space_tuple_is_equal(multi->space, isl_dim_out, |
1351 | 0 | mv->space, isl_dim_set)) |
1352 | 0 | isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid, |
1353 | 0 | "spaces don't match", goto error); |
1354 | 0 |
|
1355 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
1356 | 0 | if (!multi) |
1357 | 0 | return NULL; |
1358 | 0 | |
1359 | 0 | for (i = 0; i < multi->n; ++i) { |
1360 | 0 | isl_val *v; |
1361 | 0 |
|
1362 | 0 | v = isl_multi_val_get_val(mv, i); |
1363 | 0 | multi->u.p[i] = FN(EL,scale_down_val)(multi->u.p[i], v); |
1364 | 0 | if (!multi->u.p[i]) |
1365 | 0 | goto error; |
1366 | 0 | } |
1367 | 0 |
|
1368 | 0 | isl_multi_val_free(mv); |
1369 | 0 | return multi; |
1370 | 0 | error: |
1371 | 0 | isl_multi_val_free(mv); |
1372 | 0 | return FN(MULTI(BASE),free)(multi); |
1373 | 0 | } Unexecuted instantiation: isl_multi_aff_scale_down_multi_val Unexecuted instantiation: isl_multi_pw_aff_scale_down_multi_val Unexecuted instantiation: isl_multi_union_pw_aff_scale_down_multi_val Unexecuted instantiation: isl_multi_val_scale_down_multi_val |
1374 | | |
1375 | | /* Compute the residues of the elements of "multi" modulo |
1376 | | * the corresponding element of "mv" and return the result. |
1377 | | */ |
1378 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),mod_multi_val)( |
1379 | | __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv) |
1380 | 0 | { |
1381 | 0 | int i; |
1382 | 0 |
|
1383 | 0 | if (!multi || !mv) |
1384 | 0 | goto error; |
1385 | 0 | |
1386 | 0 | if (!isl_space_tuple_is_equal(multi->space, isl_dim_out, |
1387 | 0 | mv->space, isl_dim_set)) |
1388 | 0 | isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid, |
1389 | 0 | "spaces don't match", goto error); |
1390 | 0 |
|
1391 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
1392 | 0 | if (!multi) |
1393 | 0 | goto error; |
1394 | 0 | |
1395 | 0 | for (i = 0; i < multi->n; ++i) { |
1396 | 0 | isl_val *v; |
1397 | 0 |
|
1398 | 0 | v = isl_multi_val_get_val(mv, i); |
1399 | 0 | multi->u.p[i] = FN(EL,mod_val)(multi->u.p[i], v); |
1400 | 0 | if (!multi->u.p[i]) |
1401 | 0 | goto error; |
1402 | 0 | } |
1403 | 0 |
|
1404 | 0 | isl_multi_val_free(mv); |
1405 | 0 | return multi; |
1406 | 0 | error: |
1407 | 0 | isl_multi_val_free(mv); |
1408 | 0 | return FN(MULTI(BASE),free)(multi); |
1409 | 0 | } Unexecuted instantiation: isl_multi_aff_mod_multi_val Unexecuted instantiation: isl_multi_pw_aff_mod_multi_val Unexecuted instantiation: isl_multi_union_pw_aff_mod_multi_val Unexecuted instantiation: isl_multi_val_mod_multi_val |
1410 | | |
1411 | | #ifndef NO_MOVE_DIMS |
1412 | | /* Move the "n" dimensions of "src_type" starting at "src_pos" of "multi" |
1413 | | * to dimensions of "dst_type" at "dst_pos". |
1414 | | * |
1415 | | * We only support moving input dimensions to parameters and vice versa. |
1416 | | */ |
1417 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),move_dims)(__isl_take MULTI(BASE) *multi, |
1418 | | enum isl_dim_type dst_type, unsigned dst_pos, |
1419 | | enum isl_dim_type src_type, unsigned src_pos, unsigned n) |
1420 | 0 | { |
1421 | 0 | int i; |
1422 | 0 |
|
1423 | 0 | if (!multi) |
1424 | 0 | return NULL; |
1425 | 0 | |
1426 | 0 | if (n == 0 && |
1427 | 0 | !isl_space_is_named_or_nested(multi->space, src_type) && |
1428 | 0 | !isl_space_is_named_or_nested(multi->space, dst_type)) |
1429 | 0 | return multi; |
1430 | 0 | |
1431 | 0 | if (dst_type == isl_dim_out || src_type == isl_dim_out) |
1432 | 0 | isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
1433 | 0 | "cannot move output/set dimension", |
1434 | 0 | return FN(MULTI(BASE),free)(multi)); |
1435 | 0 | if (dst_type == isl_dim_div || src_type == isl_dim_div) |
1436 | 0 | isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
1437 | 0 | "cannot move divs", |
1438 | 0 | return FN(MULTI(BASE),free)(multi)); |
1439 | 0 | if (src_pos + n > isl_space_dim(multi->space, src_type)) |
1440 | 0 | isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
1441 | 0 | "range out of bounds", |
1442 | 0 | return FN(MULTI(BASE),free)(multi)); |
1443 | 0 | if (dst_type == src_type) |
1444 | 0 | isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_unsupported, |
1445 | 0 | "moving dims within the same type not supported", |
1446 | 0 | return FN(MULTI(BASE),free)(multi)); |
1447 | 0 |
|
1448 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
1449 | 0 | if (!multi) |
1450 | 0 | return NULL; |
1451 | 0 | |
1452 | 0 | multi->space = isl_space_move_dims(multi->space, dst_type, dst_pos, |
1453 | 0 | src_type, src_pos, n); |
1454 | 0 | if (!multi->space) |
1455 | 0 | return FN(MULTI(BASE),free)(multi); |
1456 | 0 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) |
1457 | 0 | multi = FN(MULTI(BASE),move_explicit_domain_dims)(multi, |
1458 | 0 | dst_type, dst_pos, src_type, src_pos, n); |
1459 | 0 | if (!multi) |
1460 | 0 | return NULL; |
1461 | 0 | |
1462 | 0 | for (i = 0; i < multi->n; ++i) { |
1463 | 0 | multi->u.p[i] = FN(EL,move_dims)(multi->u.p[i], |
1464 | 0 | dst_type, dst_pos, |
1465 | 0 | src_type, src_pos, n); |
1466 | 0 | if (!multi->u.p[i]) |
1467 | 0 | return FN(MULTI(BASE),free)(multi); |
1468 | 0 | } |
1469 | 0 |
|
1470 | 0 | return multi; |
1471 | 0 | } Unexecuted instantiation: isl_multi_aff_move_dims Unexecuted instantiation: isl_multi_pw_aff_move_dims |
1472 | | #endif |
1473 | | |
1474 | | /* Convert a multiple expression defined over a parameter domain |
1475 | | * into one that is defined over a zero-dimensional set. |
1476 | | */ |
1477 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),from_range)( |
1478 | | __isl_take MULTI(BASE) *multi) |
1479 | 0 | { |
1480 | 0 | isl_space *space; |
1481 | 0 |
|
1482 | 0 | if (!multi) |
1483 | 0 | return NULL; |
1484 | 0 | if (!isl_space_is_set(multi->space)) |
1485 | 0 | isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, |
1486 | 0 | "not living in a set space", |
1487 | 0 | return FN(MULTI(BASE),free)(multi)); |
1488 | 0 |
|
1489 | 0 | space = FN(MULTI(BASE),get_space)(multi); |
1490 | 0 | space = isl_space_from_range(space); |
1491 | 0 | multi = FN(MULTI(BASE),reset_space)(multi, space); |
1492 | 0 |
|
1493 | 0 | return multi; |
1494 | 0 | } Unexecuted instantiation: isl_multi_aff_from_range Unexecuted instantiation: isl_multi_pw_aff_from_range Unexecuted instantiation: isl_multi_union_pw_aff_from_range Unexecuted instantiation: isl_multi_val_from_range |
1495 | | |
1496 | | /* Are "multi1" and "multi2" obviously equal? |
1497 | | */ |
1498 | | isl_bool FN(MULTI(BASE),plain_is_equal)(__isl_keep MULTI(BASE) *multi1, |
1499 | | __isl_keep MULTI(BASE) *multi2) |
1500 | 4.09k | { |
1501 | 4.09k | int i; |
1502 | 4.09k | isl_bool equal; |
1503 | 4.09k | |
1504 | 4.09k | if (!multi1 || !multi2) |
1505 | 0 | return isl_bool_error; |
1506 | 4.09k | if (multi1->n != multi2->n) |
1507 | 0 | return isl_bool_false; |
1508 | 4.09k | equal = isl_space_is_equal(multi1->space, multi2->space); |
1509 | 4.09k | if (equal < 0 || !equal) |
1510 | 0 | return equal; |
1511 | 4.09k | |
1512 | 7.63k | for (i = 0; 4.09k i < multi1->n; ++i3.53k ) { |
1513 | 7.35k | equal = FN(EL,plain_is_equal)(multi1->u.p[i], multi2->u.p[i]); |
1514 | 7.35k | if (equal < 0 || !equal) |
1515 | 3.81k | return equal; |
1516 | 7.35k | } |
1517 | 4.09k | |
1518 | 4.09k | if (285 FN285 (MULTI(BASE),has_explicit_domain)(multi1)285 || |
1519 | 285 | FN197 (MULTI(BASE),has_explicit_domain)(multi2)197 ) { |
1520 | 88 | equal = FN(MULTI(BASE),equal_explicit_domain)(multi1, multi2); |
1521 | 88 | if (equal < 0 || !equal) |
1522 | 0 | return equal; |
1523 | 285 | } |
1524 | 285 | |
1525 | 285 | return isl_bool_true; |
1526 | 285 | } isl_multi_aff_plain_is_equal Line | Count | Source | 1500 | 3.92k | { | 1501 | 3.92k | int i; | 1502 | 3.92k | isl_bool equal; | 1503 | 3.92k | | 1504 | 3.92k | if (!multi1 || !multi2) | 1505 | 0 | return isl_bool_error; | 1506 | 3.92k | if (multi1->n != multi2->n) | 1507 | 0 | return isl_bool_false; | 1508 | 3.92k | equal = isl_space_is_equal(multi1->space, multi2->space); | 1509 | 3.92k | if (equal < 0 || !equal) | 1510 | 0 | return equal; | 1511 | 3.92k | | 1512 | 7.35k | for (i = 0; 3.92k i < multi1->n; ++i3.42k ) { | 1513 | 7.23k | equal = FN(EL,plain_is_equal)(multi1->u.p[i], multi2->u.p[i]); | 1514 | 7.23k | if (equal < 0 || !equal) | 1515 | 3.81k | return equal; | 1516 | 7.23k | } | 1517 | 3.92k | | 1518 | 3.92k | if (113 FN113 (MULTI(BASE),has_explicit_domain)(multi1)113 || | 1519 | 113 | FN(MULTI(BASE),has_explicit_domain)(multi2)) { | 1520 | 0 | equal = FN(MULTI(BASE),equal_explicit_domain)(multi1, multi2); | 1521 | 0 | if (equal < 0 || !equal) | 1522 | 0 | return equal; | 1523 | 113 | } | 1524 | 113 | | 1525 | 113 | return isl_bool_true; | 1526 | 113 | } |
isl_multi_pw_aff_plain_is_equal Line | Count | Source | 1500 | 58 | { | 1501 | 58 | int i; | 1502 | 58 | isl_bool equal; | 1503 | 58 | | 1504 | 58 | if (!multi1 || !multi2) | 1505 | 0 | return isl_bool_error; | 1506 | 58 | if (multi1->n != multi2->n) | 1507 | 0 | return isl_bool_false; | 1508 | 58 | equal = isl_space_is_equal(multi1->space, multi2->space); | 1509 | 58 | if (equal < 0 || !equal) | 1510 | 0 | return equal; | 1511 | 58 | | 1512 | 101 | for (i = 0; 58 i < multi1->n; ++i43 ) { | 1513 | 43 | equal = FN(EL,plain_is_equal)(multi1->u.p[i], multi2->u.p[i]); | 1514 | 43 | if (equal < 0 || !equal) | 1515 | 0 | return equal; | 1516 | 43 | } | 1517 | 58 | | 1518 | 58 | if (FN(MULTI(BASE),has_explicit_domain)(multi1) || | 1519 | 58 | FN31 (MULTI(BASE),has_explicit_domain)(multi2)31 ) { | 1520 | 27 | equal = FN(MULTI(BASE),equal_explicit_domain)(multi1, multi2); | 1521 | 27 | if (equal < 0 || !equal) | 1522 | 0 | return equal; | 1523 | 58 | } | 1524 | 58 | | 1525 | 58 | return isl_bool_true; | 1526 | 58 | } |
isl_multi_union_pw_aff_plain_is_equal Line | Count | Source | 1500 | 114 | { | 1501 | 114 | int i; | 1502 | 114 | isl_bool equal; | 1503 | 114 | | 1504 | 114 | if (!multi1 || !multi2) | 1505 | 0 | return isl_bool_error; | 1506 | 114 | if (multi1->n != multi2->n) | 1507 | 0 | return isl_bool_false; | 1508 | 114 | equal = isl_space_is_equal(multi1->space, multi2->space); | 1509 | 114 | if (equal < 0 || !equal) | 1510 | 0 | return equal; | 1511 | 114 | | 1512 | 182 | for (i = 0; 114 i < multi1->n; ++i68 ) { | 1513 | 68 | equal = FN(EL,plain_is_equal)(multi1->u.p[i], multi2->u.p[i]); | 1514 | 68 | if (equal < 0 || !equal) | 1515 | 0 | return equal; | 1516 | 68 | } | 1517 | 114 | | 1518 | 114 | if (FN(MULTI(BASE),has_explicit_domain)(multi1) || | 1519 | 114 | FN53 (MULTI(BASE),has_explicit_domain)(multi2)53 ) { | 1520 | 61 | equal = FN(MULTI(BASE),equal_explicit_domain)(multi1, multi2); | 1521 | 61 | if (equal < 0 || !equal) | 1522 | 0 | return equal; | 1523 | 114 | } | 1524 | 114 | | 1525 | 114 | return isl_bool_true; | 1526 | 114 | } |
Unexecuted instantiation: isl_multi_val_plain_is_equal |
1527 | | |
1528 | | /* Does "multi" involve any NaNs? |
1529 | | */ |
1530 | | isl_bool FN(MULTI(BASE),involves_nan)(__isl_keep MULTI(BASE) *multi) |
1531 | 1.75k | { |
1532 | 1.75k | int i; |
1533 | 1.75k | |
1534 | 1.75k | if (!multi) |
1535 | 0 | return isl_bool_error; |
1536 | 1.75k | if (multi->n == 0) |
1537 | 4 | return isl_bool_false; |
1538 | 1.75k | |
1539 | 5.82k | for (i = 0; 1.75k i < multi->n; ++i4.07k ) { |
1540 | 4.07k | isl_bool has_nan = FN(EL,involves_nan)(multi->u.p[i]); |
1541 | 4.07k | if (has_nan < 0 || has_nan) |
1542 | 2 | return has_nan; |
1543 | 4.07k | } |
1544 | 1.75k | |
1545 | 1.75k | return isl_bool_false1.75k ; |
1546 | 1.75k | } isl_multi_aff_involves_nan Line | Count | Source | 1531 | 1.75k | { | 1532 | 1.75k | int i; | 1533 | 1.75k | | 1534 | 1.75k | if (!multi) | 1535 | 0 | return isl_bool_error; | 1536 | 1.75k | if (multi->n == 0) | 1537 | 4 | return isl_bool_false; | 1538 | 1.75k | | 1539 | 5.82k | for (i = 0; 1.75k i < multi->n; ++i4.07k ) { | 1540 | 4.07k | isl_bool has_nan = FN(EL,involves_nan)(multi->u.p[i]); | 1541 | 4.07k | if (has_nan < 0 || has_nan) | 1542 | 2 | return has_nan; | 1543 | 4.07k | } | 1544 | 1.75k | | 1545 | 1.75k | return isl_bool_false1.75k ; | 1546 | 1.75k | } |
Unexecuted instantiation: isl_multi_pw_aff_involves_nan Unexecuted instantiation: isl_multi_union_pw_aff_involves_nan Unexecuted instantiation: isl_multi_val_involves_nan |
1547 | | |
1548 | | #ifndef NO_DOMAIN |
1549 | | /* Return the shared domain of the elements of "multi". |
1550 | | * |
1551 | | * If "multi" has an explicit domain, then return this domain. |
1552 | | */ |
1553 | | __isl_give isl_set *FN(MULTI(BASE),domain)(__isl_take MULTI(BASE) *multi) |
1554 | 0 | { |
1555 | 0 | int i; |
1556 | 0 | isl_set *dom; |
1557 | 0 |
|
1558 | 0 | if (!multi) |
1559 | 0 | return NULL; |
1560 | 0 | |
1561 | 0 | if (FN(MULTI(BASE),has_explicit_domain)(multi)) { |
1562 | 0 | dom = FN(MULTI(BASE),get_explicit_domain)(multi); |
1563 | 0 | FN(MULTI(BASE),free)(multi); |
1564 | 0 | return dom; |
1565 | 0 | } |
1566 | 0 |
|
1567 | 0 | dom = isl_set_universe(FN(MULTI(BASE),get_domain_space)(multi)); |
1568 | 0 | for (i = 0; i < multi->n; ++i) { |
1569 | 0 | isl_set *dom_i; |
1570 | 0 |
|
1571 | 0 | dom_i = FN(EL,domain)(FN(FN(MULTI(BASE),get),BASE)(multi, i)); |
1572 | 0 | dom = isl_set_intersect(dom, dom_i); |
1573 | 0 | } |
1574 | 0 |
|
1575 | 0 | FN(MULTI(BASE),free)(multi); |
1576 | 0 | return dom; |
1577 | 0 | } |
1578 | | #endif |
1579 | | |
1580 | | #ifndef NO_NEG |
1581 | | /* Return the opposite of "multi". |
1582 | | */ |
1583 | | __isl_give MULTI(BASE) *FN(MULTI(BASE),neg)(__isl_take MULTI(BASE) *multi) |
1584 | 0 | { |
1585 | 0 | int i; |
1586 | 0 |
|
1587 | 0 | multi = FN(MULTI(BASE),cow)(multi); |
1588 | 0 | if (!multi) |
1589 | 0 | return NULL; |
1590 | 0 | |
1591 | 0 | for (i = 0; i < multi->n; ++i) { |
1592 | 0 | multi->u.p[i] = FN(EL,neg)(multi->u.p[i]); |
1593 | 0 | if (!multi->u.p[i]) |
1594 | 0 | return FN(MULTI(BASE),free)(multi); |
1595 | 0 | } |
1596 | 0 |
|
1597 | 0 | return multi; |
1598 | 0 | } Unexecuted instantiation: isl_multi_aff_neg Unexecuted instantiation: isl_multi_pw_aff_neg Unexecuted instantiation: isl_multi_union_pw_aff_neg Unexecuted instantiation: isl_multi_val_neg |
1599 | | #endif |