Coverage Report

Created: 2017-11-21 16:49

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_union_templ.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2010      INRIA Saclay
3
 * Copyright 2013      Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
8
 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
9
 * 91893 Orsay, France 
10
 * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
11
 */
12
13
__isl_give UNION *FN(UNION,cow)(__isl_take UNION *u);
14
15
isl_ctx *FN(UNION,get_ctx)(__isl_keep UNION *u)
16
12.3k
{
17
12.3k
  return u ? u->space->ctx : NULL;
18
12.3k
}
isl_union_pw_aff_get_ctx
Line
Count
Source
16
4.08k
{
17
4.08k
  return u ? u->space->ctx : NULL;
18
4.08k
}
isl_union_pw_multi_aff_get_ctx
Line
Count
Source
16
8.25k
{
17
8.25k
  return u ? u->space->ctx : NULL;
18
8.25k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_get_ctx
Unexecuted instantiation: isl_union_pw_qpolynomial_get_ctx
19
20
__isl_give isl_space *FN(UNION,get_space)(__isl_keep UNION *u)
21
26.0k
{
22
26.0k
  if (!u)
23
0
    return NULL;
24
26.0k
  return isl_space_copy(u->space);
25
26.0k
}
isl_union_pw_aff_get_space
Line
Count
Source
21
17.9k
{
22
17.9k
  if (!u)
23
0
    return NULL;
24
17.9k
  return isl_space_copy(u->space);
25
17.9k
}
isl_union_pw_multi_aff_get_space
Line
Count
Source
21
8.09k
{
22
8.09k
  if (!u)
23
0
    return NULL;
24
8.09k
  return isl_space_copy(u->space);
25
8.09k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_get_space
Unexecuted instantiation: isl_union_pw_qpolynomial_get_space
26
27
/* Return the number of parameters of "u", where "type"
28
 * is required to be set to isl_dim_param.
29
 */
30
unsigned FN(UNION,dim)(__isl_keep UNION *u, enum isl_dim_type type)
31
0
{
32
0
  if (!u)
33
0
    return 0;
34
0
35
0
  if (type != isl_dim_param)
36
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
37
0
      "can only reference parameters", return 0);
38
0
39
0
  return isl_space_dim(u->space, type);
40
0
}
Unexecuted instantiation: isl_union_pw_aff_dim
Unexecuted instantiation: isl_union_pw_multi_aff_dim
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_dim
Unexecuted instantiation: isl_union_pw_qpolynomial_dim
41
42
/* Return the position of the parameter with the given name
43
 * in "u".
44
 * Return -1 if no such dimension can be found.
45
 */
46
int FN(UNION,find_dim_by_name)(__isl_keep UNION *u, enum isl_dim_type type,
47
  const char *name)
48
0
{
49
0
  if (!u)
50
0
    return -1;
51
0
  return isl_space_find_dim_by_name(u->space, type, name);
52
0
}
Unexecuted instantiation: isl_union_pw_aff_find_dim_by_name
Unexecuted instantiation: isl_union_pw_multi_aff_find_dim_by_name
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_find_dim_by_name
Unexecuted instantiation: isl_union_pw_qpolynomial_find_dim_by_name
53
54
#ifdef HAS_TYPE
55
static __isl_give UNION *FN(UNION,alloc)(__isl_take isl_space *dim,
56
  enum isl_fold type, int size)
57
#else
58
static __isl_give UNION *FN(UNION,alloc)(__isl_take isl_space *dim, int size)
59
#endif
60
5.87k
{
61
5.87k
  UNION *u;
62
5.87k
63
5.87k
  dim = isl_space_params(dim);
64
5.87k
  if (!dim)
65
0
    return NULL;
66
5.87k
67
5.87k
  u = isl_calloc_type(dim->ctx, UNION);
68
5.87k
  if (!u)
69
0
    goto error;
70
5.87k
71
5.87k
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
5.87k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
5.87k
79
5.87k
  return u;
80
5.87k
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
5.87k
}
isl_aff.c:isl_union_pw_aff_alloc
Line
Count
Source
60
2.24k
{
61
2.24k
  UNION *u;
62
2.24k
63
2.24k
  dim = isl_space_params(dim);
64
2.24k
  if (!dim)
65
0
    return NULL;
66
2.24k
67
2.24k
  u = isl_calloc_type(dim->ctx, UNION);
68
2.24k
  if (!u)
69
0
    goto error;
70
2.24k
71
2.24k
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
2.24k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
2.24k
79
2.24k
  return u;
80
2.24k
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
2.24k
}
isl_aff.c:isl_union_pw_multi_aff_alloc
Line
Count
Source
60
3.63k
{
61
3.63k
  UNION *u;
62
3.63k
63
3.63k
  dim = isl_space_params(dim);
64
3.63k
  if (!dim)
65
0
    return NULL;
66
3.63k
67
3.63k
  u = isl_calloc_type(dim->ctx, UNION);
68
3.63k
  if (!u)
69
0
    goto error;
70
3.63k
71
3.63k
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
3.63k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
3.63k
79
3.63k
  return u;
80
3.63k
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
3.63k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_alloc
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_alloc
84
85
#ifdef HAS_TYPE
86
__isl_give UNION *FN(UNION,ZERO)(__isl_take isl_space *dim, enum isl_fold type)
87
0
{
88
0
  return FN(UNION,alloc)(dim, type, 16);
89
0
}
90
#else
91
__isl_give UNION *FN(UNION,ZERO)(__isl_take isl_space *dim)
92
3.67k
{
93
3.67k
  return FN(UNION,alloc)(dim, 16);
94
3.67k
}
isl_union_pw_aff_empty
Line
Count
Source
92
933
{
93
933
  return FN(UNION,alloc)(dim, 16);
94
933
}
isl_union_pw_multi_aff_empty
Line
Count
Source
92
2.74k
{
93
2.74k
  return FN(UNION,alloc)(dim, 16);
94
2.74k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_zero
95
#endif
96
97
__isl_give UNION *FN(UNION,copy)(__isl_keep UNION *u)
98
11.3k
{
99
11.3k
  if (!u)
100
0
    return NULL;
101
11.3k
102
11.3k
  u->ref++;
103
11.3k
  return u;
104
11.3k
}
isl_union_pw_aff_copy
Line
Count
Source
98
8.56k
{
99
8.56k
  if (!u)
100
0
    return NULL;
101
8.56k
102
8.56k
  u->ref++;
103
8.56k
  return u;
104
8.56k
}
isl_union_pw_multi_aff_copy
Line
Count
Source
98
2.74k
{
99
2.74k
  if (!u)
100
0
    return NULL;
101
2.74k
102
2.74k
  u->ref++;
103
2.74k
  return u;
104
2.74k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_copy
Unexecuted instantiation: isl_union_pw_qpolynomial_copy
105
106
/* Extract the element of "u" living in "space" (ignoring parameters).
107
 *
108
 * Return the ZERO element if "u" does not contain any element
109
 * living in "space".
110
 */
111
__isl_give PART *FN(FN(UNION,extract),PARTS)(__isl_keep UNION *u,
112
  __isl_take isl_space *space)
113
0
{
114
0
  struct isl_hash_table_entry *entry;
115
0
  isl_bool equal_params;
116
0
117
0
  if (!u || !space)
118
0
    goto error;
119
0
  equal_params = isl_space_has_equal_params(u->space, space);
120
0
  if (equal_params < 0)
121
0
    goto error;
122
0
  if (!equal_params) {
123
0
    space = isl_space_drop_dims(space, isl_dim_param,
124
0
          0, isl_space_dim(space, isl_dim_param));
125
0
    space = isl_space_align_params(space,
126
0
          FN(UNION,get_space)(u));
127
0
    if (!space)
128
0
      goto error;
129
0
  }
130
0
131
0
  entry = FN(UNION,find_part_entry)(u, space, 0);
132
0
  if (!entry)
133
0
    goto error;
134
0
  if (entry == isl_hash_table_entry_none)
135
#ifdef HAS_TYPE
136
0
    return FN(PART,ZERO)(space, u->type);
137
#else
138
0
    return FN(PART,ZERO)(space);
139
0
#endif
140
0
  isl_space_free(space);
141
0
  return FN(PART,copy)(entry->data);
142
0
error:
143
0
  isl_space_free(space);
144
0
  return NULL;
145
0
}
Unexecuted instantiation: isl_union_pw_aff_extract_pw_aff
Unexecuted instantiation: isl_union_pw_multi_aff_extract_pw_multi_aff
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_extract_pw_qpolynomial_fold
Unexecuted instantiation: isl_union_pw_qpolynomial_extract_pw_qpolynomial
146
147
/* Add "part" to "u".
148
 * If "disjoint" is set, then "u" is not allowed to already have
149
 * a part that is defined over a domain that overlaps with the domain
150
 * of "part".
151
 * Otherwise, compute the union sum of "part" and the part in "u"
152
 * defined on the same space.
153
 */
154
static __isl_give UNION *FN(UNION,add_part_generic)(__isl_take UNION *u,
155
  __isl_take PART *part, int disjoint)
156
7.74k
{
157
7.74k
  int empty;
158
7.74k
  struct isl_hash_table_entry *entry;
159
7.74k
160
7.74k
  if (!part)
161
0
    goto error;
162
7.74k
163
7.74k
  empty = FN(PART,IS_ZERO)(part);
164
7.74k
  if (empty < 0)
165
0
    goto error;
166
7.74k
  if (empty) {
167
0
    FN(PART,free)(part);
168
0
    return u;
169
0
  }
170
7.74k
171
7.74k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
7.74k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
7.74k
174
7.74k
  u = FN(UNION,cow)(u);
175
7.74k
176
7.74k
  if (!u)
177
0
    goto error;
178
7.74k
179
7.74k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
0
    goto error;
181
7.74k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
7.74k
  if (!entry)
183
0
    goto error;
184
7.74k
185
7.74k
  if (!entry->data)
186
7.74k
    entry->data = part;
187
0
  else {
188
0
    if (disjoint &&
189
0
        FN(UNION,check_disjoint_domain)(entry->data, part) < 0)
190
0
      goto error;
191
0
    entry->data = FN(PART,union_add_)(entry->data,
192
0
            FN(PART,copy)(part));
193
0
    if (!entry->data)
194
0
      goto error;
195
0
    empty = FN(PART,IS_ZERO)(part);
196
0
    if (empty < 0)
197
0
      goto error;
198
0
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
0
    FN(PART,free)(part);
201
0
  }
202
7.74k
203
7.74k
  return u;
204
7.74k
error:
205
0
  FN(PART,free)(part);
206
0
  FN(UNION,free)(u);
207
0
  return NULL;
208
7.74k
}
isl_aff.c:isl_union_pw_aff_add_part_generic
Line
Count
Source
156
3.62k
{
157
3.62k
  int empty;
158
3.62k
  struct isl_hash_table_entry *entry;
159
3.62k
160
3.62k
  if (!part)
161
0
    goto error;
162
3.62k
163
3.62k
  empty = FN(PART,IS_ZERO)(part);
164
3.62k
  if (empty < 0)
165
0
    goto error;
166
3.62k
  if (empty) {
167
0
    FN(PART,free)(part);
168
0
    return u;
169
0
  }
170
3.62k
171
3.62k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
3.62k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
3.62k
174
3.62k
  u = FN(UNION,cow)(u);
175
3.62k
176
3.62k
  if (!u)
177
0
    goto error;
178
3.62k
179
3.62k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
0
    goto error;
181
3.62k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
3.62k
  if (!entry)
183
0
    goto error;
184
3.62k
185
3.62k
  if (!entry->data)
186
3.62k
    entry->data = part;
187
0
  else {
188
0
    if (disjoint &&
189
0
        FN(UNION,check_disjoint_domain)(entry->data, part) < 0)
190
0
      goto error;
191
0
    entry->data = FN(PART,union_add_)(entry->data,
192
0
            FN(PART,copy)(part));
193
0
    if (!entry->data)
194
0
      goto error;
195
0
    empty = FN(PART,IS_ZERO)(part);
196
0
    if (empty < 0)
197
0
      goto error;
198
0
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
0
    FN(PART,free)(part);
201
0
  }
202
3.62k
203
3.62k
  return u;
204
3.62k
error:
205
0
  FN(PART,free)(part);
206
0
  FN(UNION,free)(u);
207
0
  return NULL;
208
3.62k
}
isl_aff.c:isl_union_pw_multi_aff_add_part_generic
Line
Count
Source
156
4.12k
{
157
4.12k
  int empty;
158
4.12k
  struct isl_hash_table_entry *entry;
159
4.12k
160
4.12k
  if (!part)
161
0
    goto error;
162
4.12k
163
4.12k
  empty = FN(PART,IS_ZERO)(part);
164
4.12k
  if (empty < 0)
165
0
    goto error;
166
4.12k
  if (empty) {
167
0
    FN(PART,free)(part);
168
0
    return u;
169
0
  }
170
4.12k
171
4.12k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
4.12k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
4.12k
174
4.12k
  u = FN(UNION,cow)(u);
175
4.12k
176
4.12k
  if (!u)
177
0
    goto error;
178
4.12k
179
4.12k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
0
    goto error;
181
4.12k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
4.12k
  if (!entry)
183
0
    goto error;
184
4.12k
185
4.12k
  if (!entry->data)
186
4.12k
    entry->data = part;
187
0
  else {
188
0
    if (disjoint &&
189
0
        FN(UNION,check_disjoint_domain)(entry->data, part) < 0)
190
0
      goto error;
191
0
    entry->data = FN(PART,union_add_)(entry->data,
192
0
            FN(PART,copy)(part));
193
0
    if (!entry->data)
194
0
      goto error;
195
0
    empty = FN(PART,IS_ZERO)(part);
196
0
    if (empty < 0)
197
0
      goto error;
198
0
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
0
    FN(PART,free)(part);
201
0
  }
202
4.12k
203
4.12k
  return u;
204
4.12k
error:
205
0
  FN(PART,free)(part);
206
0
  FN(UNION,free)(u);
207
0
  return NULL;
208
4.12k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_add_part_generic
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_add_part_generic
209
210
/* Add "part" to "u", where "u" is assumed not to already have
211
 * a part that is defined on the same space as "part".
212
 */
213
__isl_give UNION *FN(FN(UNION,add),PARTS)(__isl_take UNION *u,
214
  __isl_take PART *part)
215
7.63k
{
216
7.63k
  return FN(UNION,add_part_generic)(u, part, 1);
217
7.63k
}
isl_union_pw_aff_add_pw_aff
Line
Count
Source
215
3.56k
{
216
3.56k
  return FN(UNION,add_part_generic)(u, part, 1);
217
3.56k
}
isl_union_pw_multi_aff_add_pw_multi_aff
Line
Count
Source
215
4.06k
{
216
4.06k
  return FN(UNION,add_part_generic)(u, part, 1);
217
4.06k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_add_pw_qpolynomial_fold
Unexecuted instantiation: isl_union_pw_qpolynomial_add_pw_qpolynomial
218
219
#ifdef HAS_TYPE
220
/* Allocate a UNION with the same type and the same size as "u" and
221
 * with space "space".
222
 */
223
static __isl_give UNION *FN(UNION,alloc_same_size_on_space)(__isl_keep UNION *u,
224
  __isl_take isl_space *space)
225
0
{
226
0
  if (!u)
227
0
    goto error;
228
0
  return FN(UNION,alloc)(space, u->type, u->table.n);
229
0
error:
230
0
  isl_space_free(space);
231
0
  return NULL;
232
0
}
233
#else
234
/* Allocate a UNION with the same size as "u" and with space "space".
235
 */
236
static __isl_give UNION *FN(UNION,alloc_same_size_on_space)(__isl_keep UNION *u,
237
  __isl_take isl_space *space)
238
2.19k
{
239
2.19k
  if (!u)
240
0
    goto error;
241
2.19k
  return FN(UNION,alloc)(space, u->table.n);
242
2.19k
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
2.19k
}
isl_aff.c:isl_union_pw_aff_alloc_same_size_on_space
Line
Count
Source
238
1.31k
{
239
1.31k
  if (!u)
240
0
    goto error;
241
1.31k
  return FN(UNION,alloc)(space, u->table.n);
242
1.31k
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
1.31k
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size_on_space
Line
Count
Source
238
885
{
239
885
  if (!u)
240
0
    goto error;
241
885
  return FN(UNION,alloc)(space, u->table.n);
242
885
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
885
}
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_alloc_same_size_on_space
246
#endif
247
248
/* Allocate a UNION with the same space, the same type (if any) and
249
 * the same size as "u".
250
 */
251
static __isl_give UNION *FN(UNION,alloc_same_size)(__isl_keep UNION *u)
252
472
{
253
472
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
472
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size
Line
Count
Source
252
54
{
253
54
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
54
}
isl_aff.c:isl_union_pw_aff_alloc_same_size
Line
Count
Source
252
418
{
253
418
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
418
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_alloc_same_size
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_alloc_same_size
255
256
/* Internal data structure for isl_union_*_transform_space.
257
 * "fn' is applied to each entry in the input.
258
 * "res" collects the results.
259
 */
260
S(UNION,transform_data)
261
{
262
  __isl_give PART *(*fn)(__isl_take PART *part, void *user);
263
  void *user;
264
265
  UNION *res;
266
};
267
268
/* Apply data->fn to "part" and add the result to data->res.
269
 */
270
static isl_stat FN(UNION,transform_entry)(__isl_take PART *part, void *user)
271
1.89k
{
272
1.89k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
273
1.89k
274
1.89k
  part = data->fn(part, data->user);
275
1.89k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
276
1.89k
  if (!data->res)
277
0
    return isl_stat_error;
278
1.89k
279
1.89k
  return isl_stat_ok;
280
1.89k
}
isl_aff.c:isl_union_pw_aff_transform_entry
Line
Count
Source
271
1.25k
{
272
1.25k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
273
1.25k
274
1.25k
  part = data->fn(part, data->user);
275
1.25k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
276
1.25k
  if (!data->res)
277
0
    return isl_stat_error;
278
1.25k
279
1.25k
  return isl_stat_ok;
280
1.25k
}
isl_aff.c:isl_union_pw_multi_aff_transform_entry
Line
Count
Source
271
643
{
272
643
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
273
643
274
643
  part = data->fn(part, data->user);
275
643
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
276
643
  if (!data->res)
277
0
    return isl_stat_error;
278
643
279
643
  return isl_stat_ok;
280
643
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_entry
281
282
/* Return a UNION living in "space" that is obtained by applying "fn"
283
 * to each of the entries in "u".
284
 */
285
static __isl_give UNION *FN(UNION,transform_space)(__isl_take UNION *u,
286
  isl_space *space,
287
  __isl_give PART *(*fn)(__isl_take PART *part, void *user), void *user)
288
1.72k
{
289
1.72k
  S(UNION,transform_data) data = { fn, user };
290
1.72k
291
1.72k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
292
1.72k
  if (FN(FN(UNION,foreach),PARTS)(u,
293
1.72k
          &FN(UNION,transform_entry), &data) < 0)
294
0
    data.res = FN(UNION,free)(data.res);
295
1.72k
  FN(UNION,free)(u);
296
1.72k
  return data.res;
297
1.72k
}
isl_aff.c:isl_union_pw_aff_transform_space
Line
Count
Source
288
896
{
289
896
  S(UNION,transform_data) data = { fn, user };
290
896
291
896
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
292
896
  if (FN(FN(UNION,foreach),PARTS)(u,
293
896
          &FN(UNION,transform_entry), &data) < 0)
294
0
    data.res = FN(UNION,free)(data.res);
295
896
  FN(UNION,free)(u);
296
896
  return data.res;
297
896
}
isl_aff.c:isl_union_pw_multi_aff_transform_space
Line
Count
Source
288
831
{
289
831
  S(UNION,transform_data) data = { fn, user };
290
831
291
831
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
292
831
  if (FN(FN(UNION,foreach),PARTS)(u,
293
831
          &FN(UNION,transform_entry), &data) < 0)
294
0
    data.res = FN(UNION,free)(data.res);
295
831
  FN(UNION,free)(u);
296
831
  return data.res;
297
831
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_space
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_space
298
299
/* Return a UNION that lives in the same space as "u" and that is obtained
300
 * by applying "fn" to each of the entries in "u".
301
 */
302
static __isl_give UNION *FN(UNION,transform)(__isl_take UNION *u,
303
  __isl_give PART *(*fn)(__isl_take PART *part, void *user), void *user)
304
1.67k
{
305
1.67k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
306
1.67k
}
isl_aff.c:isl_union_pw_aff_transform
Line
Count
Source
304
847
{
305
847
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
306
847
}
isl_aff.c:isl_union_pw_multi_aff_transform
Line
Count
Source
304
829
{
305
829
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
306
829
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform
307
308
/* Apply data->fn to *part and store the result back into *part.
309
 */
310
static isl_stat FN(UNION,transform_inplace_entry)(void **part, void *user)
311
276
{
312
276
  S(UNION,transform_data) *data = (S(UNION,transform_data) *) user;
313
276
314
276
  *part = data->fn(*part, data->user);
315
276
  if (!*part)
316
0
    return isl_stat_error;
317
276
  return isl_stat_ok;
318
276
}
isl_aff.c:isl_union_pw_aff_transform_inplace_entry
Line
Count
Source
311
276
{
312
276
  S(UNION,transform_data) *data = (S(UNION,transform_data) *) user;
313
276
314
276
  *part = data->fn(*part, data->user);
315
276
  if (!*part)
316
0
    return isl_stat_error;
317
276
  return isl_stat_ok;
318
276
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_transform_inplace_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_inplace_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_inplace_entry
319
320
/* Update "u" by applying "fn" to each entry.
321
 * This operation is assumed not to change the number of entries nor
322
 * the spaces of the entries.
323
 *
324
 * If there is only one reference to "u", then change "u" inplace.
325
 * Otherwise, create a new UNION from "u" and discard the original.
326
 */
327
static __isl_give UNION *FN(UNION,transform_inplace)(__isl_take UNION *u,
328
  __isl_give PART *(*fn)(__isl_take PART *part, void *user), void *user)
329
980
{
330
980
  isl_bool single_ref;
331
980
332
980
  single_ref = FN(UNION,has_single_reference)(u);
333
980
  if (single_ref < 0)
334
0
    return FN(UNION,free)(u);
335
980
  if (single_ref) {
336
190
    S(UNION,transform_data) data = { fn, user };
337
190
    if (FN(UNION,foreach_inplace)(u,
338
190
        &FN(UNION,transform_inplace_entry), &data) < 0)
339
0
      return FN(UNION,free)(u);
340
190
    return u;
341
190
  }
342
790
  return FN(UNION,transform)(u, fn, user);
343
980
}
isl_aff.c:isl_union_pw_aff_transform_inplace
Line
Count
Source
329
980
{
330
980
  isl_bool single_ref;
331
980
332
980
  single_ref = FN(UNION,has_single_reference)(u);
333
980
  if (single_ref < 0)
334
0
    return FN(UNION,free)(u);
335
980
  if (single_ref) {
336
190
    S(UNION,transform_data) data = { fn, user };
337
190
    if (FN(UNION,foreach_inplace)(u,
338
190
        &FN(UNION,transform_inplace_entry), &data) < 0)
339
0
      return FN(UNION,free)(u);
340
190
    return u;
341
190
  }
342
790
  return FN(UNION,transform)(u, fn, user);
343
980
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_transform_inplace
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_inplace
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_inplace
344
345
/* An isl_union_*_transform callback for use in isl_union_*_dup
346
 * that simply returns "part".
347
 */
348
static __isl_give PART *FN(UNION,copy_part)(__isl_take PART *part, void *user)
349
732
{
350
732
  return part;
351
732
}
isl_aff.c:isl_union_pw_aff_copy_part
Line
Count
Source
349
89
{
350
89
  return part;
351
89
}
isl_aff.c:isl_union_pw_multi_aff_copy_part
Line
Count
Source
349
643
{
350
643
  return part;
351
643
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_copy_part
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_copy_part
352
353
__isl_give UNION *FN(UNION,dup)(__isl_keep UNION *u)
354
886
{
355
886
  u = FN(UNION,copy)(u);
356
886
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
357
886
}
isl_union_pw_aff_dup
Line
Count
Source
354
57
{
355
57
  u = FN(UNION,copy)(u);
356
57
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
357
57
}
isl_union_pw_multi_aff_dup
Line
Count
Source
354
829
{
355
829
  u = FN(UNION,copy)(u);
356
829
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
357
829
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_dup
Unexecuted instantiation: isl_union_pw_qpolynomial_dup
358
359
__isl_give UNION *FN(UNION,cow)(__isl_take UNION *u)
360
7.84k
{
361
7.84k
  if (!u)
362
0
    return NULL;
363
7.84k
364
7.84k
  if (u->ref == 1)
365
6.95k
    return u;
366
886
  u->ref--;
367
886
  return FN(UNION,dup)(u);
368
7.84k
}
isl_union_pw_aff_cow
Line
Count
Source
360
3.68k
{
361
3.68k
  if (!u)
362
0
    return NULL;
363
3.68k
364
3.68k
  if (u->ref == 1)
365
3.62k
    return u;
366
57
  u->ref--;
367
57
  return FN(UNION,dup)(u);
368
3.68k
}
isl_union_pw_multi_aff_cow
Line
Count
Source
360
4.16k
{
361
4.16k
  if (!u)
362
0
    return NULL;
363
4.16k
364
4.16k
  if (u->ref == 1)
365
3.33k
    return u;
366
829
  u->ref--;
367
829
  return FN(UNION,dup)(u);
368
4.16k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_cow
Unexecuted instantiation: isl_union_pw_qpolynomial_cow
369
370
__isl_null UNION *FN(UNION,free)(__isl_take UNION *u)
371
19.6k
{
372
19.6k
  if (!u)
373
3.39k
    return NULL;
374
16.2k
375
16.2k
  if (--u->ref > 0)
376
10.4k
    return NULL;
377
5.85k
378
5.85k
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
5.85k
        &FN(UNION,free_u_entry), NULL);
380
19.6k
  isl_hash_table_clear(&u->table);
381
19.6k
  isl_space_free(u->space);
382
19.6k
  free(u);
383
19.6k
  return NULL;
384
19.6k
}
isl_union_pw_aff_free
Line
Count
Source
371
14.1k
{
372
14.1k
  if (!u)
373
3.39k
    return NULL;
374
10.7k
375
10.7k
  if (--u->ref > 0)
376
8.50k
    return NULL;
377
2.22k
378
2.22k
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
2.22k
        &FN(UNION,free_u_entry), NULL);
380
14.1k
  isl_hash_table_clear(&u->table);
381
14.1k
  isl_space_free(u->space);
382
14.1k
  free(u);
383
14.1k
  return NULL;
384
14.1k
}
isl_union_pw_multi_aff_free
Line
Count
Source
371
5.54k
{
372
5.54k
  if (!u)
373
0
    return NULL;
374
5.54k
375
5.54k
  if (--u->ref > 0)
376
1.91k
    return NULL;
377
3.63k
378
3.63k
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
3.63k
        &FN(UNION,free_u_entry), NULL);
380
5.54k
  isl_hash_table_clear(&u->table);
381
5.54k
  isl_space_free(u->space);
382
5.54k
  free(u);
383
5.54k
  return NULL;
384
5.54k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_free
Unexecuted instantiation: isl_union_pw_qpolynomial_free
385
386
static __isl_give PART *FN(UNION,align_entry)(__isl_take PART *part, void *user)
387
70
{
388
70
  isl_reordering *exp = user;
389
70
390
70
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
391
70
            FN(PART,get_domain_space)(part));
392
70
  return FN(PART,realign_domain)(part, exp);
393
70
}
isl_aff.c:isl_union_pw_aff_align_entry
Line
Count
Source
387
70
{
388
70
  isl_reordering *exp = user;
389
70
390
70
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
391
70
            FN(PART,get_domain_space)(part));
392
70
  return FN(PART,realign_domain)(part, exp);
393
70
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_align_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_align_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_align_entry
394
395
/* Reorder the parameters of "u" according to the given reordering.
396
 */
397
static __isl_give UNION *FN(UNION,realign_domain)(__isl_take UNION *u,
398
  __isl_take isl_reordering *r)
399
51
{
400
51
  isl_space *space;
401
51
402
51
  if (!u || !r)
403
0
    goto error;
404
51
405
51
  space = isl_space_copy(r->dim);
406
51
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
407
51
  isl_reordering_free(r);
408
51
  return u;
409
51
error:
410
0
  FN(UNION,free)(u);
411
0
  isl_reordering_free(r);
412
0
  return NULL;
413
51
}
isl_aff.c:isl_union_pw_aff_realign_domain
Line
Count
Source
399
49
{
400
49
  isl_space *space;
401
49
402
49
  if (!u || !r)
403
0
    goto error;
404
49
405
49
  space = isl_space_copy(r->dim);
406
49
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
407
49
  isl_reordering_free(r);
408
49
  return u;
409
49
error:
410
0
  FN(UNION,free)(u);
411
0
  isl_reordering_free(r);
412
0
  return NULL;
413
49
}
isl_aff.c:isl_union_pw_multi_aff_realign_domain
Line
Count
Source
399
2
{
400
2
  isl_space *space;
401
2
402
2
  if (!u || !r)
403
0
    goto error;
404
2
405
2
  space = isl_space_copy(r->dim);
406
2
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
407
2
  isl_reordering_free(r);
408
2
  return u;
409
2
error:
410
0
  FN(UNION,free)(u);
411
0
  isl_reordering_free(r);
412
0
  return NULL;
413
2
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_realign_domain
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_realign_domain
414
415
/* Align the parameters of "u" to those of "model".
416
 */
417
__isl_give UNION *FN(UNION,align_params)(__isl_take UNION *u,
418
  __isl_take isl_space *model)
419
8.89k
{
420
8.89k
  isl_bool equal_params;
421
8.89k
  isl_reordering *r;
422
8.89k
423
8.89k
  if (!u || !model)
424
0
    goto error;
425
8.89k
426
8.89k
  equal_params = isl_space_has_equal_params(u->space, model);
427
8.89k
  if (equal_params < 0)
428
0
    goto error;
429
8.89k
  if (equal_params) {
430
8.89k
    isl_space_free(model);
431
8.89k
    return u;
432
8.89k
  }
433
2
434
2
  model = isl_space_params(model);
435
2
  r = isl_parameter_alignment_reordering(u->space, model);
436
2
  isl_space_free(model);
437
2
438
2
  return FN(UNION,realign_domain)(u, r);
439
2
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
8.89k
}
isl_union_pw_aff_align_params
Line
Count
Source
419
4.33k
{
420
4.33k
  isl_bool equal_params;
421
4.33k
  isl_reordering *r;
422
4.33k
423
4.33k
  if (!u || !model)
424
0
    goto error;
425
4.33k
426
4.33k
  equal_params = isl_space_has_equal_params(u->space, model);
427
4.33k
  if (equal_params < 0)
428
0
    goto error;
429
4.33k
  if (equal_params) {
430
4.33k
    isl_space_free(model);
431
4.33k
    return u;
432
4.33k
  }
433
0
434
0
  model = isl_space_params(model);
435
0
  r = isl_parameter_alignment_reordering(u->space, model);
436
0
  isl_space_free(model);
437
0
438
0
  return FN(UNION,realign_domain)(u, r);
439
0
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
4.33k
}
isl_union_pw_multi_aff_align_params
Line
Count
Source
419
4.55k
{
420
4.55k
  isl_bool equal_params;
421
4.55k
  isl_reordering *r;
422
4.55k
423
4.55k
  if (!u || !model)
424
0
    goto error;
425
4.55k
426
4.55k
  equal_params = isl_space_has_equal_params(u->space, model);
427
4.55k
  if (equal_params < 0)
428
0
    goto error;
429
4.55k
  if (equal_params) {
430
4.55k
    isl_space_free(model);
431
4.55k
    return u;
432
4.55k
  }
433
2
434
2
  model = isl_space_params(model);
435
2
  r = isl_parameter_alignment_reordering(u->space, model);
436
2
  isl_space_free(model);
437
2
438
2
  return FN(UNION,realign_domain)(u, r);
439
2
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
4.55k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_align_params
Unexecuted instantiation: isl_union_pw_qpolynomial_align_params
444
445
/* Add "part" to *u, taking the union sum if "u" already has
446
 * a part defined on the same space as "part".
447
 */
448
static isl_stat FN(UNION,union_add_part)(__isl_take PART *part, void *user)
449
116
{
450
116
  UNION **u = (UNION **)user;
451
116
452
116
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
116
454
116
  return isl_stat_ok;
455
116
}
isl_aff.c:isl_union_pw_aff_union_add_part
Line
Count
Source
449
58
{
450
58
  UNION **u = (UNION **)user;
451
58
452
58
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
58
454
58
  return isl_stat_ok;
455
58
}
isl_aff.c:isl_union_pw_multi_aff_union_add_part
Line
Count
Source
449
58
{
450
58
  UNION **u = (UNION **)user;
451
58
452
58
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
58
454
58
  return isl_stat_ok;
455
58
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_union_add_part
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_union_add_part
456
457
/* Compute the sum of "u1" and "u2" on the union of their domains,
458
 * with the actual sum on the shared domain and
459
 * the defined expression on the symmetric difference of the domains.
460
 *
461
 * This is an internal function that is exposed under different
462
 * names depending on whether the base expressions have a zero default
463
 * value.
464
 * If they do, then this function is called "add".
465
 * Otherwise, it is called "union_add".
466
 */
467
static __isl_give UNION *FN(UNION,union_add_)(__isl_take UNION *u1,
468
  __isl_take UNION *u2)
469
93
{
470
93
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
93
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
93
473
93
  u1 = FN(UNION,cow)(u1);
474
93
475
93
  if (!u1 || !u2)
476
0
    goto error;
477
93
478
93
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
93
481
93
  FN(UNION,free)(u2);
482
93
483
93
  return u1;
484
93
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
93
}
isl_aff.c:isl_union_pw_aff_union_add_
Line
Count
Source
469
58
{
470
58
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
58
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
58
473
58
  u1 = FN(UNION,cow)(u1);
474
58
475
58
  if (!u1 || !u2)
476
0
    goto error;
477
58
478
58
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
58
481
58
  FN(UNION,free)(u2);
482
58
483
58
  return u1;
484
58
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
58
}
isl_aff.c:isl_union_pw_multi_aff_union_add_
Line
Count
Source
469
35
{
470
35
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
35
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
35
473
35
  u1 = FN(UNION,cow)(u1);
474
35
475
35
  if (!u1 || !u2)
476
0
    goto error;
477
35
478
35
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
35
481
35
  FN(UNION,free)(u2);
482
35
483
35
  return u1;
484
35
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
35
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_union_add_
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_union_add_
489
490
__isl_give UNION *FN(FN(UNION,from),PARTS)(__isl_take PART *part)
491
195
{
492
195
  isl_space *dim;
493
195
  UNION *u;
494
195
495
195
  if (!part)
496
0
    return NULL;
497
195
498
195
  dim = FN(PART,get_space)(part);
499
195
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
500
195
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
501
#ifdef HAS_TYPE
502
0
  u = FN(UNION,ZERO)(dim, part->type);
503
#else
504
195
  u = FN(UNION,ZERO)(dim);
505
#endif
506
195
  u = FN(FN(UNION,add),PARTS)(u, part);
507
195
508
195
  return u;
509
195
}
isl_union_pw_aff_from_pw_aff
Line
Count
Source
491
195
{
492
195
  isl_space *dim;
493
195
  UNION *u;
494
195
495
195
  if (!part)
496
0
    return NULL;
497
195
498
195
  dim = FN(PART,get_space)(part);
499
195
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
500
195
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
501
#ifdef HAS_TYPE
502
  u = FN(UNION,ZERO)(dim, part->type);
503
#else
504
195
  u = FN(UNION,ZERO)(dim);
505
195
#endif
506
195
  u = FN(FN(UNION,add),PARTS)(u, part);
507
195
508
195
  return u;
509
195
}
Unexecuted instantiation: isl_union_pw_multi_aff_from_pw_multi_aff
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_from_pw_qpolynomial_fold
Unexecuted instantiation: isl_union_pw_qpolynomial_from_pw_qpolynomial
510
511
S(UNION,match_bin_data) {
512
  UNION *u2;
513
  UNION *res;
514
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *);
515
};
516
517
/* Check if data->u2 has an element living in the same space as "part".
518
 * If so, call data->fn on the two elements and add the result to
519
 * data->res.
520
 */
521
static isl_stat FN(UNION,match_bin_entry)(__isl_take PART *part, void *user)
522
271
{
523
271
  S(UNION,match_bin_data) *data = user;
524
271
  struct isl_hash_table_entry *entry2;
525
271
  isl_space *space;
526
271
  PART *part2;
527
271
528
271
  space = FN(PART,get_space)(part);
529
271
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
530
271
  isl_space_free(space);
531
271
  if (!entry2)
532
0
    goto error;
533
271
  if (entry2 == isl_hash_table_entry_none) {
534
0
    FN(PART,free)(part);
535
0
    return isl_stat_ok;
536
0
  }
537
271
538
271
  part2 = entry2->data;
539
271
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
540
271
          part2->dim, isl_dim_out))
541
271
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
542
271
      "entries should have the same range space",
543
271
      goto error);
544
271
545
271
  part = data->fn(part, FN(PART, copy)(entry2->data));
546
271
547
271
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
548
271
  if (!data->res)
549
0
    return isl_stat_error;
550
271
551
271
  return isl_stat_ok;
552
271
error:
553
0
  FN(PART,free)(part);
554
0
  return isl_stat_error;
555
271
}
isl_aff.c:isl_union_pw_aff_match_bin_entry
Line
Count
Source
522
271
{
523
271
  S(UNION,match_bin_data) *data = user;
524
271
  struct isl_hash_table_entry *entry2;
525
271
  isl_space *space;
526
271
  PART *part2;
527
271
528
271
  space = FN(PART,get_space)(part);
529
271
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
530
271
  isl_space_free(space);
531
271
  if (!entry2)
532
0
    goto error;
533
271
  if (entry2 == isl_hash_table_entry_none) {
534
0
    FN(PART,free)(part);
535
0
    return isl_stat_ok;
536
0
  }
537
271
538
271
  part2 = entry2->data;
539
271
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
540
271
          part2->dim, isl_dim_out))
541
271
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
542
271
      "entries should have the same range space",
543
271
      goto error);
544
271
545
271
  part = data->fn(part, FN(PART, copy)(entry2->data));
546
271
547
271
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
548
271
  if (!data->res)
549
0
    return isl_stat_error;
550
271
551
271
  return isl_stat_ok;
552
271
error:
553
0
  FN(PART,free)(part);
554
0
  return isl_stat_error;
555
271
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_match_bin_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_bin_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_match_bin_entry
556
557
/* This function is currently only used from isl_polynomial.c
558
 * and not from isl_fold.c.
559
 */
560
static __isl_give UNION *FN(UNION,match_bin_op)(__isl_take UNION *u1,
561
  __isl_take UNION *u2,
562
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *))
563
  __attribute__ ((unused));
564
/* For each pair of elements in "u1" and "u2" living in the same space,
565
 * call "fn" and collect the results.
566
 */
567
static __isl_give UNION *FN(UNION,match_bin_op)(__isl_take UNION *u1,
568
  __isl_take UNION *u2,
569
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *))
570
177
{
571
177
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
572
177
573
177
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
574
177
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
575
177
576
177
  if (!u1 || !u2)
577
0
    goto error;
578
177
579
177
  data.u2 = u2;
580
177
  data.res = FN(UNION,alloc_same_size)(u1);
581
177
  if (FN(FN(UNION,foreach),PARTS)(u1,
582
177
            &FN(UNION,match_bin_entry), &data) < 0)
583
0
    goto error;
584
177
585
177
  FN(UNION,free)(u1);
586
177
  FN(UNION,free)(u2);
587
177
  return data.res;
588
177
error:
589
0
  FN(UNION,free)(u1);
590
0
  FN(UNION,free)(u2);
591
0
  FN(UNION,free)(data.res);
592
0
  return NULL;
593
177
}
isl_aff.c:isl_union_pw_aff_match_bin_op
Line
Count
Source
570
177
{
571
177
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
572
177
573
177
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
574
177
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
575
177
576
177
  if (!u1 || !u2)
577
0
    goto error;
578
177
579
177
  data.u2 = u2;
580
177
  data.res = FN(UNION,alloc_same_size)(u1);
581
177
  if (FN(FN(UNION,foreach),PARTS)(u1,
582
177
            &FN(UNION,match_bin_entry), &data) < 0)
583
0
    goto error;
584
177
585
177
  FN(UNION,free)(u1);
586
177
  FN(UNION,free)(u2);
587
177
  return data.res;
588
177
error:
589
0
  FN(UNION,free)(u1);
590
0
  FN(UNION,free)(u2);
591
0
  FN(UNION,free)(data.res);
592
0
  return NULL;
593
177
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_match_bin_op
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_bin_op
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_match_bin_op
594
595
/* Compute the sum of "u1" and "u2".
596
 *
597
 * If the base expressions have a default zero value, then the sum
598
 * is computed on the union of the domains of "u1" and "u2".
599
 * Otherwise, it is computed on their shared domains.
600
 */
601
__isl_give UNION *FN(UNION,add)(__isl_take UNION *u1, __isl_take UNION *u2)
602
64
{
603
#if DEFAULT_IS_ZERO
604
0
  return FN(UNION,union_add_)(u1, u2);
605
#else
606
64
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
607
#endif
608
}
isl_union_pw_aff_add
Line
Count
Source
602
64
{
603
#if DEFAULT_IS_ZERO
604
  return FN(UNION,union_add_)(u1, u2);
605
#else
606
64
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
607
64
#endif
608
64
}
Unexecuted instantiation: isl_union_pw_multi_aff_add
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_add
Unexecuted instantiation: isl_union_pw_qpolynomial_add
609
610
#ifndef NO_SUB
611
/* Subtract "u2" from "u1" and return the result.
612
 */
613
__isl_give UNION *FN(UNION,sub)(__isl_take UNION *u1, __isl_take UNION *u2)
614
113
{
615
113
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
616
113
}
isl_union_pw_aff_sub
Line
Count
Source
614
113
{
615
113
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
616
113
}
Unexecuted instantiation: isl_union_pw_multi_aff_sub
Unexecuted instantiation: isl_union_pw_qpolynomial_sub
617
#endif
618
619
S(UNION,any_set_data) {
620
  isl_set *set;
621
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
622
};
623
624
static __isl_give PART *FN(UNION,any_set_entry)(__isl_take PART *part,
625
  void *user)
626
0
{
627
0
  S(UNION,any_set_data) *data = user;
628
0
629
0
  return data->fn(part, isl_set_copy(data->set));
630
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_any_set_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_any_set_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_any_set_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_any_set_entry
631
632
/* Update each element of "u" by calling "fn" on the element and "set".
633
 */
634
static __isl_give UNION *FN(UNION,any_set_op)(__isl_take UNION *u,
635
  __isl_take isl_set *set,
636
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*))
637
0
{
638
0
  S(UNION,any_set_data) data = { NULL, fn };
639
0
640
0
  u = FN(UNION,align_params)(u, isl_set_get_space(set));
641
0
  set = isl_set_align_params(set, FN(UNION,get_space)(u));
642
0
643
0
  if (!u || !set)
644
0
    goto error;
645
0
646
0
  data.set = set;
647
0
  u = FN(UNION,transform)(u, &FN(UNION,any_set_entry), &data);
648
0
  isl_set_free(set);
649
0
  return u;
650
0
error:
651
0
  FN(UNION,free)(u);
652
0
  isl_set_free(set);
653
0
  return NULL;
654
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_any_set_op
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_any_set_op
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_any_set_op
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_any_set_op
655
656
/* Intersect the domain of "u" with the parameter domain "context".
657
 */
658
__isl_give UNION *FN(UNION,intersect_params)(__isl_take UNION *u,
659
  __isl_take isl_set *set)
660
0
{
661
0
  return FN(UNION,any_set_op)(u, set, &FN(PW,intersect_params));
662
0
}
Unexecuted instantiation: isl_union_pw_aff_intersect_params
Unexecuted instantiation: isl_union_pw_multi_aff_intersect_params
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_intersect_params
Unexecuted instantiation: isl_union_pw_qpolynomial_intersect_params
663
664
/* Compute the gist of the domain of "u" with respect to
665
 * the parameter domain "context".
666
 */
667
__isl_give UNION *FN(UNION,gist_params)(__isl_take UNION *u,
668
  __isl_take isl_set *set)
669
0
{
670
0
  return FN(UNION,any_set_op)(u, set, &FN(PW,gist_params));
671
0
}
Unexecuted instantiation: isl_union_pw_aff_gist_params
Unexecuted instantiation: isl_union_pw_multi_aff_gist_params
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_gist_params
Unexecuted instantiation: isl_union_pw_qpolynomial_gist_params
672
673
S(UNION,match_domain_data) {
674
  isl_union_set *uset;
675
  UNION *res;
676
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
677
};
678
679
static int FN(UNION,set_has_dim)(const void *entry, const void *val)
680
78
{
681
78
  isl_set *set = (isl_set *)entry;
682
78
  isl_space *dim = (isl_space *)val;
683
78
684
78
  return isl_space_is_equal(set->dim, dim);
685
78
}
isl_aff.c:isl_union_pw_aff_set_has_dim
Line
Count
Source
680
72
{
681
72
  isl_set *set = (isl_set *)entry;
682
72
  isl_space *dim = (isl_space *)val;
683
72
684
72
  return isl_space_is_equal(set->dim, dim);
685
72
}
isl_aff.c:isl_union_pw_multi_aff_set_has_dim
Line
Count
Source
680
6
{
681
6
  isl_set *set = (isl_set *)entry;
682
6
  isl_space *dim = (isl_space *)val;
683
6
684
6
  return isl_space_is_equal(set->dim, dim);
685
6
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_set_has_dim
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_set_has_dim
686
687
/* Find the set in data->uset that lives in the same space as the domain
688
 * of "part", apply data->fn to *entry and this set (if any), and add
689
 * the result to data->res.
690
 */
691
static isl_stat FN(UNION,match_domain_entry)(__isl_take PART *part, void *user)
692
129
{
693
129
  S(UNION,match_domain_data) *data = user;
694
129
  uint32_t hash;
695
129
  struct isl_hash_table_entry *entry2;
696
129
  isl_space *space;
697
129
698
129
  space = FN(PART,get_domain_space)(part);
699
129
  hash = isl_space_get_hash(space);
700
129
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
129
             hash, &FN(UNION,set_has_dim), space, 0);
702
129
  isl_space_free(space);
703
129
  if (!entry2) {
704
51
    FN(PART,free)(part);
705
51
    return isl_stat_ok;
706
51
  }
707
78
708
78
  part = data->fn(part, isl_set_copy(entry2->data));
709
78
710
78
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
78
  if (!data->res)
712
0
    return isl_stat_error;
713
78
714
78
  return isl_stat_ok;
715
78
}
isl_aff.c:isl_union_pw_aff_match_domain_entry
Line
Count
Source
692
123
{
693
123
  S(UNION,match_domain_data) *data = user;
694
123
  uint32_t hash;
695
123
  struct isl_hash_table_entry *entry2;
696
123
  isl_space *space;
697
123
698
123
  space = FN(PART,get_domain_space)(part);
699
123
  hash = isl_space_get_hash(space);
700
123
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
123
             hash, &FN(UNION,set_has_dim), space, 0);
702
123
  isl_space_free(space);
703
123
  if (!entry2) {
704
51
    FN(PART,free)(part);
705
51
    return isl_stat_ok;
706
51
  }
707
72
708
72
  part = data->fn(part, isl_set_copy(entry2->data));
709
72
710
72
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
72
  if (!data->res)
712
0
    return isl_stat_error;
713
72
714
72
  return isl_stat_ok;
715
72
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_entry
Line
Count
Source
692
6
{
693
6
  S(UNION,match_domain_data) *data = user;
694
6
  uint32_t hash;
695
6
  struct isl_hash_table_entry *entry2;
696
6
  isl_space *space;
697
6
698
6
  space = FN(PART,get_domain_space)(part);
699
6
  hash = isl_space_get_hash(space);
700
6
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
6
             hash, &FN(UNION,set_has_dim), space, 0);
702
6
  isl_space_free(space);
703
6
  if (!entry2) {
704
0
    FN(PART,free)(part);
705
0
    return isl_stat_ok;
706
0
  }
707
6
708
6
  part = data->fn(part, isl_set_copy(entry2->data));
709
6
710
6
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
6
  if (!data->res)
712
0
    return isl_stat_error;
713
6
714
6
  return isl_stat_ok;
715
6
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_domain_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_match_domain_entry
716
717
/* Apply fn to each pair of PW in u and set in uset such that
718
 * the set lives in the same space as the domain of PW
719
 * and collect the results.
720
 */
721
static __isl_give UNION *FN(UNION,match_domain_op)(__isl_take UNION *u,
722
  __isl_take isl_union_set *uset,
723
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*))
724
69
{
725
69
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
69
727
69
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
69
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
69
730
69
  if (!u || !uset)
731
0
    goto error;
732
69
733
69
  data.uset = uset;
734
69
  data.res = FN(UNION,alloc_same_size)(u);
735
69
  if (FN(FN(UNION,foreach),PARTS)(u,
736
69
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
69
739
69
  FN(UNION,free)(u);
740
69
  isl_union_set_free(uset);
741
69
  return data.res;
742
69
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
69
}
isl_aff.c:isl_union_pw_aff_match_domain_op
Line
Count
Source
724
63
{
725
63
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
63
727
63
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
63
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
63
730
63
  if (!u || !uset)
731
0
    goto error;
732
63
733
63
  data.uset = uset;
734
63
  data.res = FN(UNION,alloc_same_size)(u);
735
63
  if (FN(FN(UNION,foreach),PARTS)(u,
736
63
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
63
739
63
  FN(UNION,free)(u);
740
63
  isl_union_set_free(uset);
741
63
  return data.res;
742
63
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
63
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_op
Line
Count
Source
724
6
{
725
6
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
6
727
6
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
6
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
6
730
6
  if (!u || !uset)
731
0
    goto error;
732
6
733
6
  data.uset = uset;
734
6
  data.res = FN(UNION,alloc_same_size)(u);
735
6
  if (FN(FN(UNION,foreach),PARTS)(u,
736
6
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
6
739
6
  FN(UNION,free)(u);
740
6
  isl_union_set_free(uset);
741
6
  return data.res;
742
6
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
6
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_domain_op
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_match_domain_op
748
749
/* Intersect the domain of "u" with "uset".
750
 * If "uset" is a parameters domain, then intersect the parameter
751
 * domain of "u" with this set.
752
 */
753
__isl_give UNION *FN(UNION,intersect_domain)(__isl_take UNION *u,
754
  __isl_take isl_union_set *uset)
755
6
{
756
6
  if (isl_union_set_is_params(uset))
757
0
    return FN(UNION,intersect_params)(u,
758
0
            isl_set_from_union_set(uset));
759
6
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
760
6
}
Unexecuted instantiation: isl_union_pw_aff_intersect_domain
isl_union_pw_multi_aff_intersect_domain
Line
Count
Source
755
6
{
756
6
  if (isl_union_set_is_params(uset))
757
0
    return FN(UNION,intersect_params)(u,
758
0
            isl_set_from_union_set(uset));
759
6
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
760
6
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_intersect_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_intersect_domain
761
762
/* Take the set (which may be empty) in data->uset that lives
763
 * in the same space as the domain of "pw", subtract it from the domain
764
 * of "part" and return the result.
765
 */
766
static __isl_give PART *FN(UNION,subtract_domain_entry)(__isl_take PART *part,
767
  void *user)
768
0
{
769
0
  isl_union_set *uset = user;
770
0
  isl_space *space;
771
0
  isl_set *set;
772
0
773
0
  space = FN(PART,get_domain_space)(part);
774
0
  set = isl_union_set_extract_set(uset, space);
775
0
  return FN(PART,subtract_domain)(part, set);
776
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_subtract_domain_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_subtract_domain_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_subtract_domain_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_subtract_domain_entry
777
778
/* Subtract "uset' from the domain of "u".
779
 */
780
__isl_give UNION *FN(UNION,subtract_domain)(__isl_take UNION *u,
781
  __isl_take isl_union_set *uset)
782
0
{
783
0
  u = FN(UNION,transform)(u, &FN(UNION,subtract_domain_entry), uset);
784
0
  isl_union_set_free(uset);
785
0
  return u;
786
0
}
Unexecuted instantiation: isl_union_pw_aff_subtract_domain
Unexecuted instantiation: isl_union_pw_multi_aff_subtract_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_subtract_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_subtract_domain
787
788
__isl_give UNION *FN(UNION,gist)(__isl_take UNION *u,
789
  __isl_take isl_union_set *uset)
790
63
{
791
63
  if (isl_union_set_is_params(uset))
792
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
793
63
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
794
63
}
isl_union_pw_aff_gist
Line
Count
Source
790
63
{
791
63
  if (isl_union_set_is_params(uset))
792
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
793
63
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
794
63
}
Unexecuted instantiation: isl_union_pw_multi_aff_gist
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_gist
Unexecuted instantiation: isl_union_pw_qpolynomial_gist
795
796
/* Coalesce an entry in a UNION.  Coalescing is performed in-place.
797
 * Since the UNION may have several references, the entry is only
798
 * replaced if the coalescing is successful.
799
 */
800
static isl_stat FN(UNION,coalesce_entry)(void **entry, void *user)
801
0
{
802
0
  PART **part_p = (PART **) entry;
803
0
  PART *part;
804
0
805
0
  part = FN(PART,copy)(*part_p);
806
0
  part = FN(PW,coalesce)(part);
807
0
  if (!part)
808
0
    return isl_stat_error;
809
0
  FN(PART,free)(*part_p);
810
0
  *part_p = part;
811
0
812
0
  return isl_stat_ok;
813
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_coalesce_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_coalesce_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_coalesce_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_coalesce_entry
814
815
__isl_give UNION *FN(UNION,coalesce)(__isl_take UNION *u)
816
0
{
817
0
  if (FN(UNION,foreach_inplace)(u, &FN(UNION,coalesce_entry), NULL) < 0)
818
0
    goto error;
819
0
820
0
  return u;
821
0
error:
822
0
  FN(UNION,free)(u);
823
0
  return NULL;
824
0
}
Unexecuted instantiation: isl_union_pw_aff_coalesce
Unexecuted instantiation: isl_union_pw_multi_aff_coalesce
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_coalesce
Unexecuted instantiation: isl_union_pw_qpolynomial_coalesce
825
826
static isl_stat FN(UNION,domain_entry)(__isl_take PART *part, void *user)
827
3.16k
{
828
3.16k
  isl_union_set **uset = (isl_union_set **)user;
829
3.16k
830
3.16k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
831
3.16k
832
3.16k
  return isl_stat_ok;
833
3.16k
}
isl_aff.c:isl_union_pw_aff_domain_entry
Line
Count
Source
827
3.16k
{
828
3.16k
  isl_union_set **uset = (isl_union_set **)user;
829
3.16k
830
3.16k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
831
3.16k
832
3.16k
  return isl_stat_ok;
833
3.16k
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_domain_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_domain_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_domain_entry
834
835
__isl_give isl_union_set *FN(UNION,domain)(__isl_take UNION *u)
836
1.96k
{
837
1.96k
  isl_union_set *uset;
838
1.96k
839
1.96k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
840
1.96k
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
841
0
    goto error;
842
1.96k
843
1.96k
  FN(UNION,free)(u);
844
1.96k
  
845
1.96k
  return uset;
846
1.96k
error:
847
0
  isl_union_set_free(uset);
848
0
  FN(UNION,free)(u);
849
0
  return NULL;
850
1.96k
}
isl_union_pw_aff_domain
Line
Count
Source
836
1.96k
{
837
1.96k
  isl_union_set *uset;
838
1.96k
839
1.96k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
840
1.96k
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
841
0
    goto error;
842
1.96k
843
1.96k
  FN(UNION,free)(u);
844
1.96k
  
845
1.96k
  return uset;
846
1.96k
error:
847
0
  isl_union_set_free(uset);
848
0
  FN(UNION,free)(u);
849
0
  return NULL;
850
1.96k
}
Unexecuted instantiation: isl_union_pw_multi_aff_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_domain
851
852
#ifdef HAS_TYPE
853
/* Negate the type of "u".
854
 */
855
static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u)
856
0
{
857
0
  u = FN(UNION,cow)(u);
858
0
  if (!u)
859
0
    return NULL;
860
0
  u->type = isl_fold_type_negate(u->type);
861
0
  return u;
862
0
}
863
#else
864
/* Negate the type of "u".
865
 * Since "u" does not have a type, do nothing.
866
 */
867
static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u)
868
0
{
869
0
  return u;
870
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_negate_type
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_negate_type
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_negate_type
871
#endif
872
873
static __isl_give PART *FN(UNION,mul_isl_int_entry)(__isl_take PART *part,
874
  void *user)
875
0
{
876
0
  isl_int *v = user;
877
0
878
0
  return FN(PW,mul_isl_int)(part, *v);
879
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_mul_isl_int_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_mul_isl_int_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_mul_isl_int_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_mul_isl_int_entry
880
881
__isl_give UNION *FN(UNION,mul_isl_int)(__isl_take UNION *u, isl_int v)
882
0
{
883
0
  if (isl_int_is_one(v))
884
0
    return u;
885
0
886
0
  if (DEFAULT_IS_ZERO && u && isl_int_is_zero(v)) {
887
0
    UNION *zero;
888
0
    isl_space *dim = FN(UNION,get_space)(u);
889
#ifdef HAS_TYPE
890
0
    zero = FN(UNION,ZERO)(dim, u->type);
891
#else
892
0
    zero = FN(UNION,ZERO)(dim);
893
#endif
894
0
    FN(UNION,free)(u);
895
0
    return zero;
896
0
  }
897
0
898
0
  u = FN(UNION,transform_inplace)(u, &FN(UNION,mul_isl_int_entry), &v);
899
0
  if (isl_int_is_neg(v))
900
0
    u = FN(UNION,negate_type)(u);
901
0
902
0
  return u;
903
0
}
Unexecuted instantiation: isl_union_pw_aff_mul_isl_int
Unexecuted instantiation: isl_union_pw_multi_aff_mul_isl_int
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_mul_isl_int
Unexecuted instantiation: isl_union_pw_qpolynomial_mul_isl_int
904
905
/* Multiply "part" by the isl_val "user" and return the result.
906
 */
907
static __isl_give PART *FN(UNION,scale_val_entry)(__isl_take PART *part,
908
  void *user)
909
56
{
910
56
  isl_val *v = user;
911
56
912
56
  return FN(PART,scale_val)(part, isl_val_copy(v));
913
56
}
isl_aff.c:isl_union_pw_aff_scale_val_entry
Line
Count
Source
909
56
{
910
56
  isl_val *v = user;
911
56
912
56
  return FN(PART,scale_val)(part, isl_val_copy(v));
913
56
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_scale_val_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_scale_val_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_scale_val_entry
914
915
/* Multiply "u" by "v" and return the result.
916
 */
917
__isl_give UNION *FN(UNION,scale_val)(__isl_take UNION *u,
918
  __isl_take isl_val *v)
919
65
{
920
65
  if (!u || !v)
921
0
    goto error;
922
65
  if (isl_val_is_one(v)) {
923
9
    isl_val_free(v);
924
9
    return u;
925
9
  }
926
56
927
56
  if (DEFAULT_IS_ZERO && 
u0
&&
isl_val_is_zero(v)0
) {
928
0
    UNION *zero;
929
0
    isl_space *space = FN(UNION,get_space)(u);
930
#ifdef HAS_TYPE
931
0
    zero = FN(UNION,ZERO)(space, u->type);
932
#else
933
0
    zero = FN(UNION,ZERO)(space);
934
#endif
935
0
    FN(UNION,free)(u);
936
0
    isl_val_free(v);
937
0
    return zero;
938
0
  }
939
56
940
56
  if (!isl_val_is_rat(v))
941
56
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
942
56
      "expecting rational factor", goto error);
943
56
944
56
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
945
56
  if (isl_val_is_neg(v))
946
0
    u = FN(UNION,negate_type)(u);
947
56
948
56
  isl_val_free(v);
949
56
  return u;
950
56
error:
951
0
  isl_val_free(v);
952
0
  FN(UNION,free)(u);
953
0
  return NULL;
954
65
}
isl_union_pw_aff_scale_val
Line
Count
Source
919
65
{
920
65
  if (!u || !v)
921
0
    goto error;
922
65
  if (isl_val_is_one(v)) {
923
9
    isl_val_free(v);
924
9
    return u;
925
9
  }
926
56
927
56
  if (DEFAULT_IS_ZERO && 
u0
&&
isl_val_is_zero(v)0
) {
928
0
    UNION *zero;
929
0
    isl_space *space = FN(UNION,get_space)(u);
930
#ifdef HAS_TYPE
931
    zero = FN(UNION,ZERO)(space, u->type);
932
#else
933
0
    zero = FN(UNION,ZERO)(space);
934
0
#endif
935
0
    FN(UNION,free)(u);
936
0
    isl_val_free(v);
937
0
    return zero;
938
0
  }
939
56
940
56
  if (!isl_val_is_rat(v))
941
56
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
942
56
      "expecting rational factor", goto error);
943
56
944
56
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
945
56
  if (isl_val_is_neg(v))
946
0
    u = FN(UNION,negate_type)(u);
947
56
948
56
  isl_val_free(v);
949
56
  return u;
950
56
error:
951
0
  isl_val_free(v);
952
0
  FN(UNION,free)(u);
953
0
  return NULL;
954
65
}
Unexecuted instantiation: isl_union_pw_multi_aff_scale_val
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_scale_val
Unexecuted instantiation: isl_union_pw_qpolynomial_scale_val
955
956
/* Divide "part" by the isl_val "user" and return the result.
957
 */
958
static __isl_give PART *FN(UNION,scale_down_val_entry)(__isl_take PART *part,
959
  void *user)
960
56
{
961
56
  isl_val *v = user;
962
56
963
56
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
964
56
}
isl_aff.c:isl_union_pw_aff_scale_down_val_entry
Line
Count
Source
960
56
{
961
56
  isl_val *v = user;
962
56
963
56
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
964
56
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_scale_down_val_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_scale_down_val_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_scale_down_val_entry
965
966
/* Divide "u" by "v" and return the result.
967
 */
968
__isl_give UNION *FN(UNION,scale_down_val)(__isl_take UNION *u,
969
  __isl_take isl_val *v)
970
65
{
971
65
  if (!u || !v)
972
0
    goto error;
973
65
  if (isl_val_is_one(v)) {
974
9
    isl_val_free(v);
975
9
    return u;
976
9
  }
977
56
978
56
  if (!isl_val_is_rat(v))
979
56
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
980
56
      "expecting rational factor", goto error);
981
56
  if (isl_val_is_zero(v))
982
56
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
983
56
      "cannot scale down by zero", goto error);
984
56
985
56
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
986
56
  if (isl_val_is_neg(v))
987
0
    u = FN(UNION,negate_type)(u);
988
56
989
56
  isl_val_free(v);
990
56
  return u;
991
56
error:
992
0
  isl_val_free(v);
993
0
  FN(UNION,free)(u);
994
0
  return NULL;
995
65
}
isl_union_pw_aff_scale_down_val
Line
Count
Source
970
65
{
971
65
  if (!u || !v)
972
0
    goto error;
973
65
  if (isl_val_is_one(v)) {
974
9
    isl_val_free(v);
975
9
    return u;
976
9
  }
977
56
978
56
  if (!isl_val_is_rat(v))
979
56
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
980
56
      "expecting rational factor", goto error);
981
56
  if (isl_val_is_zero(v))
982
56
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
983
56
      "cannot scale down by zero", goto error);
984
56
985
56
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
986
56
  if (isl_val_is_neg(v))
987
0
    u = FN(UNION,negate_type)(u);
988
56
989
56
  isl_val_free(v);
990
56
  return u;
991
56
error:
992
0
  isl_val_free(v);
993
0
  FN(UNION,free)(u);
994
0
  return NULL;
995
65
}
Unexecuted instantiation: isl_union_pw_multi_aff_scale_down_val
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_scale_down_val
Unexecuted instantiation: isl_union_pw_qpolynomial_scale_down_val
996
997
S(UNION,plain_is_equal_data)
998
{
999
  UNION *u2;
1000
  isl_bool is_equal;
1001
};
1002
1003
static isl_stat FN(UNION,plain_is_equal_entry)(void **entry, void *user)
1004
0
{
1005
0
  S(UNION,plain_is_equal_data) *data = user;
1006
0
  struct isl_hash_table_entry *entry2;
1007
0
  PW *pw = *entry;
1008
0
1009
0
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
1010
0
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
1011
0
    if (!entry2)
1012
0
      data->is_equal = isl_bool_error;
1013
0
    else
1014
0
      data->is_equal = isl_bool_false;
1015
0
    return isl_stat_error;
1016
0
  }
1017
0
1018
0
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
1019
0
  if (data->is_equal < 0 || !data->is_equal)
1020
0
    return isl_stat_error;
1021
0
1022
0
  return isl_stat_ok;
1023
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_plain_is_equal_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_plain_is_equal_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_plain_is_equal_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_plain_is_equal_entry
1024
1025
isl_bool FN(UNION,plain_is_equal)(__isl_keep UNION *u1, __isl_keep UNION *u2)
1026
0
{
1027
0
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
1028
0
  int n1, n2;
1029
0
1030
0
  if (!u1 || !u2)
1031
0
    return isl_bool_error;
1032
0
  if (u1 == u2)
1033
0
    return isl_bool_true;
1034
0
  if (u1->table.n != u2->table.n)
1035
0
    return isl_bool_false;
1036
0
  n1 = FN(FN(UNION,n),PARTS)(u1);
1037
0
  n2 = FN(FN(UNION,n),PARTS)(u2);
1038
0
  if (n1 < 0 || n2 < 0)
1039
0
    return isl_bool_error;
1040
0
  if (n1 != n2)
1041
0
    return isl_bool_false;
1042
0
1043
0
  u1 = FN(UNION,copy)(u1);
1044
0
  u2 = FN(UNION,copy)(u2);
1045
0
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1046
0
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1047
0
  if (!u1 || !u2)
1048
0
    goto error;
1049
0
1050
0
  data.u2 = u2;
1051
0
  if (FN(UNION,foreach_inplace)(u1,
1052
0
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1053
0
      data.is_equal)
1054
0
    goto error;
1055
0
1056
0
  FN(UNION,free)(u1);
1057
0
  FN(UNION,free)(u2);
1058
0
1059
0
  return data.is_equal;
1060
0
error:
1061
0
  FN(UNION,free)(u1);
1062
0
  FN(UNION,free)(u2);
1063
0
  return isl_bool_error;
1064
0
}
Unexecuted instantiation: isl_union_pw_aff_plain_is_equal
Unexecuted instantiation: isl_union_pw_multi_aff_plain_is_equal
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_plain_is_equal
Unexecuted instantiation: isl_union_pw_qpolynomial_plain_is_equal
1065
1066
/* Check whether the element that "entry" points to involves any NaNs and
1067
 * store the result in *nan.
1068
 * Abort as soon as one such element has been found.
1069
 */
1070
static isl_stat FN(UNION,involves_nan_entry)(void **entry, void *user)
1071
0
{
1072
0
  isl_bool *nan = user;
1073
0
  PW *pw = *entry;
1074
0
1075
0
  *nan = FN(PW,involves_nan)(pw);
1076
0
  if (*nan < 0 || !nan)
1077
0
    return isl_stat_error;
1078
0
1079
0
  return isl_stat_ok;
1080
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_involves_nan_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_involves_nan_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_involves_nan_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_involves_nan_entry
1081
1082
/* Does "u" involve any NaNs?
1083
 */
1084
isl_bool FN(UNION,involves_nan)(__isl_keep UNION *u)
1085
0
{
1086
0
  isl_bool nan = isl_bool_false;
1087
0
1088
0
  if (!u)
1089
0
    return isl_bool_error;
1090
0
1091
0
  if (FN(UNION,foreach_inplace)(u,
1092
0
            &FN(UNION,involves_nan_entry), &nan) < 0 &&
1093
0
      !nan)
1094
0
    return isl_bool_error;
1095
0
1096
0
  return nan;
1097
0
}
Unexecuted instantiation: isl_union_pw_aff_involves_nan
Unexecuted instantiation: isl_union_pw_multi_aff_involves_nan
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_involves_nan
Unexecuted instantiation: isl_union_pw_qpolynomial_involves_nan
1098
1099
/* Internal data structure for isl_union_*_drop_dims.
1100
 * type, first and n are passed to isl_*_drop_dims.
1101
 */
1102
S(UNION,drop_dims_data) {
1103
  enum isl_dim_type type;
1104
  unsigned first;
1105
  unsigned n;
1106
};
1107
1108
/* Drop the parameters specified by "data" from "part" and return the result.
1109
 */
1110
static __isl_give PART *FN(UNION,drop_dims_entry)(__isl_take PART *part,
1111
  void *user)
1112
0
{
1113
0
  S(UNION,drop_dims_data) *data = user;
1114
0
1115
0
  return FN(PART,drop_dims)(part, data->type, data->first, data->n);
1116
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_drop_dims_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_drop_dims_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_drop_dims_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_drop_dims_entry
1117
1118
/* Drop the specified parameters from "u".
1119
 * That is, type is required to be isl_dim_param.
1120
 */
1121
__isl_give UNION *FN(UNION,drop_dims)( __isl_take UNION *u,
1122
  enum isl_dim_type type, unsigned first, unsigned n)
1123
0
{
1124
0
  isl_space *space;
1125
0
  S(UNION,drop_dims_data) data = { type, first, n };
1126
0
1127
0
  if (!u)
1128
0
    return NULL;
1129
0
1130
0
  if (type != isl_dim_param)
1131
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
1132
0
      "can only project out parameters",
1133
0
      return FN(UNION,free)(u));
1134
0
1135
0
  space = FN(UNION,get_space)(u);
1136
0
  space = isl_space_drop_dims(space, type, first, n);
1137
0
  return FN(UNION,transform_space)(u, space, &FN(UNION,drop_dims_entry),
1138
0
          &data);
1139
0
}
Unexecuted instantiation: isl_union_pw_aff_drop_dims
Unexecuted instantiation: isl_union_pw_multi_aff_drop_dims
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_drop_dims
Unexecuted instantiation: isl_union_pw_qpolynomial_drop_dims
1140
1141
/* Internal data structure for isl_union_*_set_dim_name.
1142
 * pos is the position of the parameter that needs to be renamed.
1143
 * s is the new name.
1144
 */
1145
S(UNION,set_dim_name_data) {
1146
  unsigned pos;
1147
  const char *s;
1148
};
1149
1150
/* Change the name of the parameter at position data->pos of "part" to data->s
1151
 * and return the result.
1152
 */
1153
static __isl_give PART *FN(UNION,set_dim_name_entry)(__isl_take PART *part,
1154
  void *user)
1155
0
{
1156
0
  S(UNION,set_dim_name_data) *data = user;
1157
0
1158
0
  return FN(PART,set_dim_name)(part, isl_dim_param, data->pos, data->s);
1159
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_set_dim_name_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_set_dim_name_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_set_dim_name_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_set_dim_name_entry
1160
1161
/* Change the name of the parameter at position "pos" to "s".
1162
 * That is, type is required to be isl_dim_param.
1163
 */
1164
__isl_give UNION *FN(UNION,set_dim_name)(__isl_take UNION *u,
1165
  enum isl_dim_type type, unsigned pos, const char *s)
1166
0
{
1167
0
  S(UNION,set_dim_name_data) data = { pos, s };
1168
0
  isl_space *space;
1169
0
1170
0
  if (!u)
1171
0
    return NULL;
1172
0
1173
0
  if (type != isl_dim_param)
1174
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
1175
0
      "can only set parameter names",
1176
0
      return FN(UNION,free)(u));
1177
0
1178
0
  space = FN(UNION,get_space)(u);
1179
0
  space = isl_space_set_dim_name(space, type, pos, s);
1180
0
  return FN(UNION,transform_space)(u, space,
1181
0
          &FN(UNION,set_dim_name_entry), &data);
1182
0
}
Unexecuted instantiation: isl_union_pw_aff_set_dim_name
Unexecuted instantiation: isl_union_pw_multi_aff_set_dim_name
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_set_dim_name
Unexecuted instantiation: isl_union_pw_qpolynomial_set_dim_name
1183
1184
/* Reset the user pointer on all identifiers of parameters and tuples
1185
 * of the space of "part" and return the result.
1186
 */
1187
static __isl_give PART *FN(UNION,reset_user_entry)(__isl_take PART *part,
1188
  void *user)
1189
0
{
1190
0
  return FN(PART,reset_user)(part);
1191
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_reset_user_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_reset_user_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_reset_user_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_reset_user_entry
1192
1193
/* Reset the user pointer on all identifiers of parameters and tuples
1194
 * of the spaces of "u".
1195
 */
1196
__isl_give UNION *FN(UNION,reset_user)(__isl_take UNION *u)
1197
0
{
1198
0
  isl_space *space;
1199
0
1200
0
  space = FN(UNION,get_space)(u);
1201
0
  space = isl_space_reset_user(space);
1202
0
  return FN(UNION,transform_space)(u, space, &FN(UNION,reset_user_entry),
1203
0
          NULL);
1204
0
}
Unexecuted instantiation: isl_union_pw_aff_reset_user
Unexecuted instantiation: isl_union_pw_multi_aff_reset_user
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_reset_user
Unexecuted instantiation: isl_union_pw_qpolynomial_reset_user