Coverage Report

Created: 2018-04-23 18:20

/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
45.9k
{
17
45.9k
  return u ? u->space->ctx : NULL;
18
45.9k
}
isl_union_pw_aff_get_ctx
Line
Count
Source
16
18.2k
{
17
18.2k
  return u ? u->space->ctx : NULL;
18
18.2k
}
isl_union_pw_multi_aff_get_ctx
Line
Count
Source
16
27.6k
{
17
27.6k
  return u ? u->space->ctx : NULL;
18
27.6k
}
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
91.1k
{
24
91.1k
  if (!u)
25
0
    return NULL;
26
91.1k
  return u->space;
27
91.1k
}
isl_aff.c:isl_union_pw_aff_peek_space
Line
Count
Source
23
63.8k
{
24
63.8k
  if (!u)
25
0
    return NULL;
26
63.8k
  return u->space;
27
63.8k
}
isl_aff.c:isl_union_pw_multi_aff_peek_space
Line
Count
Source
23
27.2k
{
24
27.2k
  if (!u)
25
0
    return NULL;
26
27.2k
  return u->space;
27
27.2k
}
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
91.1k
{
33
91.1k
  return isl_space_copy(FN(UNION,peek_space)(u));
34
91.1k
}
isl_union_pw_aff_get_space
Line
Count
Source
32
63.8k
{
33
63.8k
  return isl_space_copy(FN(UNION,peek_space)(u));
34
63.8k
}
isl_union_pw_multi_aff_get_space
Line
Count
Source
32
27.2k
{
33
27.2k
  return isl_space_copy(FN(UNION,peek_space)(u));
34
27.2k
}
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
20.6k
{
70
20.6k
  UNION *u;
71
20.6k
72
20.6k
  dim = isl_space_params(dim);
73
20.6k
  if (!dim)
74
0
    return NULL;
75
20.6k
76
20.6k
  u = isl_calloc_type(dim->ctx, UNION);
77
20.6k
  if (!u)
78
0
    goto error;
79
20.6k
80
20.6k
  u->ref = 1;
81
#ifdef HAS_TYPE
82
  u->type = type;
83
#endif
84
  u->space = dim;
85
20.6k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
86
0
    return FN(UNION,free)(u);
87
20.6k
88
20.6k
  return u;
89
20.6k
error:
90
0
  isl_space_free(dim);
91
0
  return NULL;
92
20.6k
}
isl_aff.c:isl_union_pw_aff_alloc
Line
Count
Source
69
8.24k
{
70
8.24k
  UNION *u;
71
8.24k
72
8.24k
  dim = isl_space_params(dim);
73
8.24k
  if (!dim)
74
0
    return NULL;
75
8.24k
76
8.24k
  u = isl_calloc_type(dim->ctx, UNION);
77
8.24k
  if (!u)
78
0
    goto error;
79
8.24k
80
8.24k
  u->ref = 1;
81
#ifdef HAS_TYPE
82
  u->type = type;
83
#endif
84
  u->space = dim;
85
8.24k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
86
0
    return FN(UNION,free)(u);
87
8.24k
88
8.24k
  return u;
89
8.24k
error:
90
0
  isl_space_free(dim);
91
0
  return NULL;
92
8.24k
}
isl_aff.c:isl_union_pw_multi_aff_alloc
Line
Count
Source
69
12.4k
{
70
12.4k
  UNION *u;
71
12.4k
72
12.4k
  dim = isl_space_params(dim);
73
12.4k
  if (!dim)
74
0
    return NULL;
75
12.4k
76
12.4k
  u = isl_calloc_type(dim->ctx, UNION);
77
12.4k
  if (!u)
78
0
    goto error;
79
12.4k
80
12.4k
  u->ref = 1;
81
#ifdef HAS_TYPE
82
  u->type = type;
83
#endif
84
  u->space = dim;
85
12.4k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
86
0
    return FN(UNION,free)(u);
87
12.4k
88
12.4k
  return u;
89
12.4k
error:
90
0
  isl_space_free(dim);
91
0
  return NULL;
92
12.4k
}
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
12.8k
{
102
12.8k
  return FN(UNION,alloc)(dim, 16);
103
12.8k
}
isl_union_pw_aff_empty
Line
Count
Source
101
3.11k
{
102
3.11k
  return FN(UNION,alloc)(dim, 16);
103
3.11k
}
isl_union_pw_multi_aff_empty
Line
Count
Source
101
9.77k
{
102
9.77k
  return FN(UNION,alloc)(dim, 16);
103
9.77k
}
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
34.6k
{
108
34.6k
  if (!u)
109
0
    return NULL;
110
34.6k
111
34.6k
  u->ref++;
112
34.6k
  return u;
113
34.6k
}
isl_union_pw_aff_copy
Line
Count
Source
107
26.1k
{
108
26.1k
  if (!u)
109
0
    return NULL;
110
26.1k
111
26.1k
  u->ref++;
112
26.1k
  return u;
113
26.1k
}
isl_union_pw_multi_aff_copy
Line
Count
Source
107
8.52k
{
108
8.52k
  if (!u)
109
0
    return NULL;
110
8.52k
111
8.52k
  u->ref++;
112
8.52k
  return u;
113
8.52k
}
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),PARTS)(__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
30.5k
{
153
30.5k
  int empty;
154
30.5k
  struct isl_hash_table_entry *entry;
155
30.5k
156
30.5k
  if (!part)
157
0
    goto error;
158
30.5k
159
30.5k
  empty = FN(PART,IS_ZERO)(part);
160
30.5k
  if (empty < 0)
161
0
    goto error;
162
30.5k
  if (empty) {
163
1
    FN(PART,free)(part);
164
1
    return u;
165
1
  }
166
30.5k
167
30.5k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
168
30.5k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
169
30.5k
170
30.5k
  u = FN(UNION,cow)(u);
171
30.5k
172
30.5k
  if (!u)
173
0
    goto error;
174
30.5k
175
30.5k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
176
1
    goto error;
177
30.5k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
178
30.5k
  if (!entry)
179
0
    goto error;
180
30.5k
181
30.5k
  if (!entry->data)
182
30.5k
    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
30.5k
199
30.5k
  return u;
200
30.5k
error:
201
1
  FN(PART,free)(part);
202
1
  FN(UNION,free)(u);
203
1
  return NULL;
204
30.5k
}
isl_aff.c:isl_union_pw_aff_add_part_generic
Line
Count
Source
152
16.7k
{
153
16.7k
  int empty;
154
16.7k
  struct isl_hash_table_entry *entry;
155
16.7k
156
16.7k
  if (!part)
157
0
    goto error;
158
16.7k
159
16.7k
  empty = FN(PART,IS_ZERO)(part);
160
16.7k
  if (empty < 0)
161
0
    goto error;
162
16.7k
  if (empty) {
163
0
    FN(PART,free)(part);
164
0
    return u;
165
0
  }
166
16.7k
167
16.7k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
168
16.7k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
169
16.7k
170
16.7k
  u = FN(UNION,cow)(u);
171
16.7k
172
16.7k
  if (!u)
173
0
    goto error;
174
16.7k
175
16.7k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
176
0
    goto error;
177
16.7k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
178
16.7k
  if (!entry)
179
0
    goto error;
180
16.7k
181
16.7k
  if (!entry->data)
182
16.7k
    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
16.7k
199
16.7k
  return u;
200
16.7k
error:
201
0
  FN(PART,free)(part);
202
0
  FN(UNION,free)(u);
203
0
  return NULL;
204
16.7k
}
isl_aff.c:isl_union_pw_multi_aff_add_part_generic
Line
Count
Source
152
13.8k
{
153
13.8k
  int empty;
154
13.8k
  struct isl_hash_table_entry *entry;
155
13.8k
156
13.8k
  if (!part)
157
0
    goto error;
158
13.8k
159
13.8k
  empty = FN(PART,IS_ZERO)(part);
160
13.8k
  if (empty < 0)
161
0
    goto error;
162
13.8k
  if (empty) {
163
1
    FN(PART,free)(part);
164
1
    return u;
165
1
  }
166
13.8k
167
13.8k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
168
13.8k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
169
13.8k
170
13.8k
  u = FN(UNION,cow)(u);
171
13.8k
172
13.8k
  if (!u)
173
0
    goto error;
174
13.8k
175
13.8k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
176
1
    goto error;
177
13.8k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
178
13.8k
  if (!entry)
179
0
    goto error;
180
13.8k
181
13.8k
  if (!entry->data)
182
13.8k
    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
13.8k
199
13.8k
  return u;
200
13.8k
error:
201
1
  FN(PART,free)(part);
202
1
  FN(UNION,free)(u);
203
1
  return NULL;
204
13.8k
}
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),PARTS)(__isl_take UNION *u,
210
  __isl_take PART *part)
211
30.0k
{
212
30.0k
  return FN(UNION,add_part_generic)(u, part, 1);
213
30.0k
}
isl_union_pw_aff_add_pw_aff
Line
Count
Source
211
16.4k
{
212
16.4k
  return FN(UNION,add_part_generic)(u, part, 1);
213
16.4k
}
isl_union_pw_multi_aff_add_pw_multi_aff
Line
Count
Source
211
13.6k
{
212
13.6k
  return FN(UNION,add_part_generic)(u, part, 1);
213
13.6k
}
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
7.79k
{
235
7.79k
  if (!u)
236
0
    goto error;
237
7.79k
  return FN(UNION,alloc)(space, u->table.n);
238
7.79k
error:
239
0
  isl_space_free(space);
240
0
  return NULL;
241
7.79k
}
isl_aff.c:isl_union_pw_aff_alloc_same_size_on_space
Line
Count
Source
234
5.12k
{
235
5.12k
  if (!u)
236
0
    goto error;
237
5.12k
  return FN(UNION,alloc)(space, u->table.n);
238
5.12k
error:
239
0
  isl_space_free(space);
240
0
  return NULL;
241
5.12k
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size_on_space
Line
Count
Source
234
2.66k
{
235
2.66k
  if (!u)
236
0
    goto error;
237
2.66k
  return FN(UNION,alloc)(space, u->table.n);
238
2.66k
error:
239
0
  isl_space_free(space);
240
0
  return NULL;
241
2.66k
}
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.41k
{
249
1.41k
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
250
1.41k
}
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.28k
{
249
1.28k
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
250
1.28k
}
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
11.6k
{
268
11.6k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
269
11.6k
270
11.6k
  part = data->fn(part, data->user);
271
11.6k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
272
11.6k
  if (!data->res)
273
0
    return isl_stat_error;
274
11.6k
275
11.6k
  return isl_stat_ok;
276
11.6k
}
isl_aff.c:isl_union_pw_aff_transform_entry
Line
Count
Source
267
9.37k
{
268
9.37k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
269
9.37k
270
9.37k
  part = data->fn(part, data->user);
271
9.37k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
272
9.37k
  if (!data->res)
273
0
    return isl_stat_error;
274
9.37k
275
9.37k
  return isl_stat_ok;
276
9.37k
}
isl_aff.c:isl_union_pw_multi_aff_transform_entry
Line
Count
Source
267
2.31k
{
268
2.31k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
269
2.31k
270
2.31k
  part = data->fn(part, data->user);
271
2.31k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
272
2.31k
  if (!data->res)
273
0
    return isl_stat_error;
274
2.31k
275
2.31k
  return isl_stat_ok;
276
2.31k
}
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.38k
{
285
6.38k
  S(UNION,transform_data) data = { fn, user };
286
6.38k
287
6.38k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
288
6.38k
  if (FN(FN(UNION,foreach),PARTS)(u,
289
6.38k
          &FN(UNION,transform_entry), &data) < 0)
290
0
    data.res = FN(UNION,free)(data.res);
291
6.38k
  FN(UNION,free)(u);
292
6.38k
  return data.res;
293
6.38k
}
isl_aff.c:isl_union_pw_aff_transform_space
Line
Count
Source
284
3.84k
{
285
3.84k
  S(UNION,transform_data) data = { fn, user };
286
3.84k
287
3.84k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
288
3.84k
  if (FN(FN(UNION,foreach),PARTS)(u,
289
3.84k
          &FN(UNION,transform_entry), &data) < 0)
290
0
    data.res = FN(UNION,free)(data.res);
291
3.84k
  FN(UNION,free)(u);
292
3.84k
  return data.res;
293
3.84k
}
isl_aff.c:isl_union_pw_multi_aff_transform_space
Line
Count
Source
284
2.53k
{
285
2.53k
  S(UNION,transform_data) data = { fn, user };
286
2.53k
287
2.53k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
288
2.53k
  if (FN(FN(UNION,foreach),PARTS)(u,
289
2.53k
          &FN(UNION,transform_entry), &data) < 0)
290
0
    data.res = FN(UNION,free)(data.res);
291
2.53k
  FN(UNION,free)(u);
292
2.53k
  return data.res;
293
2.53k
}
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.20k
{
301
6.20k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
302
6.20k
}
isl_aff.c:isl_union_pw_aff_transform
Line
Count
Source
300
3.67k
{
301
3.67k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
302
3.67k
}
isl_aff.c:isl_union_pw_multi_aff_transform
Line
Count
Source
300
2.53k
{
301
2.53k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
302
2.53k
}
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
2.90k
{
326
2.90k
  isl_bool single_ref;
327
2.90k
328
2.90k
  single_ref = FN(UNION,has_single_reference)(u);
329
2.90k
  if (single_ref < 0)
330
0
    return FN(UNION,free)(u);
331
2.90k
  if (single_ref) {
332
686
    S(UNION,transform_data) data = { fn, user };
333
686
    if (FN(UNION,foreach_inplace)(u,
334
686
        &FN(UNION,transform_inplace_entry), &data) < 0)
335
0
      return FN(UNION,free)(u);
336
686
    return u;
337
686
  }
338
2.21k
  return FN(UNION,transform)(u, fn, user);
339
2.21k
}
isl_aff.c:isl_union_pw_aff_transform_inplace
Line
Count
Source
325
2.90k
{
326
2.90k
  isl_bool single_ref;
327
2.90k
328
2.90k
  single_ref = FN(UNION,has_single_reference)(u);
329
2.90k
  if (single_ref < 0)
330
0
    return FN(UNION,free)(u);
331
2.90k
  if (single_ref) {
332
686
    S(UNION,transform_data) data = { fn, user };
333
686
    if (FN(UNION,foreach_inplace)(u,
334
686
        &FN(UNION,transform_inplace_entry), &data) < 0)
335
0
      return FN(UNION,free)(u);
336
686
    return u;
337
686
  }
338
2.21k
  return FN(UNION,transform)(u, fn, user);
339
2.21k
}
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.52k
{
346
2.52k
  return part;
347
2.52k
}
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.31k
{
346
2.31k
  return part;
347
2.31k
}
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.67k
{
351
2.67k
  u = FN(UNION,copy)(u);
352
2.67k
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
353
2.67k
}
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.53k
{
351
2.53k
  u = FN(UNION,copy)(u);
352
2.53k
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
353
2.53k
}
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
31.0k
{
357
31.0k
  if (!u)
358
0
    return NULL;
359
31.0k
360
31.0k
  if (u->ref == 1)
361
28.3k
    return u;
362
2.67k
  u->ref--;
363
2.67k
  return FN(UNION,dup)(u);
364
2.67k
}
isl_union_pw_aff_cow
Line
Count
Source
356
17.0k
{
357
17.0k
  if (!u)
358
0
    return NULL;
359
17.0k
360
17.0k
  if (u->ref == 1)
361
16.9k
    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
13.9k
{
357
13.9k
  if (!u)
358
0
    return NULL;
359
13.9k
360
13.9k
  if (u->ref == 1)
361
11.3k
    return u;
362
2.53k
  u->ref--;
363
2.53k
  return FN(UNION,dup)(u);
364
2.53k
}
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
63.2k
{
368
63.2k
  if (!u)
369
10.6k
    return NULL;
370
52.6k
371
52.6k
  if (--u->ref > 0)
372
31.9k
    return NULL;
373
20.6k
374
20.6k
  isl_hash_table_foreach(u->space->ctx, &u->table,
375
20.6k
        &FN(UNION,free_u_entry), NULL);
376
20.6k
  isl_hash_table_clear(&u->table);
377
20.6k
  isl_space_free(u->space);
378
20.6k
  free(u);
379
20.6k
  return NULL;
380
20.6k
}
isl_union_pw_aff_free
Line
Count
Source
367
44.8k
{
368
44.8k
  if (!u)
369
10.6k
    return NULL;
370
34.1k
371
34.1k
  if (--u->ref > 0)
372
26.0k
    return NULL;
373
8.19k
374
8.19k
  isl_hash_table_foreach(u->space->ctx, &u->table,
375
8.19k
        &FN(UNION,free_u_entry), NULL);
376
8.19k
  isl_hash_table_clear(&u->table);
377
8.19k
  isl_space_free(u->space);
378
8.19k
  free(u);
379
8.19k
  return NULL;
380
8.19k
}
isl_union_pw_multi_aff_free
Line
Count
Source
367
18.4k
{
368
18.4k
  if (!u)
369
1
    return NULL;
370
18.4k
371
18.4k
  if (--u->ref > 0)
372
5.99k
    return NULL;
373
12.4k
374
12.4k
  isl_hash_table_foreach(u->space->ctx, &u->table,
375
12.4k
        &FN(UNION,free_u_entry), NULL);
376
12.4k
  isl_hash_table_clear(&u->table);
377
12.4k
  isl_space_free(u->space);
378
12.4k
  free(u);
379
12.4k
  return NULL;
380
12.4k
}
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
300
{
384
300
  isl_reordering *exp = user;
385
300
386
300
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
387
300
            FN(PART,get_domain_space)(part));
388
300
  return FN(PART,realign_domain)(part, exp);
389
300
}
isl_aff.c:isl_union_pw_aff_align_entry
Line
Count
Source
383
298
{
384
298
  isl_reordering *exp = user;
385
298
386
298
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
387
298
            FN(PART,get_domain_space)(part));
388
298
  return FN(PART,realign_domain)(part, exp);
389
298
}
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
176
{
396
176
  isl_space *space;
397
176
398
176
  if (!u || !r)
399
0
    goto error;
400
176
401
176
  space = isl_space_copy(r->dim);
402
176
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
403
176
  isl_reordering_free(r);
404
176
  return u;
405
176
error:
406
0
  FN(UNION,free)(u);
407
0
  isl_reordering_free(r);
408
0
  return NULL;
409
176
}
isl_aff.c:isl_union_pw_aff_realign_domain
Line
Count
Source
395
174
{
396
174
  isl_space *space;
397
174
398
174
  if (!u || !r)
399
0
    goto error;
400
174
401
174
  space = isl_space_copy(r->dim);
402
174
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
403
174
  isl_reordering_free(r);
404
174
  return u;
405
174
error:
406
0
  FN(UNION,free)(u);
407
0
  isl_reordering_free(r);
408
0
  return NULL;
409
174
}
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_space_copy(r->dim);
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
35.7k
{
416
35.7k
  isl_bool equal_params;
417
35.7k
  isl_reordering *r;
418
35.7k
419
35.7k
  if (!u || !model)
420
0
    goto error;
421
35.7k
422
35.7k
  equal_params = isl_space_has_equal_params(u->space, model);
423
35.7k
  if (equal_params < 0)
424
0
    goto error;
425
35.7k
  if (equal_params) {
426
35.7k
    isl_space_free(model);
427
35.7k
    return u;
428
35.7k
  }
429
3
430
3
  model = isl_space_params(model);
431
3
  r = isl_parameter_alignment_reordering(u->space, model);
432
3
  isl_space_free(model);
433
3
434
3
  return FN(UNION,realign_domain)(u, r);
435
3
error:
436
0
  isl_space_free(model);
437
0
  FN(UNION,free)(u);
438
0
  return NULL;
439
3
}
isl_union_pw_aff_align_params
Line
Count
Source
415
20.6k
{
416
20.6k
  isl_bool equal_params;
417
20.6k
  isl_reordering *r;
418
20.6k
419
20.6k
  if (!u || !model)
420
0
    goto error;
421
20.6k
422
20.6k
  equal_params = isl_space_has_equal_params(u->space, model);
423
20.6k
  if (equal_params < 0)
424
0
    goto error;
425
20.6k
  if (equal_params) {
426
20.6k
    isl_space_free(model);
427
20.6k
    return u;
428
20.6k
  }
429
1
430
1
  model = isl_space_params(model);
431
1
  r = isl_parameter_alignment_reordering(u->space, model);
432
1
  isl_space_free(model);
433
1
434
1
  return FN(UNION,realign_domain)(u, r);
435
1
error:
436
0
  isl_space_free(model);
437
0
  FN(UNION,free)(u);
438
0
  return NULL;
439
1
}
isl_union_pw_multi_aff_align_params
Line
Count
Source
415
15.1k
{
416
15.1k
  isl_bool equal_params;
417
15.1k
  isl_reordering *r;
418
15.1k
419
15.1k
  if (!u || !model)
420
0
    goto error;
421
15.1k
422
15.1k
  equal_params = isl_space_has_equal_params(u->space, model);
423
15.1k
  if (equal_params < 0)
424
0
    goto error;
425
15.1k
  if (equal_params) {
426
15.1k
    isl_space_free(model);
427
15.1k
    return u;
428
15.1k
  }
429
2
430
2
  model = isl_space_params(model);
431
2
  r = isl_parameter_alignment_reordering(u->space, model);
432
2
  isl_space_free(model);
433
2
434
2
  return FN(UNION,realign_domain)(u, r);
435
2
error:
436
0
  isl_space_free(model);
437
0
  FN(UNION,free)(u);
438
0
  return NULL;
439
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
  model = isl_space_params(model);
431
0
  r = isl_parameter_alignment_reordering(u->space, model);
432
0
  isl_space_free(model);
433
0
434
0
  return FN(UNION,realign_domain)(u, r);
435
0
error:
436
0
  isl_space_free(model);
437
0
  FN(UNION,free)(u);
438
0
  return NULL;
439
0
}
440
441
/* Add "part" to *u, taking the union sum if "u" already has
442
 * a part defined on the same space as "part".
443
 */
444
static isl_stat FN(UNION,union_add_part)(__isl_take PART *part, void *user)
445
560
{
446
560
  UNION **u = (UNION **)user;
447
560
448
560
  *u = FN(UNION,add_part_generic)(*u, part, 0);
449
560
450
560
  return isl_stat_ok;
451
560
}
isl_aff.c:isl_union_pw_aff_union_add_part
Line
Count
Source
445
353
{
446
353
  UNION **u = (UNION **)user;
447
353
448
353
  *u = FN(UNION,add_part_generic)(*u, part, 0);
449
353
450
353
  return isl_stat_ok;
451
353
}
isl_aff.c:isl_union_pw_multi_aff_union_add_part
Line
Count
Source
445
206
{
446
206
  UNION **u = (UNION **)user;
447
206
448
206
  *u = FN(UNION,add_part_generic)(*u, part, 0);
449
206
450
206
  return isl_stat_ok;
451
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
445
1
{
446
1
  UNION **u = (UNION **)user;
447
1
448
1
  *u = FN(UNION,add_part_generic)(*u, part, 0);
449
1
450
1
  return isl_stat_ok;
451
1
}
452
453
/* Compute the sum of "u1" and "u2" on the union of their domains,
454
 * with the actual sum on the shared domain and
455
 * the defined expression on the symmetric difference of the domains.
456
 *
457
 * This is an internal function that is exposed under different
458
 * names depending on whether the base expressions have a zero default
459
 * value.
460
 * If they do, then this function is called "add".
461
 * Otherwise, it is called "union_add".
462
 */
463
static __isl_give UNION *FN(UNION,union_add_)(__isl_take UNION *u1,
464
  __isl_take UNION *u2)
465
459
{
466
459
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
467
459
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
468
459
469
459
  u1 = FN(UNION,cow)(u1);
470
459
471
459
  if (!u1 || !u2)
472
0
    goto error;
473
459
474
459
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
475
0
    goto error;
476
459
477
459
  FN(UNION,free)(u2);
478
459
479
459
  return u1;
480
459
error:
481
0
  FN(UNION,free)(u1);
482
0
  FN(UNION,free)(u2);
483
0
  return NULL;
484
459
}
isl_aff.c:isl_union_pw_aff_union_add_
Line
Count
Source
465
338
{
466
338
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
467
338
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
468
338
469
338
  u1 = FN(UNION,cow)(u1);
470
338
471
338
  if (!u1 || !u2)
472
0
    goto error;
473
338
474
338
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
475
0
    goto error;
476
338
477
338
  FN(UNION,free)(u2);
478
338
479
338
  return u1;
480
338
error:
481
0
  FN(UNION,free)(u1);
482
0
  FN(UNION,free)(u2);
483
0
  return NULL;
484
338
}
isl_aff.c:isl_union_pw_multi_aff_union_add_
Line
Count
Source
465
120
{
466
120
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
467
120
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
468
120
469
120
  u1 = FN(UNION,cow)(u1);
470
120
471
120
  if (!u1 || !u2)
472
0
    goto error;
473
120
474
120
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
475
0
    goto error;
476
120
477
120
  FN(UNION,free)(u2);
478
120
479
120
  return u1;
480
120
error:
481
0
  FN(UNION,free)(u1);
482
0
  FN(UNION,free)(u2);
483
0
  return NULL;
484
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
465
1
{
466
1
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
467
1
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
468
1
469
1
  u1 = FN(UNION,cow)(u1);
470
1
471
1
  if (!u1 || !u2)
472
0
    goto error;
473
1
474
1
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
475
0
    goto error;
476
1
477
1
  FN(UNION,free)(u2);
478
1
479
1
  return u1;
480
1
error:
481
0
  FN(UNION,free)(u1);
482
0
  FN(UNION,free)(u2);
483
0
  return NULL;
484
1
}
485
486
__isl_give UNION *FN(FN(UNION,from),PARTS)(__isl_take PART *part)
487
957
{
488
957
  isl_space *dim;
489
957
  UNION *u;
490
957
491
957
  if (!part)
492
0
    return NULL;
493
957
494
957
  dim = FN(PART,get_space)(part);
495
957
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
496
957
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
497
#ifdef HAS_TYPE
498
0
  u = FN(UNION,ZERO)(dim, part->type);
499
#else
500
957
  u = FN(UNION,ZERO)(dim);
501
#endif
502
957
  u = FN(FN(UNION,add),PARTS)(u, part);
503
957
504
957
  return u;
505
957
}
isl_union_pw_aff_from_pw_aff
Line
Count
Source
487
954
{
488
954
  isl_space *dim;
489
954
  UNION *u;
490
954
491
954
  if (!part)
492
0
    return NULL;
493
954
494
954
  dim = FN(PART,get_space)(part);
495
954
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
496
954
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
497
#ifdef HAS_TYPE
498
  u = FN(UNION,ZERO)(dim, part->type);
499
#else
500
954
  u = FN(UNION,ZERO)(dim);
501
954
#endif
502
954
  u = FN(FN(UNION,add),PARTS)(u, part);
503
954
504
954
  return u;
505
954
}
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
487
3
{
488
3
  isl_space *dim;
489
3
  UNION *u;
490
3
491
3
  if (!part)
492
0
    return NULL;
493
3
494
3
  dim = FN(PART,get_space)(part);
495
3
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
496
3
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
497
#ifdef HAS_TYPE
498
  u = FN(UNION,ZERO)(dim, part->type);
499
#else
500
3
  u = FN(UNION,ZERO)(dim);
501
3
#endif
502
3
  u = FN(FN(UNION,add),PARTS)(u, part);
503
3
504
3
  return u;
505
3
}
506
507
S(UNION,match_bin_data) {
508
  UNION *u2;
509
  UNION *res;
510
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *);
511
};
512
513
/* Check if data->u2 has an element living in the same space as "part".
514
 * If so, call data->fn on the two elements and add the result to
515
 * data->res.
516
 */
517
static isl_stat FN(UNION,match_bin_entry)(__isl_take PART *part, void *user)
518
645
{
519
645
  S(UNION,match_bin_data) *data = user;
520
645
  struct isl_hash_table_entry *entry2;
521
645
  isl_space *space;
522
645
  PART *part2;
523
645
524
645
  space = FN(PART,get_space)(part);
525
645
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
526
645
  isl_space_free(space);
527
645
  if (!entry2)
528
0
    goto error;
529
645
  if (entry2 == isl_hash_table_entry_none) {
530
2
    FN(PART,free)(part);
531
2
    return isl_stat_ok;
532
2
  }
533
643
534
643
  part2 = entry2->data;
535
643
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
536
643
          part2->dim, isl_dim_out))
537
643
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
538
643
      "entries should have the same range space",
539
643
      goto error);
540
643
541
643
  part = data->fn(part, FN(PART, copy)(entry2->data));
542
643
543
643
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
544
643
  if (!data->res)
545
0
    return isl_stat_error;
546
643
547
643
  return isl_stat_ok;
548
643
error:
549
0
  FN(PART,free)(part);
550
0
  return isl_stat_error;
551
643
}
isl_aff.c:isl_union_pw_aff_match_bin_entry
Line
Count
Source
518
643
{
519
643
  S(UNION,match_bin_data) *data = user;
520
643
  struct isl_hash_table_entry *entry2;
521
643
  isl_space *space;
522
643
  PART *part2;
523
643
524
643
  space = FN(PART,get_space)(part);
525
643
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
526
643
  isl_space_free(space);
527
643
  if (!entry2)
528
0
    goto error;
529
643
  if (entry2 == isl_hash_table_entry_none) {
530
1
    FN(PART,free)(part);
531
1
    return isl_stat_ok;
532
1
  }
533
642
534
642
  part2 = entry2->data;
535
642
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
536
642
          part2->dim, isl_dim_out))
537
642
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
538
642
      "entries should have the same range space",
539
642
      goto error);
540
642
541
642
  part = data->fn(part, FN(PART, copy)(entry2->data));
542
642
543
642
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
544
642
  if (!data->res)
545
0
    return isl_stat_error;
546
642
547
642
  return isl_stat_ok;
548
642
error:
549
0
  FN(PART,free)(part);
550
0
  return isl_stat_error;
551
642
}
isl_aff.c:isl_union_pw_multi_aff_match_bin_entry
Line
Count
Source
518
2
{
519
2
  S(UNION,match_bin_data) *data = user;
520
2
  struct isl_hash_table_entry *entry2;
521
2
  isl_space *space;
522
2
  PART *part2;
523
2
524
2
  space = FN(PART,get_space)(part);
525
2
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
526
2
  isl_space_free(space);
527
2
  if (!entry2)
528
0
    goto error;
529
2
  if (entry2 == isl_hash_table_entry_none) {
530
1
    FN(PART,free)(part);
531
1
    return isl_stat_ok;
532
1
  }
533
1
534
1
  part2 = entry2->data;
535
1
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
536
1
          part2->dim, isl_dim_out))
537
1
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
538
1
      "entries should have the same range space",
539
1
      goto error);
540
1
541
1
  part = data->fn(part, FN(PART, copy)(entry2->data));
542
1
543
1
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
544
1
  if (!data->res)
545
0
    return isl_stat_error;
546
1
547
1
  return isl_stat_ok;
548
1
error:
549
0
  FN(PART,free)(part);
550
0
  return isl_stat_error;
551
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
552
553
/* This function is currently only used from isl_polynomial.c
554
 * and not from isl_fold.c.
555
 */
556
static __isl_give UNION *FN(UNION,match_bin_op)(__isl_take UNION *u1,
557
  __isl_take UNION *u2,
558
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *))
559
  __attribute__ ((unused));
560
/* For each pair of elements in "u1" and "u2" living in the same space,
561
 * call "fn" and collect the results.
562
 */
563
static __isl_give UNION *FN(UNION,match_bin_op)(__isl_take UNION *u1,
564
  __isl_take UNION *u2,
565
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *))
566
429
{
567
429
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
568
429
569
429
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
570
429
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
571
429
572
429
  if (!u1 || !u2)
573
0
    goto error;
574
429
575
429
  data.u2 = u2;
576
429
  data.res = FN(UNION,alloc_same_size)(u1);
577
429
  if (FN(FN(UNION,foreach),PARTS)(u1,
578
429
            &FN(UNION,match_bin_entry), &data) < 0)
579
0
    goto error;
580
429
581
429
  FN(UNION,free)(u1);
582
429
  FN(UNION,free)(u2);
583
429
  return data.res;
584
429
error:
585
0
  FN(UNION,free)(u1);
586
0
  FN(UNION,free)(u2);
587
0
  FN(UNION,free)(data.res);
588
0
  return NULL;
589
429
}
isl_aff.c:isl_union_pw_aff_match_bin_op
Line
Count
Source
566
428
{
567
428
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
568
428
569
428
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
570
428
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
571
428
572
428
  if (!u1 || !u2)
573
0
    goto error;
574
428
575
428
  data.u2 = u2;
576
428
  data.res = FN(UNION,alloc_same_size)(u1);
577
428
  if (FN(FN(UNION,foreach),PARTS)(u1,
578
428
            &FN(UNION,match_bin_entry), &data) < 0)
579
0
    goto error;
580
428
581
428
  FN(UNION,free)(u1);
582
428
  FN(UNION,free)(u2);
583
428
  return data.res;
584
428
error:
585
0
  FN(UNION,free)(u1);
586
0
  FN(UNION,free)(u2);
587
0
  FN(UNION,free)(data.res);
588
0
  return NULL;
589
428
}
isl_aff.c:isl_union_pw_multi_aff_match_bin_op
Line
Count
Source
566
1
{
567
1
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
568
1
569
1
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
570
1
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
571
1
572
1
  if (!u1 || !u2)
573
0
    goto error;
574
1
575
1
  data.u2 = u2;
576
1
  data.res = FN(UNION,alloc_same_size)(u1);
577
1
  if (FN(FN(UNION,foreach),PARTS)(u1,
578
1
            &FN(UNION,match_bin_entry), &data) < 0)
579
0
    goto error;
580
1
581
1
  FN(UNION,free)(u1);
582
1
  FN(UNION,free)(u2);
583
1
  return data.res;
584
1
error:
585
0
  FN(UNION,free)(u1);
586
0
  FN(UNION,free)(u2);
587
0
  FN(UNION,free)(data.res);
588
0
  return NULL;
589
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
590
591
/* Compute the sum of "u1" and "u2".
592
 *
593
 * If the base expressions have a default zero value, then the sum
594
 * is computed on the union of the domains of "u1" and "u2".
595
 * Otherwise, it is computed on their shared domains.
596
 */
597
__isl_give UNION *FN(UNION,add)(__isl_take UNION *u1, __isl_take UNION *u2)
598
162
{
599
#if DEFAULT_IS_ZERO
600
1
  return FN(UNION,union_add_)(u1, u2);
601
#else
602
161
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
603
#endif
604
}
isl_union_pw_aff_add
Line
Count
Source
598
160
{
599
#if DEFAULT_IS_ZERO
600
  return FN(UNION,union_add_)(u1, u2);
601
#else
602
160
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
603
160
#endif
604
160
}
isl_union_pw_multi_aff_add
Line
Count
Source
598
1
{
599
#if DEFAULT_IS_ZERO
600
  return FN(UNION,union_add_)(u1, u2);
601
#else
602
1
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
603
1
#endif
604
1
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_add
isl_union_pw_qpolynomial_add
Line
Count
Source
598
1
{
599
1
#if DEFAULT_IS_ZERO
600
1
  return FN(UNION,union_add_)(u1, u2);
601
#else
602
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
603
#endif
604
}
605
606
#ifndef NO_SUB
607
/* Subtract "u2" from "u1" and return the result.
608
 */
609
__isl_give UNION *FN(UNION,sub)(__isl_take UNION *u1, __isl_take UNION *u2)
610
268
{
611
268
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
612
268
}
isl_union_pw_aff_sub
Line
Count
Source
610
268
{
611
268
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
612
268
}
Unexecuted instantiation: isl_union_pw_multi_aff_sub
Unexecuted instantiation: isl_union_pw_qpolynomial_sub
613
#endif
614
615
S(UNION,any_set_data) {
616
  isl_set *set;
617
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
618
};
619
620
static __isl_give PART *FN(UNION,any_set_entry)(__isl_take PART *part,
621
  void *user)
622
5.71k
{
623
5.71k
  S(UNION,any_set_data) *data = user;
624
5.71k
625
5.71k
  return data->fn(part, isl_set_copy(data->set));
626
5.71k
}
isl_aff.c:isl_union_pw_aff_any_set_entry
Line
Count
Source
622
5.71k
{
623
5.71k
  S(UNION,any_set_data) *data = user;
624
5.71k
625
5.71k
  return data->fn(part, isl_set_copy(data->set));
626
5.71k
}
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
627
628
/* Update each element of "u" by calling "fn" on the element and "set".
629
 */
630
static __isl_give UNION *FN(UNION,any_set_op)(__isl_take UNION *u,
631
  __isl_take isl_set *set,
632
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*))
633
1.31k
{
634
1.31k
  S(UNION,any_set_data) data = { NULL, fn };
635
1.31k
636
1.31k
  u = FN(UNION,align_params)(u, isl_set_get_space(set));
637
1.31k
  set = isl_set_align_params(set, FN(UNION,get_space)(u));
638
1.31k
639
1.31k
  if (!u || !set)
640
0
    goto error;
641
1.31k
642
1.31k
  data.set = set;
643
1.31k
  u = FN(UNION,transform)(u, &FN(UNION,any_set_entry), &data);
644
1.31k
  isl_set_free(set);
645
1.31k
  return u;
646
1.31k
error:
647
0
  FN(UNION,free)(u);
648
0
  isl_set_free(set);
649
0
  return NULL;
650
1.31k
}
isl_aff.c:isl_union_pw_aff_any_set_op
Line
Count
Source
633
1.31k
{
634
1.31k
  S(UNION,any_set_data) data = { NULL, fn };
635
1.31k
636
1.31k
  u = FN(UNION,align_params)(u, isl_set_get_space(set));
637
1.31k
  set = isl_set_align_params(set, FN(UNION,get_space)(u));
638
1.31k
639
1.31k
  if (!u || !set)
640
0
    goto error;
641
1.31k
642
1.31k
  data.set = set;
643
1.31k
  u = FN(UNION,transform)(u, &FN(UNION,any_set_entry), &data);
644
1.31k
  isl_set_free(set);
645
1.31k
  return u;
646
1.31k
error:
647
0
  FN(UNION,free)(u);
648
0
  isl_set_free(set);
649
0
  return NULL;
650
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
651
652
/* Intersect the domain of "u" with the parameter domain "context".
653
 */
654
__isl_give UNION *FN(UNION,intersect_params)(__isl_take UNION *u,
655
  __isl_take isl_set *set)
656
1.31k
{
657
1.31k
  return FN(UNION,any_set_op)(u, set, &FN(PW,intersect_params));
658
1.31k
}
isl_union_pw_aff_intersect_params
Line
Count
Source
656
1.31k
{
657
1.31k
  return FN(UNION,any_set_op)(u, set, &FN(PW,intersect_params));
658
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
659
660
/* Compute the gist of the domain of "u" with respect to
661
 * the parameter domain "context".
662
 */
663
__isl_give UNION *FN(UNION,gist_params)(__isl_take UNION *u,
664
  __isl_take isl_set *set)
665
0
{
666
0
  return FN(UNION,any_set_op)(u, set, &FN(PW,gist_params));
667
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
668
669
S(UNION,match_domain_data) {
670
  isl_union_set *uset;
671
  UNION *res;
672
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
673
};
674
675
static int FN(UNION,set_has_dim)(const void *entry, const void *val)
676
476
{
677
476
  isl_set *set = (isl_set *)entry;
678
476
  isl_space *dim = (isl_space *)val;
679
476
680
476
  return isl_space_is_equal(set->dim, dim);
681
476
}
isl_aff.c:isl_union_pw_aff_set_has_dim
Line
Count
Source
676
446
{
677
446
  isl_set *set = (isl_set *)entry;
678
446
  isl_space *dim = (isl_space *)val;
679
446
680
446
  return isl_space_is_equal(set->dim, dim);
681
446
}
isl_aff.c:isl_union_pw_multi_aff_set_has_dim
Line
Count
Source
676
29
{
677
29
  isl_set *set = (isl_set *)entry;
678
29
  isl_space *dim = (isl_space *)val;
679
29
680
29
  return isl_space_is_equal(set->dim, dim);
681
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
676
1
{
677
1
  isl_set *set = (isl_set *)entry;
678
1
  isl_space *dim = (isl_space *)val;
679
1
680
1
  return isl_space_is_equal(set->dim, dim);
681
1
}
682
683
/* Find the set in data->uset that lives in the same space as the domain
684
 * of "part", apply data->fn to *entry and this set (if any), and add
685
 * the result to data->res.
686
 */
687
static isl_stat FN(UNION,match_domain_entry)(__isl_take PART *part, void *user)
688
664
{
689
664
  S(UNION,match_domain_data) *data = user;
690
664
  uint32_t hash;
691
664
  struct isl_hash_table_entry *entry2;
692
664
  isl_space *space;
693
664
694
664
  space = FN(PART,get_domain_space)(part);
695
664
  hash = isl_space_get_hash(space);
696
664
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
697
664
             hash, &FN(UNION,set_has_dim), space, 0);
698
664
  isl_space_free(space);
699
664
  if (!entry2) {
700
188
    FN(PART,free)(part);
701
188
    return isl_stat_ok;
702
188
  }
703
476
704
476
  part = data->fn(part, isl_set_copy(entry2->data));
705
476
706
476
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
707
476
  if (!data->res)
708
0
    return isl_stat_error;
709
476
710
476
  return isl_stat_ok;
711
476
}
isl_aff.c:isl_union_pw_aff_match_domain_entry
Line
Count
Source
688
632
{
689
632
  S(UNION,match_domain_data) *data = user;
690
632
  uint32_t hash;
691
632
  struct isl_hash_table_entry *entry2;
692
632
  isl_space *space;
693
632
694
632
  space = FN(PART,get_domain_space)(part);
695
632
  hash = isl_space_get_hash(space);
696
632
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
697
632
             hash, &FN(UNION,set_has_dim), space, 0);
698
632
  isl_space_free(space);
699
632
  if (!entry2) {
700
186
    FN(PART,free)(part);
701
186
    return isl_stat_ok;
702
186
  }
703
446
704
446
  part = data->fn(part, isl_set_copy(entry2->data));
705
446
706
446
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
707
446
  if (!data->res)
708
0
    return isl_stat_error;
709
446
710
446
  return isl_stat_ok;
711
446
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_entry
Line
Count
Source
688
31
{
689
31
  S(UNION,match_domain_data) *data = user;
690
31
  uint32_t hash;
691
31
  struct isl_hash_table_entry *entry2;
692
31
  isl_space *space;
693
31
694
31
  space = FN(PART,get_domain_space)(part);
695
31
  hash = isl_space_get_hash(space);
696
31
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
697
31
             hash, &FN(UNION,set_has_dim), space, 0);
698
31
  isl_space_free(space);
699
31
  if (!entry2) {
700
2
    FN(PART,free)(part);
701
2
    return isl_stat_ok;
702
2
  }
703
29
704
29
  part = data->fn(part, isl_set_copy(entry2->data));
705
29
706
29
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
707
29
  if (!data->res)
708
0
    return isl_stat_error;
709
29
710
29
  return isl_stat_ok;
711
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
688
1
{
689
1
  S(UNION,match_domain_data) *data = user;
690
1
  uint32_t hash;
691
1
  struct isl_hash_table_entry *entry2;
692
1
  isl_space *space;
693
1
694
1
  space = FN(PART,get_domain_space)(part);
695
1
  hash = isl_space_get_hash(space);
696
1
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
697
1
             hash, &FN(UNION,set_has_dim), space, 0);
698
1
  isl_space_free(space);
699
1
  if (!entry2) {
700
0
    FN(PART,free)(part);
701
0
    return isl_stat_ok;
702
0
  }
703
1
704
1
  part = data->fn(part, isl_set_copy(entry2->data));
705
1
706
1
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
707
1
  if (!data->res)
708
0
    return isl_stat_error;
709
1
710
1
  return isl_stat_ok;
711
1
}
712
713
/* Apply fn to each pair of PW in u and set in uset such that
714
 * the set lives in the same space as the domain of PW
715
 * and collect the results.
716
 */
717
static __isl_give UNION *FN(UNION,match_domain_op)(__isl_take UNION *u,
718
  __isl_take isl_union_set *uset,
719
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*))
720
351
{
721
351
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
722
351
723
351
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
724
351
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
725
351
726
351
  if (!u || !uset)
727
0
    goto error;
728
351
729
351
  data.uset = uset;
730
351
  data.res = FN(UNION,alloc_same_size)(u);
731
351
  if (FN(FN(UNION,foreach),PARTS)(u,
732
351
           &FN(UNION,match_domain_entry), &data) < 0)
733
0
    goto error;
734
351
735
351
  FN(UNION,free)(u);
736
351
  isl_union_set_free(uset);
737
351
  return data.res;
738
351
error:
739
0
  FN(UNION,free)(u);
740
0
  isl_union_set_free(uset);
741
0
  FN(UNION,free)(data.res);
742
0
  return NULL;
743
351
}
isl_aff.c:isl_union_pw_aff_match_domain_op
Line
Count
Source
720
329
{
721
329
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
722
329
723
329
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
724
329
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
725
329
726
329
  if (!u || !uset)
727
0
    goto error;
728
329
729
329
  data.uset = uset;
730
329
  data.res = FN(UNION,alloc_same_size)(u);
731
329
  if (FN(FN(UNION,foreach),PARTS)(u,
732
329
           &FN(UNION,match_domain_entry), &data) < 0)
733
0
    goto error;
734
329
735
329
  FN(UNION,free)(u);
736
329
  isl_union_set_free(uset);
737
329
  return data.res;
738
329
error:
739
0
  FN(UNION,free)(u);
740
0
  isl_union_set_free(uset);
741
0
  FN(UNION,free)(data.res);
742
0
  return NULL;
743
329
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_op
Line
Count
Source
720
21
{
721
21
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
722
21
723
21
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
724
21
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
725
21
726
21
  if (!u || !uset)
727
0
    goto error;
728
21
729
21
  data.uset = uset;
730
21
  data.res = FN(UNION,alloc_same_size)(u);
731
21
  if (FN(FN(UNION,foreach),PARTS)(u,
732
21
           &FN(UNION,match_domain_entry), &data) < 0)
733
0
    goto error;
734
21
735
21
  FN(UNION,free)(u);
736
21
  isl_union_set_free(uset);
737
21
  return data.res;
738
21
error:
739
0
  FN(UNION,free)(u);
740
0
  isl_union_set_free(uset);
741
0
  FN(UNION,free)(data.res);
742
0
  return NULL;
743
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
720
1
{
721
1
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
722
1
723
1
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
724
1
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
725
1
726
1
  if (!u || !uset)
727
0
    goto error;
728
1
729
1
  data.uset = uset;
730
1
  data.res = FN(UNION,alloc_same_size)(u);
731
1
  if (FN(FN(UNION,foreach),PARTS)(u,
732
1
           &FN(UNION,match_domain_entry), &data) < 0)
733
0
    goto error;
734
1
735
1
  FN(UNION,free)(u);
736
1
  isl_union_set_free(uset);
737
1
  return data.res;
738
1
error:
739
0
  FN(UNION,free)(u);
740
0
  isl_union_set_free(uset);
741
0
  FN(UNION,free)(data.res);
742
0
  return NULL;
743
1
}
744
745
/* Intersect the domain of "u" with "uset".
746
 * If "uset" is a parameters domain, then intersect the parameter
747
 * domain of "u" with this set.
748
 */
749
__isl_give UNION *FN(UNION,intersect_domain)(__isl_take UNION *u,
750
  __isl_take isl_union_set *uset)
751
1.36k
{
752
1.36k
  if (isl_union_set_is_params(uset))
753
1.30k
    return FN(UNION,intersect_params)(u,
754
1.30k
            isl_set_from_union_set(uset));
755
58
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
756
58
}
isl_union_pw_aff_intersect_domain
Line
Count
Source
751
1.34k
{
752
1.34k
  if (isl_union_set_is_params(uset))
753
1.30k
    return FN(UNION,intersect_params)(u,
754
1.30k
            isl_set_from_union_set(uset));
755
37
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
756
37
}
isl_union_pw_multi_aff_intersect_domain
Line
Count
Source
751
20
{
752
20
  if (isl_union_set_is_params(uset))
753
0
    return FN(UNION,intersect_params)(u,
754
0
            isl_set_from_union_set(uset));
755
20
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
756
20
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_intersect_domain
isl_union_pw_qpolynomial_intersect_domain
Line
Count
Source
751
1
{
752
1
  if (isl_union_set_is_params(uset))
753
0
    return FN(UNION,intersect_params)(u,
754
0
            isl_set_from_union_set(uset));
755
1
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
756
1
}
757
758
/* Take the set (which may be empty) in data->uset that lives
759
 * in the same space as the domain of "pw", subtract it from the domain
760
 * of "part" and return the result.
761
 */
762
static __isl_give PART *FN(UNION,subtract_domain_entry)(__isl_take PART *part,
763
  void *user)
764
3
{
765
3
  isl_union_set *uset = user;
766
3
  isl_space *space;
767
3
  isl_set *set;
768
3
769
3
  space = FN(PART,get_domain_space)(part);
770
3
  set = isl_union_set_extract_set(uset, space);
771
3
  return FN(PART,subtract_domain)(part, set);
772
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
764
3
{
765
3
  isl_union_set *uset = user;
766
3
  isl_space *space;
767
3
  isl_set *set;
768
3
769
3
  space = FN(PART,get_domain_space)(part);
770
3
  set = isl_union_set_extract_set(uset, space);
771
3
  return FN(PART,subtract_domain)(part, set);
772
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
773
774
/* Subtract "uset' from the domain of "u".
775
 */
776
__isl_give UNION *FN(UNION,subtract_domain)(__isl_take UNION *u,
777
  __isl_take isl_union_set *uset)
778
3
{
779
3
  u = FN(UNION,transform)(u, &FN(UNION,subtract_domain_entry), uset);
780
3
  isl_union_set_free(uset);
781
3
  return u;
782
3
}
Unexecuted instantiation: isl_union_pw_aff_subtract_domain
isl_union_pw_multi_aff_subtract_domain
Line
Count
Source
778
3
{
779
3
  u = FN(UNION,transform)(u, &FN(UNION,subtract_domain_entry), uset);
780
3
  isl_union_set_free(uset);
781
3
  return u;
782
3
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_subtract_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_subtract_domain
783
784
__isl_give UNION *FN(UNION,gist)(__isl_take UNION *u,
785
  __isl_take isl_union_set *uset)
786
293
{
787
293
  if (isl_union_set_is_params(uset))
788
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
789
293
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
790
293
}
isl_union_pw_aff_gist
Line
Count
Source
786
292
{
787
292
  if (isl_union_set_is_params(uset))
788
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
789
292
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
790
292
}
isl_union_pw_multi_aff_gist
Line
Count
Source
786
1
{
787
1
  if (isl_union_set_is_params(uset))
788
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
789
1
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
790
1
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_gist
Unexecuted instantiation: isl_union_pw_qpolynomial_gist
791
792
/* Coalesce an entry in a UNION.  Coalescing is performed in-place.
793
 * Since the UNION may have several references, the entry is only
794
 * replaced if the coalescing is successful.
795
 */
796
static isl_stat FN(UNION,coalesce_entry)(void **entry, void *user)
797
0
{
798
0
  PART **part_p = (PART **) entry;
799
0
  PART *part;
800
0
801
0
  part = FN(PART,copy)(*part_p);
802
0
  part = FN(PW,coalesce)(part);
803
0
  if (!part)
804
0
    return isl_stat_error;
805
0
  FN(PART,free)(*part_p);
806
0
  *part_p = part;
807
0
808
0
  return isl_stat_ok;
809
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
810
811
__isl_give UNION *FN(UNION,coalesce)(__isl_take UNION *u)
812
0
{
813
0
  if (FN(UNION,foreach_inplace)(u, &FN(UNION,coalesce_entry), NULL) < 0)
814
0
    goto error;
815
0
816
0
  return u;
817
0
error:
818
0
  FN(UNION,free)(u);
819
0
  return NULL;
820
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
821
822
static isl_stat FN(UNION,domain_entry)(__isl_take PART *part, void *user)
823
9.76k
{
824
9.76k
  isl_union_set **uset = (isl_union_set **)user;
825
9.76k
826
9.76k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
827
9.76k
828
9.76k
  return isl_stat_ok;
829
9.76k
}
isl_aff.c:isl_union_pw_aff_domain_entry
Line
Count
Source
823
9.75k
{
824
9.75k
  isl_union_set **uset = (isl_union_set **)user;
825
9.75k
826
9.75k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
827
9.75k
828
9.75k
  return isl_stat_ok;
829
9.75k
}
isl_aff.c:isl_union_pw_multi_aff_domain_entry
Line
Count
Source
823
6
{
824
6
  isl_union_set **uset = (isl_union_set **)user;
825
6
826
6
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
827
6
828
6
  return isl_stat_ok;
829
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
823
1
{
824
1
  isl_union_set **uset = (isl_union_set **)user;
825
1
826
1
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
827
1
828
1
  return isl_stat_ok;
829
1
}
830
831
__isl_give isl_union_set *FN(UNION,domain)(__isl_take UNION *u)
832
6.05k
{
833
6.05k
  isl_union_set *uset;
834
6.05k
835
6.05k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
836
6.05k
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
837
0
    goto error;
838
6.05k
839
6.05k
  FN(UNION,free)(u);
840
6.05k
  
841
6.05k
  return uset;
842
6.05k
error:
843
0
  isl_union_set_free(uset);
844
0
  FN(UNION,free)(u);
845
0
  return NULL;
846
6.05k
}
isl_union_pw_aff_domain
Line
Count
Source
832
6.05k
{
833
6.05k
  isl_union_set *uset;
834
6.05k
835
6.05k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
836
6.05k
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
837
0
    goto error;
838
6.05k
839
6.05k
  FN(UNION,free)(u);
840
6.05k
  
841
6.05k
  return uset;
842
6.05k
error:
843
0
  isl_union_set_free(uset);
844
0
  FN(UNION,free)(u);
845
0
  return NULL;
846
6.05k
}
isl_union_pw_multi_aff_domain
Line
Count
Source
832
5
{
833
5
  isl_union_set *uset;
834
5
835
5
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
836
5
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
837
0
    goto error;
838
5
839
5
  FN(UNION,free)(u);
840
5
  
841
5
  return uset;
842
5
error:
843
0
  isl_union_set_free(uset);
844
0
  FN(UNION,free)(u);
845
0
  return NULL;
846
5
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_domain
isl_union_pw_qpolynomial_domain
Line
Count
Source
832
1
{
833
1
  isl_union_set *uset;
834
1
835
1
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
836
1
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
837
0
    goto error;
838
1
839
1
  FN(UNION,free)(u);
840
1
  
841
1
  return uset;
842
1
error:
843
0
  isl_union_set_free(uset);
844
0
  FN(UNION,free)(u);
845
0
  return NULL;
846
1
}
847
848
#ifdef HAS_TYPE
849
/* Negate the type of "u".
850
 */
851
static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u)
852
0
{
853
0
  u = FN(UNION,cow)(u);
854
0
  if (!u)
855
0
    return NULL;
856
0
  u->type = isl_fold_type_negate(u->type);
857
0
  return u;
858
0
}
859
#else
860
/* Negate the type of "u".
861
 * Since "u" does not have a type, do nothing.
862
 */
863
static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u)
864
2
{
865
2
  return u;
866
2
}
isl_aff.c:isl_union_pw_aff_negate_type
Line
Count
Source
864
2
{
865
2
  return u;
866
2
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_negate_type
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_negate_type
867
#endif
868
869
/* Multiply "part" by the isl_val "user" and return the result.
870
 */
871
static __isl_give PART *FN(UNION,scale_val_entry)(__isl_take PART *part,
872
  void *user)
873
159
{
874
159
  isl_val *v = user;
875
159
876
159
  return FN(PART,scale_val)(part, isl_val_copy(v));
877
159
}
isl_aff.c:isl_union_pw_aff_scale_val_entry
Line
Count
Source
873
159
{
874
159
  isl_val *v = user;
875
159
876
159
  return FN(PART,scale_val)(part, isl_val_copy(v));
877
159
}
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
878
879
/* Multiply "u" by "v" and return the result.
880
 */
881
__isl_give UNION *FN(UNION,scale_val)(__isl_take UNION *u,
882
  __isl_take isl_val *v)
883
189
{
884
189
  if (!u || !v)
885
0
    goto error;
886
189
  if (isl_val_is_one(v)) {
887
35
    isl_val_free(v);
888
35
    return u;
889
35
  }
890
154
891
154
  if (DEFAULT_IS_ZERO && 
u0
&&
isl_val_is_zero(v)0
) {
892
0
    UNION *zero;
893
0
    isl_space *space = FN(UNION,get_space)(u);
894
#ifdef HAS_TYPE
895
0
    zero = FN(UNION,ZERO)(space, u->type);
896
#else
897
0
    zero = FN(UNION,ZERO)(space);
898
#endif
899
0
    FN(UNION,free)(u);
900
0
    isl_val_free(v);
901
0
    return zero;
902
0
  }
903
154
904
154
  if (!isl_val_is_rat(v))
905
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
906
154
      "expecting rational factor", goto error);
907
154
908
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
909
154
  if (isl_val_is_neg(v))
910
2
    u = FN(UNION,negate_type)(u);
911
154
912
154
  isl_val_free(v);
913
154
  return u;
914
154
error:
915
0
  isl_val_free(v);
916
0
  FN(UNION,free)(u);
917
0
  return NULL;
918
154
}
isl_union_pw_aff_scale_val
Line
Count
Source
883
189
{
884
189
  if (!u || !v)
885
0
    goto error;
886
189
  if (isl_val_is_one(v)) {
887
35
    isl_val_free(v);
888
35
    return u;
889
35
  }
890
154
891
154
  if (DEFAULT_IS_ZERO && 
u0
&&
isl_val_is_zero(v)0
) {
892
0
    UNION *zero;
893
0
    isl_space *space = FN(UNION,get_space)(u);
894
#ifdef HAS_TYPE
895
    zero = FN(UNION,ZERO)(space, u->type);
896
#else
897
0
    zero = FN(UNION,ZERO)(space);
898
0
#endif
899
0
    FN(UNION,free)(u);
900
0
    isl_val_free(v);
901
0
    return zero;
902
0
  }
903
154
904
154
  if (!isl_val_is_rat(v))
905
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
906
154
      "expecting rational factor", goto error);
907
154
908
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
909
154
  if (isl_val_is_neg(v))
910
2
    u = FN(UNION,negate_type)(u);
911
154
912
154
  isl_val_free(v);
913
154
  return u;
914
154
error:
915
0
  isl_val_free(v);
916
0
  FN(UNION,free)(u);
917
0
  return NULL;
918
154
}
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
919
920
/* Divide "part" by the isl_val "user" and return the result.
921
 */
922
static __isl_give PART *FN(UNION,scale_down_val_entry)(__isl_take PART *part,
923
  void *user)
924
157
{
925
157
  isl_val *v = user;
926
157
927
157
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
928
157
}
isl_aff.c:isl_union_pw_aff_scale_down_val_entry
Line
Count
Source
924
157
{
925
157
  isl_val *v = user;
926
157
927
157
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
928
157
}
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
929
930
/* Divide "u" by "v" and return the result.
931
 */
932
__isl_give UNION *FN(UNION,scale_down_val)(__isl_take UNION *u,
933
  __isl_take isl_val *v)
934
172
{
935
172
  if (!u || !v)
936
0
    goto error;
937
172
  if (isl_val_is_one(v)) {
938
18
    isl_val_free(v);
939
18
    return u;
940
18
  }
941
154
942
154
  if (!isl_val_is_rat(v))
943
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
944
154
      "expecting rational factor", goto error);
945
154
  if (isl_val_is_zero(v))
946
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
947
154
      "cannot scale down by zero", goto error);
948
154
949
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
950
154
  if (isl_val_is_neg(v))
951
0
    u = FN(UNION,negate_type)(u);
952
154
953
154
  isl_val_free(v);
954
154
  return u;
955
154
error:
956
0
  isl_val_free(v);
957
0
  FN(UNION,free)(u);
958
0
  return NULL;
959
154
}
isl_union_pw_aff_scale_down_val
Line
Count
Source
934
172
{
935
172
  if (!u || !v)
936
0
    goto error;
937
172
  if (isl_val_is_one(v)) {
938
18
    isl_val_free(v);
939
18
    return u;
940
18
  }
941
154
942
154
  if (!isl_val_is_rat(v))
943
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
944
154
      "expecting rational factor", goto error);
945
154
  if (isl_val_is_zero(v))
946
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
947
154
      "cannot scale down by zero", goto error);
948
154
949
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
950
154
  if (isl_val_is_neg(v))
951
0
    u = FN(UNION,negate_type)(u);
952
154
953
154
  isl_val_free(v);
954
154
  return u;
955
154
error:
956
0
  isl_val_free(v);
957
0
  FN(UNION,free)(u);
958
0
  return NULL;
959
154
}
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
960
961
S(UNION,plain_is_equal_data)
962
{
963
  UNION *u2;
964
  isl_bool is_equal;
965
};
966
967
static isl_stat FN(UNION,plain_is_equal_entry)(void **entry, void *user)
968
113
{
969
113
  S(UNION,plain_is_equal_data) *data = user;
970
113
  struct isl_hash_table_entry *entry2;
971
113
  PW *pw = *entry;
972
113
973
113
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
974
113
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
975
0
    if (!entry2)
976
0
      data->is_equal = isl_bool_error;
977
0
    else
978
0
      data->is_equal = isl_bool_false;
979
0
    return isl_stat_error;
980
0
  }
981
113
982
113
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
983
113
  if (data->is_equal < 0 || !data->is_equal)
984
0
    return isl_stat_error;
985
113
986
113
  return isl_stat_ok;
987
113
}
isl_aff.c:isl_union_pw_aff_plain_is_equal_entry
Line
Count
Source
968
101
{
969
101
  S(UNION,plain_is_equal_data) *data = user;
970
101
  struct isl_hash_table_entry *entry2;
971
101
  PW *pw = *entry;
972
101
973
101
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
974
101
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
975
0
    if (!entry2)
976
0
      data->is_equal = isl_bool_error;
977
0
    else
978
0
      data->is_equal = isl_bool_false;
979
0
    return isl_stat_error;
980
0
  }
981
101
982
101
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
983
101
  if (data->is_equal < 0 || !data->is_equal)
984
0
    return isl_stat_error;
985
101
986
101
  return isl_stat_ok;
987
101
}
isl_aff.c:isl_union_pw_multi_aff_plain_is_equal_entry
Line
Count
Source
968
11
{
969
11
  S(UNION,plain_is_equal_data) *data = user;
970
11
  struct isl_hash_table_entry *entry2;
971
11
  PW *pw = *entry;
972
11
973
11
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
974
11
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
975
0
    if (!entry2)
976
0
      data->is_equal = isl_bool_error;
977
0
    else
978
0
      data->is_equal = isl_bool_false;
979
0
    return isl_stat_error;
980
0
  }
981
11
982
11
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
983
11
  if (data->is_equal < 0 || !data->is_equal)
984
0
    return isl_stat_error;
985
11
986
11
  return isl_stat_ok;
987
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
968
1
{
969
1
  S(UNION,plain_is_equal_data) *data = user;
970
1
  struct isl_hash_table_entry *entry2;
971
1
  PW *pw = *entry;
972
1
973
1
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
974
1
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
975
0
    if (!entry2)
976
0
      data->is_equal = isl_bool_error;
977
0
    else
978
0
      data->is_equal = isl_bool_false;
979
0
    return isl_stat_error;
980
0
  }
981
1
982
1
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
983
1
  if (data->is_equal < 0 || !data->is_equal)
984
0
    return isl_stat_error;
985
1
986
1
  return isl_stat_ok;
987
1
}
988
989
isl_bool FN(UNION,plain_is_equal)(__isl_keep UNION *u1, __isl_keep UNION *u2)
990
89
{
991
89
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
992
89
  int n1, n2;
993
89
994
89
  if (!u1 || !u2)
995
0
    return isl_bool_error;
996
89
  if (u1 == u2)
997
0
    return isl_bool_true;
998
89
  if (u1->table.n != u2->table.n)
999
0
    return isl_bool_false;
1000
89
  n1 = FN(FN(UNION,n),PARTS)(u1);
1001
89
  n2 = FN(FN(UNION,n),PARTS)(u2);
1002
89
  if (n1 < 0 || n2 < 0)
1003
0
    return isl_bool_error;
1004
89
  if (n1 != n2)
1005
0
    return isl_bool_false;
1006
89
1007
89
  u1 = FN(UNION,copy)(u1);
1008
89
  u2 = FN(UNION,copy)(u2);
1009
89
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1010
89
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1011
89
  if (!u1 || !u2)
1012
0
    goto error;
1013
89
1014
89
  data.u2 = u2;
1015
89
  if (FN(UNION,foreach_inplace)(u1,
1016
89
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1017
89
      
data.is_equal0
)
1018
0
    goto error;
1019
89
1020
89
  FN(UNION,free)(u1);
1021
89
  FN(UNION,free)(u2);
1022
89
1023
89
  return data.is_equal;
1024
89
error:
1025
0
  FN(UNION,free)(u1);
1026
0
  FN(UNION,free)(u2);
1027
0
  return isl_bool_error;
1028
89
}
isl_union_pw_aff_plain_is_equal
Line
Count
Source
990
79
{
991
79
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
992
79
  int n1, n2;
993
79
994
79
  if (!u1 || !u2)
995
0
    return isl_bool_error;
996
79
  if (u1 == u2)
997
0
    return isl_bool_true;
998
79
  if (u1->table.n != u2->table.n)
999
0
    return isl_bool_false;
1000
79
  n1 = FN(FN(UNION,n),PARTS)(u1);
1001
79
  n2 = FN(FN(UNION,n),PARTS)(u2);
1002
79
  if (n1 < 0 || n2 < 0)
1003
0
    return isl_bool_error;
1004
79
  if (n1 != n2)
1005
0
    return isl_bool_false;
1006
79
1007
79
  u1 = FN(UNION,copy)(u1);
1008
79
  u2 = FN(UNION,copy)(u2);
1009
79
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1010
79
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1011
79
  if (!u1 || !u2)
1012
0
    goto error;
1013
79
1014
79
  data.u2 = u2;
1015
79
  if (FN(UNION,foreach_inplace)(u1,
1016
79
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1017
79
      
data.is_equal0
)
1018
0
    goto error;
1019
79
1020
79
  FN(UNION,free)(u1);
1021
79
  FN(UNION,free)(u2);
1022
79
1023
79
  return data.is_equal;
1024
79
error:
1025
0
  FN(UNION,free)(u1);
1026
0
  FN(UNION,free)(u2);
1027
0
  return isl_bool_error;
1028
79
}
isl_union_pw_multi_aff_plain_is_equal
Line
Count
Source
990
9
{
991
9
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
992
9
  int n1, n2;
993
9
994
9
  if (!u1 || !u2)
995
0
    return isl_bool_error;
996
9
  if (u1 == u2)
997
0
    return isl_bool_true;
998
9
  if (u1->table.n != u2->table.n)
999
0
    return isl_bool_false;
1000
9
  n1 = FN(FN(UNION,n),PARTS)(u1);
1001
9
  n2 = FN(FN(UNION,n),PARTS)(u2);
1002
9
  if (n1 < 0 || n2 < 0)
1003
0
    return isl_bool_error;
1004
9
  if (n1 != n2)
1005
0
    return isl_bool_false;
1006
9
1007
9
  u1 = FN(UNION,copy)(u1);
1008
9
  u2 = FN(UNION,copy)(u2);
1009
9
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1010
9
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1011
9
  if (!u1 || !u2)
1012
0
    goto error;
1013
9
1014
9
  data.u2 = u2;
1015
9
  if (FN(UNION,foreach_inplace)(u1,
1016
9
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1017
9
      
data.is_equal0
)
1018
0
    goto error;
1019
9
1020
9
  FN(UNION,free)(u1);
1021
9
  FN(UNION,free)(u2);
1022
9
1023
9
  return data.is_equal;
1024
9
error:
1025
0
  FN(UNION,free)(u1);
1026
0
  FN(UNION,free)(u2);
1027
0
  return isl_bool_error;
1028
9
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_plain_is_equal
isl_union_pw_qpolynomial_plain_is_equal
Line
Count
Source
990
1
{
991
1
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
992
1
  int n1, n2;
993
1
994
1
  if (!u1 || !u2)
995
0
    return isl_bool_error;
996
1
  if (u1 == u2)
997
0
    return isl_bool_true;
998
1
  if (u1->table.n != u2->table.n)
999
0
    return isl_bool_false;
1000
1
  n1 = FN(FN(UNION,n),PARTS)(u1);
1001
1
  n2 = FN(FN(UNION,n),PARTS)(u2);
1002
1
  if (n1 < 0 || n2 < 0)
1003
0
    return isl_bool_error;
1004
1
  if (n1 != n2)
1005
0
    return isl_bool_false;
1006
1
1007
1
  u1 = FN(UNION,copy)(u1);
1008
1
  u2 = FN(UNION,copy)(u2);
1009
1
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1010
1
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1011
1
  if (!u1 || !u2)
1012
0
    goto error;
1013
1
1014
1
  data.u2 = u2;
1015
1
  if (FN(UNION,foreach_inplace)(u1,
1016
1
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1017
1
      
data.is_equal0
)
1018
0
    goto error;
1019
1
1020
1
  FN(UNION,free)(u1);
1021
1
  FN(UNION,free)(u2);
1022
1
1023
1
  return data.is_equal;
1024
1
error:
1025
0
  FN(UNION,free)(u1);
1026
0
  FN(UNION,free)(u2);
1027
0
  return isl_bool_error;
1028
1
}
1029
1030
/* Check whether the element that "entry" points to involves any NaNs and
1031
 * store the result in *nan.
1032
 * Abort as soon as one such element has been found.
1033
 */
1034
static isl_stat FN(UNION,involves_nan_entry)(void **entry, void *user)
1035
0
{
1036
0
  isl_bool *nan = user;
1037
0
  PW *pw = *entry;
1038
0
1039
0
  *nan = FN(PW,involves_nan)(pw);
1040
0
  if (*nan < 0 || !nan)
1041
0
    return isl_stat_error;
1042
0
1043
0
  return isl_stat_ok;
1044
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
1045
1046
/* Does "u" involve any NaNs?
1047
 */
1048
isl_bool FN(UNION,involves_nan)(__isl_keep UNION *u)
1049
0
{
1050
0
  isl_bool nan = isl_bool_false;
1051
0
1052
0
  if (!u)
1053
0
    return isl_bool_error;
1054
0
1055
0
  if (FN(UNION,foreach_inplace)(u,
1056
0
            &FN(UNION,involves_nan_entry), &nan) < 0 &&
1057
0
      !nan)
1058
0
    return isl_bool_error;
1059
0
1060
0
  return nan;
1061
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
1062
1063
/* Internal data structure for isl_union_*_drop_dims.
1064
 * type, first and n are passed to isl_*_drop_dims.
1065
 */
1066
S(UNION,drop_dims_data) {
1067
  enum isl_dim_type type;
1068
  unsigned first;
1069
  unsigned n;
1070
};
1071
1072
/* Drop the parameters specified by "data" from "part" and return the result.
1073
 */
1074
static __isl_give PART *FN(UNION,drop_dims_entry)(__isl_take PART *part,
1075
  void *user)
1076
0
{
1077
0
  S(UNION,drop_dims_data) *data = user;
1078
0
1079
0
  return FN(PART,drop_dims)(part, data->type, data->first, data->n);
1080
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
1081
1082
/* Drop the specified parameters from "u".
1083
 * That is, type is required to be isl_dim_param.
1084
 */
1085
__isl_give UNION *FN(UNION,drop_dims)( __isl_take UNION *u,
1086
  enum isl_dim_type type, unsigned first, unsigned n)
1087
0
{
1088
0
  isl_space *space;
1089
0
  S(UNION,drop_dims_data) data = { type, first, n };
1090
0
1091
0
  if (!u)
1092
0
    return NULL;
1093
0
1094
0
  if (type != isl_dim_param)
1095
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
1096
0
      "can only project out parameters",
1097
0
      return FN(UNION,free)(u));
1098
0
1099
0
  space = FN(UNION,get_space)(u);
1100
0
  space = isl_space_drop_dims(space, type, first, n);
1101
0
  return FN(UNION,transform_space)(u, space, &FN(UNION,drop_dims_entry),
1102
0
          &data);
1103
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
1104
1105
/* Internal data structure for isl_union_*_set_dim_name.
1106
 * pos is the position of the parameter that needs to be renamed.
1107
 * s is the new name.
1108
 */
1109
S(UNION,set_dim_name_data) {
1110
  unsigned pos;
1111
  const char *s;
1112
};
1113
1114
/* Change the name of the parameter at position data->pos of "part" to data->s
1115
 * and return the result.
1116
 */
1117
static __isl_give PART *FN(UNION,set_dim_name_entry)(__isl_take PART *part,
1118
  void *user)
1119
0
{
1120
0
  S(UNION,set_dim_name_data) *data = user;
1121
0
1122
0
  return FN(PART,set_dim_name)(part, isl_dim_param, data->pos, data->s);
1123
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
1124
1125
/* Change the name of the parameter at position "pos" to "s".
1126
 * That is, type is required to be isl_dim_param.
1127
 */
1128
__isl_give UNION *FN(UNION,set_dim_name)(__isl_take UNION *u,
1129
  enum isl_dim_type type, unsigned pos, const char *s)
1130
0
{
1131
0
  S(UNION,set_dim_name_data) data = { pos, s };
1132
0
  isl_space *space;
1133
0
1134
0
  if (!u)
1135
0
    return NULL;
1136
0
1137
0
  if (type != isl_dim_param)
1138
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
1139
0
      "can only set parameter names",
1140
0
      return FN(UNION,free)(u));
1141
0
1142
0
  space = FN(UNION,get_space)(u);
1143
0
  space = isl_space_set_dim_name(space, type, pos, s);
1144
0
  return FN(UNION,transform_space)(u, space,
1145
0
          &FN(UNION,set_dim_name_entry), &data);
1146
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
1147
1148
/* Reset the user pointer on all identifiers of parameters and tuples
1149
 * of the space of "part" and return the result.
1150
 */
1151
static __isl_give PART *FN(UNION,reset_user_entry)(__isl_take PART *part,
1152
  void *user)
1153
0
{
1154
0
  return FN(PART,reset_user)(part);
1155
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
1156
1157
/* Reset the user pointer on all identifiers of parameters and tuples
1158
 * of the spaces of "u".
1159
 */
1160
__isl_give UNION *FN(UNION,reset_user)(__isl_take UNION *u)
1161
0
{
1162
0
  isl_space *space;
1163
0
1164
0
  space = FN(UNION,get_space)(u);
1165
0
  space = isl_space_reset_user(space);
1166
0
  return FN(UNION,transform_space)(u, space, &FN(UNION,reset_user_entry),
1167
0
          NULL);
1168
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