Coverage Report

Created: 2019-07-24 05:18

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