Coverage Report

Created: 2018-02-20 12:54

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_multi_templ.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2011      Sven Verdoolaege
3
 * Copyright 2012-2013 Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege,
8
 * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
9
 */
10
11
#include <isl_space_private.h>
12
#include <isl/set.h>
13
#include <isl_reordering.h>
14
15
#include <isl_multi_macro.h>
16
17
#define MULTI_NAME(BASE) "isl_multi_" #BASE
18
#define xLIST(EL) EL ## _list
19
#define LIST(EL) xLIST(EL)
20
21
isl_ctx *FN(MULTI(BASE),get_ctx)(__isl_keep MULTI(BASE) *multi)
22
89.6k
{
23
89.6k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
89.6k
}
isl_multi_aff_get_ctx
Line
Count
Source
22
35.8k
{
23
35.8k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
35.8k
}
isl_multi_pw_aff_get_ctx
Line
Count
Source
22
19.3k
{
23
19.3k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
19.3k
}
isl_multi_union_pw_aff_get_ctx
Line
Count
Source
22
25.7k
{
23
25.7k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
25.7k
}
isl_multi_val_get_ctx
Line
Count
Source
22
8.69k
{
23
8.69k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
8.69k
}
25
26
__isl_give isl_space *FN(MULTI(BASE),get_space)(__isl_keep MULTI(BASE) *multi)
27
1.24M
{
28
1.24M
  return multi ? isl_space_copy(multi->space) : NULL;
29
1.24M
}
isl_multi_aff_get_space
Line
Count
Source
27
1.16M
{
28
1.16M
  return multi ? isl_space_copy(multi->space) : NULL;
29
1.16M
}
isl_multi_pw_aff_get_space
Line
Count
Source
27
35.9k
{
28
35.9k
  return multi ? isl_space_copy(multi->space) : NULL;
29
35.9k
}
isl_multi_union_pw_aff_get_space
Line
Count
Source
27
27.0k
{
28
27.0k
  return multi ? isl_space_copy(multi->space) : NULL;
29
27.0k
}
isl_multi_val_get_space
Line
Count
Source
27
18.3k
{
28
18.3k
  return multi ? isl_space_copy(multi->space) : NULL;
29
18.3k
}
30
31
/* Return the position of the dimension of the given type and name
32
 * in "multi".
33
 * Return -1 if no such dimension can be found.
34
 */
35
int FN(MULTI(BASE),find_dim_by_name)(__isl_keep MULTI(BASE) *multi,
36
  enum isl_dim_type type, const char *name)
37
0
{
38
0
  if (!multi)
39
0
    return -1;
40
0
  return isl_space_find_dim_by_name(multi->space, type, name);
41
0
}
Unexecuted instantiation: isl_multi_aff_find_dim_by_name
Unexecuted instantiation: isl_multi_pw_aff_find_dim_by_name
Unexecuted instantiation: isl_multi_union_pw_aff_find_dim_by_name
Unexecuted instantiation: isl_multi_val_find_dim_by_name
42
43
__isl_give isl_space *FN(MULTI(BASE),get_domain_space)(
44
  __isl_keep MULTI(BASE) *multi)
45
80.1k
{
46
80.1k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
80.1k
}
isl_multi_aff_get_domain_space
Line
Count
Source
45
79.8k
{
46
79.8k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
79.8k
}
isl_multi_pw_aff_get_domain_space
Line
Count
Source
45
91
{
46
91
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
91
}
isl_multi_union_pw_aff_get_domain_space
Line
Count
Source
45
164
{
46
164
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
164
}
Unexecuted instantiation: isl_multi_val_get_domain_space
48
49
__isl_give MULTI(BASE) *FN(MULTI(BASE),alloc)(__isl_take isl_space *space)
50
184k
{
51
184k
  isl_ctx *ctx;
52
184k
  int n;
53
184k
  MULTI(BASE) *multi;
54
184k
55
184k
  if (!space)
56
0
    return NULL;
57
184k
58
184k
  ctx = isl_space_get_ctx(space);
59
184k
  n = isl_space_dim(space, isl_dim_out);
60
184k
  multi = isl_calloc(ctx, MULTI(BASE),
61
184k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
184k
  if (!multi)
63
0
    goto error;
64
184k
65
184k
  multi->space = space;
66
184k
  multi->n = n;
67
184k
  multi->ref = 1;
68
184k
  return multi;
69
184k
error:
70
0
  isl_space_free(space);
71
0
  return NULL;
72
184k
}
isl_multi_aff_alloc
Line
Count
Source
50
160k
{
51
160k
  isl_ctx *ctx;
52
160k
  int n;
53
160k
  MULTI(BASE) *multi;
54
160k
55
160k
  if (!space)
56
0
    return NULL;
57
160k
58
160k
  ctx = isl_space_get_ctx(space);
59
160k
  n = isl_space_dim(space, isl_dim_out);
60
160k
  multi = isl_calloc(ctx, MULTI(BASE),
61
160k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
160k
  if (!multi)
63
0
    goto error;
64
160k
65
160k
  multi->space = space;
66
160k
  multi->n = n;
67
160k
  multi->ref = 1;
68
160k
  return multi;
69
160k
error:
70
0
  isl_space_free(space);
71
0
  return NULL;
72
160k
}
isl_multi_pw_aff_alloc
Line
Count
Source
50
8.77k
{
51
8.77k
  isl_ctx *ctx;
52
8.77k
  int n;
53
8.77k
  MULTI(BASE) *multi;
54
8.77k
55
8.77k
  if (!space)
56
0
    return NULL;
57
8.77k
58
8.77k
  ctx = isl_space_get_ctx(space);
59
8.77k
  n = isl_space_dim(space, isl_dim_out);
60
8.77k
  multi = isl_calloc(ctx, MULTI(BASE),
61
8.77k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
8.77k
  if (!multi)
63
0
    goto error;
64
8.77k
65
8.77k
  multi->space = space;
66
8.77k
  multi->n = n;
67
8.77k
  multi->ref = 1;
68
8.77k
  return multi;
69
8.77k
error:
70
0
  isl_space_free(space);
71
0
  return NULL;
72
8.77k
}
isl_multi_union_pw_aff_alloc
Line
Count
Source
50
11.4k
{
51
11.4k
  isl_ctx *ctx;
52
11.4k
  int n;
53
11.4k
  MULTI(BASE) *multi;
54
11.4k
55
11.4k
  if (!space)
56
0
    return NULL;
57
11.4k
58
11.4k
  ctx = isl_space_get_ctx(space);
59
11.4k
  n = isl_space_dim(space, isl_dim_out);
60
11.4k
  multi = isl_calloc(ctx, MULTI(BASE),
61
11.4k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
11.4k
  if (!multi)
63
0
    goto error;
64
11.4k
65
11.4k
  multi->space = space;
66
11.4k
  multi->n = n;
67
11.4k
  multi->ref = 1;
68
11.4k
  return multi;
69
11.4k
error:
70
0
  isl_space_free(space);
71
0
  return NULL;
72
11.4k
}
isl_multi_val_alloc
Line
Count
Source
50
3.74k
{
51
3.74k
  isl_ctx *ctx;
52
3.74k
  int n;
53
3.74k
  MULTI(BASE) *multi;
54
3.74k
55
3.74k
  if (!space)
56
0
    return NULL;
57
3.74k
58
3.74k
  ctx = isl_space_get_ctx(space);
59
3.74k
  n = isl_space_dim(space, isl_dim_out);
60
3.74k
  multi = isl_calloc(ctx, MULTI(BASE),
61
3.74k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
3.74k
  if (!multi)
63
0
    goto error;
64
3.74k
65
3.74k
  multi->space = space;
66
3.74k
  multi->n = n;
67
3.74k
  multi->ref = 1;
68
3.74k
  return multi;
69
3.74k
error:
70
0
  isl_space_free(space);
71
0
  return NULL;
72
3.74k
}
73
74
__isl_give MULTI(BASE) *FN(MULTI(BASE),dup)(__isl_keep MULTI(BASE) *multi)
75
128k
{
76
128k
  int i;
77
128k
  MULTI(BASE) *dup;
78
128k
79
128k
  if (!multi)
80
0
    return NULL;
81
128k
82
128k
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
128k
  if (!dup)
84
0
    return NULL;
85
128k
86
998k
  
for (i = 0; 128k
i < multi->n;
++i870k
)
87
870k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
88
870k
                FN(EL,copy)(multi->p[i]));
89
128k
90
128k
  return dup;
91
128k
}
isl_multi_aff_dup
Line
Count
Source
75
125k
{
76
125k
  int i;
77
125k
  MULTI(BASE) *dup;
78
125k
79
125k
  if (!multi)
80
0
    return NULL;
81
125k
82
125k
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
125k
  if (!dup)
84
0
    return NULL;
85
125k
86
991k
  
for (i = 0; 125k
i < multi->n;
++i865k
)
87
865k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
88
865k
                FN(EL,copy)(multi->p[i]));
89
125k
90
125k
  return dup;
91
125k
}
Unexecuted instantiation: isl_multi_pw_aff_dup
isl_multi_union_pw_aff_dup
Line
Count
Source
75
2.86k
{
76
2.86k
  int i;
77
2.86k
  MULTI(BASE) *dup;
78
2.86k
79
2.86k
  if (!multi)
80
0
    return NULL;
81
2.86k
82
2.86k
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
2.86k
  if (!dup)
84
0
    return NULL;
85
2.86k
86
6.64k
  
for (i = 0; 2.86k
i < multi->n;
++i3.78k
)
87
3.78k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
88
3.78k
                FN(EL,copy)(multi->p[i]));
89
2.86k
90
2.86k
  return dup;
91
2.86k
}
isl_multi_val_dup
Line
Count
Source
75
167
{
76
167
  int i;
77
167
  MULTI(BASE) *dup;
78
167
79
167
  if (!multi)
80
0
    return NULL;
81
167
82
167
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
167
  if (!dup)
84
0
    return NULL;
85
167
86
584
  
for (i = 0; 167
i < multi->n;
++i417
)
87
417
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
88
417
                FN(EL,copy)(multi->p[i]));
89
167
90
167
  return dup;
91
167
}
92
93
__isl_give MULTI(BASE) *FN(MULTI(BASE),cow)(__isl_take MULTI(BASE) *multi)
94
1.15M
{
95
1.15M
  if (!multi)
96
0
    return NULL;
97
1.15M
98
1.15M
  if (multi->ref == 1)
99
1.02M
    return multi;
100
128k
101
128k
  multi->ref--;
102
128k
  return FN(MULTI(BASE),dup)(multi);
103
128k
}
isl_multi_aff_cow
Line
Count
Source
94
1.08M
{
95
1.08M
  if (!multi)
96
0
    return NULL;
97
1.08M
98
1.08M
  if (multi->ref == 1)
99
958k
    return multi;
100
125k
101
125k
  multi->ref--;
102
125k
  return FN(MULTI(BASE),dup)(multi);
103
125k
}
isl_multi_pw_aff_cow
Line
Count
Source
94
44.1k
{
95
44.1k
  if (!multi)
96
0
    return NULL;
97
44.1k
98
44.1k
  if (multi->ref == 1)
99
44.1k
    return multi;
100
0
101
0
  multi->ref--;
102
0
  return FN(MULTI(BASE),dup)(multi);
103
0
}
isl_multi_union_pw_aff_cow
Line
Count
Source
94
16.4k
{
95
16.4k
  if (!multi)
96
0
    return NULL;
97
16.4k
98
16.4k
  if (multi->ref == 1)
99
13.6k
    return multi;
100
2.86k
101
2.86k
  multi->ref--;
102
2.86k
  return FN(MULTI(BASE),dup)(multi);
103
2.86k
}
isl_multi_val_cow
Line
Count
Source
94
11.3k
{
95
11.3k
  if (!multi)
96
0
    return NULL;
97
11.3k
98
11.3k
  if (multi->ref == 1)
99
11.1k
    return multi;
100
167
101
167
  multi->ref--;
102
167
  return FN(MULTI(BASE),dup)(multi);
103
167
}
104
105
__isl_give MULTI(BASE) *FN(MULTI(BASE),copy)(__isl_keep MULTI(BASE) *multi)
106
280k
{
107
280k
  if (!multi)
108
522
    return NULL;
109
280k
110
280k
  multi->ref++;
111
280k
  return multi;
112
280k
}
isl_multi_aff_copy
Line
Count
Source
106
250k
{
107
250k
  if (!multi)
108
522
    return NULL;
109
250k
110
250k
  multi->ref++;
111
250k
  return multi;
112
250k
}
isl_multi_pw_aff_copy
Line
Count
Source
106
2
{
107
2
  if (!multi)
108
0
    return NULL;
109
2
110
2
  multi->ref++;
111
2
  return multi;
112
2
}
isl_multi_union_pw_aff_copy
Line
Count
Source
106
17.5k
{
107
17.5k
  if (!multi)
108
0
    return NULL;
109
17.5k
110
17.5k
  multi->ref++;
111
17.5k
  return multi;
112
17.5k
}
isl_multi_val_copy
Line
Count
Source
106
12.7k
{
107
12.7k
  if (!multi)
108
0
    return NULL;
109
12.7k
110
12.7k
  multi->ref++;
111
12.7k
  return multi;
112
12.7k
}
113
114
__isl_null MULTI(BASE) *FN(MULTI(BASE),free)(__isl_take MULTI(BASE) *multi)
115
381k
{
116
381k
  int i;
117
381k
118
381k
  if (!multi)
119
45.0k
    return NULL;
120
336k
121
336k
  if (--multi->ref > 0)
122
152k
    return NULL;
123
184k
124
184k
  isl_space_free(multi->space);
125
1.14M
  for (i = 0; i < multi->n; 
++i964k
)
126
964k
    FN(EL,free)(multi->p[i]);
127
184k
  free(multi);
128
184k
129
184k
  return NULL;
130
184k
}
isl_multi_aff_free
Line
Count
Source
115
330k
{
116
330k
  int i;
117
330k
118
330k
  if (!multi)
119
45.0k
    return NULL;
120
285k
121
285k
  if (--multi->ref > 0)
122
124k
    return NULL;
123
160k
124
160k
  isl_space_free(multi->space);
125
1.09M
  for (i = 0; i < multi->n; 
++i934k
)
126
934k
    FN(EL,free)(multi->p[i]);
127
160k
  free(multi);
128
160k
129
160k
  return NULL;
130
160k
}
isl_multi_pw_aff_free
Line
Count
Source
115
8.77k
{
116
8.77k
  int i;
117
8.77k
118
8.77k
  if (!multi)
119
0
    return NULL;
120
8.77k
121
8.77k
  if (--multi->ref > 0)
122
2
    return NULL;
123
8.77k
124
8.77k
  isl_space_free(multi->space);
125
23.1k
  for (i = 0; i < multi->n; 
++i14.3k
)
126
14.3k
    FN(EL,free)(multi->p[i]);
127
8.77k
  free(multi);
128
8.77k
129
8.77k
  return NULL;
130
8.77k
}
isl_multi_union_pw_aff_free
Line
Count
Source
115
26.1k
{
116
26.1k
  int i;
117
26.1k
118
26.1k
  if (!multi)
119
0
    return NULL;
120
26.1k
121
26.1k
  if (--multi->ref > 0)
122
14.6k
    return NULL;
123
11.4k
124
11.4k
  isl_space_free(multi->space);
125
21.7k
  for (i = 0; i < multi->n; 
++i10.2k
)
126
11.4k
    
FN10.2k
(EL,free)(multi->p[i])10.2k
;
127
11.4k
  free(multi);
128
11.4k
129
11.4k
  return NULL;
130
11.4k
}
isl_multi_val_free
Line
Count
Source
115
16.2k
{
116
16.2k
  int i;
117
16.2k
118
16.2k
  if (!multi)
119
4
    return NULL;
120
16.2k
121
16.2k
  if (--multi->ref > 0)
122
12.5k
    return NULL;
123
3.74k
124
3.74k
  isl_space_free(multi->space);
125
9.21k
  for (i = 0; i < multi->n; 
++i5.46k
)
126
5.46k
    FN(EL,free)(multi->p[i]);
127
3.74k
  free(multi);
128
3.74k
129
3.74k
  return NULL;
130
3.74k
}
131
132
unsigned FN(MULTI(BASE),dim)(__isl_keep MULTI(BASE) *multi,
133
  enum isl_dim_type type)
134
1.34M
{
135
1.34M
  return multi ? isl_space_dim(multi->space, type) : 
00
;
136
1.34M
}
isl_multi_aff_dim
Line
Count
Source
134
1.29M
{
135
1.29M
  return multi ? isl_space_dim(multi->space, type) : 
00
;
136
1.29M
}
isl_multi_pw_aff_dim
Line
Count
Source
134
11.8k
{
135
11.8k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
136
11.8k
}
isl_multi_union_pw_aff_dim
Line
Count
Source
134
24.4k
{
135
24.4k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
136
24.4k
}
isl_multi_val_dim
Line
Count
Source
134
8.07k
{
135
8.07k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
136
8.07k
}
137
138
/* Return the position of the first dimension of "type" with id "id".
139
 * Return -1 if there is no such dimension.
140
 */
141
int FN(MULTI(BASE),find_dim_by_id)(__isl_keep MULTI(BASE) *multi,
142
  enum isl_dim_type type, __isl_keep isl_id *id)
143
0
{
144
0
  if (!multi)
145
0
    return -1;
146
0
  return isl_space_find_dim_by_id(multi->space, type, id);
147
0
}
Unexecuted instantiation: isl_multi_aff_find_dim_by_id
Unexecuted instantiation: isl_multi_pw_aff_find_dim_by_id
Unexecuted instantiation: isl_multi_union_pw_aff_find_dim_by_id
Unexecuted instantiation: isl_multi_val_find_dim_by_id
148
149
/* Return the id of the given dimension.
150
 */
151
__isl_give isl_id *FN(MULTI(BASE),get_dim_id)(__isl_keep MULTI(BASE) *multi,
152
  enum isl_dim_type type, unsigned pos)
153
0
{
154
0
  return multi ? isl_space_get_dim_id(multi->space, type, pos) : NULL;
155
0
}
Unexecuted instantiation: isl_multi_aff_get_dim_id
Unexecuted instantiation: isl_multi_pw_aff_get_dim_id
Unexecuted instantiation: isl_multi_union_pw_aff_get_dim_id
Unexecuted instantiation: isl_multi_val_get_dim_id
156
157
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_name)(
158
  __isl_take MULTI(BASE) *multi,
159
  enum isl_dim_type type, unsigned pos, const char *s)
160
0
{
161
0
  int i;
162
0
163
0
  multi = FN(MULTI(BASE),cow)(multi);
164
0
  if (!multi)
165
0
    return NULL;
166
0
167
0
  multi->space = isl_space_set_dim_name(multi->space, type, pos, s);
168
0
  if (!multi->space)
169
0
    return FN(MULTI(BASE),free)(multi);
170
0
171
0
  if (type == isl_dim_out)
172
0
    return multi;
173
0
  for (i = 0; i < multi->n; ++i) {
174
0
    multi->p[i] = FN(EL,set_dim_name)(multi->p[i], type, pos, s);
175
0
    if (!multi->p[i])
176
0
      return FN(MULTI(BASE),free)(multi);
177
0
  }
178
0
179
0
  return multi;
180
0
}
Unexecuted instantiation: isl_multi_aff_set_dim_name
Unexecuted instantiation: isl_multi_pw_aff_set_dim_name
Unexecuted instantiation: isl_multi_union_pw_aff_set_dim_name
Unexecuted instantiation: isl_multi_val_set_dim_name
181
182
const char *FN(MULTI(BASE),get_tuple_name)(__isl_keep MULTI(BASE) *multi,
183
  enum isl_dim_type type)
184
0
{
185
0
  return multi ? isl_space_get_tuple_name(multi->space, type) : NULL;
186
0
}
Unexecuted instantiation: isl_multi_aff_get_tuple_name
Unexecuted instantiation: isl_multi_pw_aff_get_tuple_name
Unexecuted instantiation: isl_multi_union_pw_aff_get_tuple_name
Unexecuted instantiation: isl_multi_val_get_tuple_name
187
188
/* Does the specified tuple have an id?
189
 */
190
isl_bool FN(MULTI(BASE),has_tuple_id)(__isl_keep MULTI(BASE) *multi,
191
  enum isl_dim_type type)
192
5.46k
{
193
5.46k
  if (!multi)
194
0
    return isl_bool_error;
195
5.46k
  return isl_space_has_tuple_id(multi->space, type);
196
5.46k
}
Unexecuted instantiation: isl_multi_aff_has_tuple_id
isl_multi_pw_aff_has_tuple_id
Line
Count
Source
192
3.14k
{
193
3.14k
  if (!multi)
194
0
    return isl_bool_error;
195
3.14k
  return isl_space_has_tuple_id(multi->space, type);
196
3.14k
}
isl_multi_union_pw_aff_has_tuple_id
Line
Count
Source
192
2.32k
{
193
2.32k
  if (!multi)
194
0
    return isl_bool_error;
195
2.32k
  return isl_space_has_tuple_id(multi->space, type);
196
2.32k
}
Unexecuted instantiation: isl_multi_val_has_tuple_id
197
198
/* Return the id of the specified tuple.
199
 */
200
__isl_give isl_id *FN(MULTI(BASE),get_tuple_id)(__isl_keep MULTI(BASE) *multi,
201
  enum isl_dim_type type)
202
3.14k
{
203
3.14k
  return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
204
3.14k
}
Unexecuted instantiation: isl_multi_aff_get_tuple_id
isl_multi_pw_aff_get_tuple_id
Line
Count
Source
202
3.14k
{
203
3.14k
  return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
204
3.14k
}
Unexecuted instantiation: isl_multi_union_pw_aff_get_tuple_id
Unexecuted instantiation: isl_multi_val_get_tuple_id
205
206
__isl_give EL *FN(FN(MULTI(BASE),get),BASE)(__isl_keep MULTI(BASE) *multi,
207
  int pos)
208
78.9k
{
209
78.9k
  isl_ctx *ctx;
210
78.9k
211
78.9k
  if (!multi)
212
0
    return NULL;
213
78.9k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
214
78.9k
  if (pos < 0 || pos >= multi->n)
215
78.9k
    
isl_die0
(ctx, isl_error_invalid,
216
78.9k
      "index out of bounds", return NULL);
217
78.9k
  return FN(EL,copy)(multi->p[pos]);
218
78.9k
}
isl_multi_aff_get_aff
Line
Count
Source
208
35.8k
{
209
35.8k
  isl_ctx *ctx;
210
35.8k
211
35.8k
  if (!multi)
212
0
    return NULL;
213
35.8k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
214
35.8k
  if (pos < 0 || pos >= multi->n)
215
35.8k
    
isl_die0
(ctx, isl_error_invalid,
216
35.8k
      "index out of bounds", return NULL);
217
35.8k
  return FN(EL,copy)(multi->p[pos]);
218
35.8k
}
isl_multi_pw_aff_get_pw_aff
Line
Count
Source
208
14.3k
{
209
14.3k
  isl_ctx *ctx;
210
14.3k
211
14.3k
  if (!multi)
212
0
    return NULL;
213
14.3k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
214
14.3k
  if (pos < 0 || pos >= multi->n)
215
14.3k
    
isl_die0
(ctx, isl_error_invalid,
216
14.3k
      "index out of bounds", return NULL);
217
14.3k
  return FN(EL,copy)(multi->p[pos]);
218
14.3k
}
isl_multi_union_pw_aff_get_union_pw_aff
Line
Count
Source
208
20.1k
{
209
20.1k
  isl_ctx *ctx;
210
20.1k
211
20.1k
  if (!multi)
212
0
    return NULL;
213
20.1k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
214
20.1k
  if (pos < 0 || pos >= multi->n)
215
20.1k
    
isl_die0
(ctx, isl_error_invalid,
216
20.1k
      "index out of bounds", return NULL);
217
20.1k
  return FN(EL,copy)(multi->p[pos]);
218
20.1k
}
isl_multi_val_get_val
Line
Count
Source
208
8.61k
{
209
8.61k
  isl_ctx *ctx;
210
8.61k
211
8.61k
  if (!multi)
212
0
    return NULL;
213
8.61k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
214
8.61k
  if (pos < 0 || pos >= multi->n)
215
8.61k
    
isl_die0
(ctx, isl_error_invalid,
216
8.61k
      "index out of bounds", return NULL);
217
8.61k
  return FN(EL,copy)(multi->p[pos]);
218
8.61k
}
219
220
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),set),BASE)(
221
  __isl_take MULTI(BASE) *multi, int pos, __isl_take EL *el)
222
978k
{
223
978k
  isl_space *multi_space = NULL;
224
978k
  isl_space *el_space = NULL;
225
978k
  isl_bool match;
226
978k
227
978k
  multi = FN(MULTI(BASE),cow)(multi);
228
978k
  if (!multi || !el)
229
0
    goto error;
230
978k
231
978k
  multi_space = FN(MULTI(BASE),get_space)(multi);
232
978k
  match = FN(EL,matching_params)(el, multi_space);
233
978k
  if (match < 0)
234
0
    goto error;
235
978k
  if (!match) {
236
0
    multi = FN(MULTI(BASE),align_params)(multi,
237
0
                FN(EL,get_space)(el));
238
0
    isl_space_free(multi_space);
239
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
240
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
241
0
  }
242
978k
  if (FN(EL,check_match_domain_space)(el, multi_space) < 0)
243
0
    goto error;
244
978k
245
978k
  if (pos < 0 || pos >= multi->n)
246
978k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
247
978k
      "index out of bounds", goto error);
248
978k
249
978k
  FN(EL,free)(multi->p[pos]);
250
978k
  multi->p[pos] = el;
251
978k
252
978k
  isl_space_free(multi_space);
253
978k
  isl_space_free(el_space);
254
978k
255
978k
  return multi;
256
978k
error:
257
0
  FN(MULTI(BASE),free)(multi);
258
0
  FN(EL,free)(el);
259
0
  isl_space_free(multi_space);
260
0
  isl_space_free(el_space);
261
0
  return NULL;
262
978k
}
isl_multi_aff_set_aff
Line
Count
Source
222
941k
{
223
941k
  isl_space *multi_space = NULL;
224
941k
  isl_space *el_space = NULL;
225
941k
  isl_bool match;
226
941k
227
941k
  multi = FN(MULTI(BASE),cow)(multi);
228
941k
  if (!multi || !el)
229
0
    goto error;
230
941k
231
941k
  multi_space = FN(MULTI(BASE),get_space)(multi);
232
941k
  match = FN(EL,matching_params)(el, multi_space);
233
941k
  if (match < 0)
234
0
    goto error;
235
941k
  if (!match) {
236
0
    multi = FN(MULTI(BASE),align_params)(multi,
237
0
                FN(EL,get_space)(el));
238
0
    isl_space_free(multi_space);
239
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
240
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
241
0
  }
242
941k
  if (FN(EL,check_match_domain_space)(el, multi_space) < 0)
243
0
    goto error;
244
941k
245
941k
  if (pos < 0 || pos >= multi->n)
246
941k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
247
941k
      "index out of bounds", goto error);
248
941k
249
941k
  FN(EL,free)(multi->p[pos]);
250
941k
  multi->p[pos] = el;
251
941k
252
941k
  isl_space_free(multi_space);
253
941k
  isl_space_free(el_space);
254
941k
255
941k
  return multi;
256
941k
error:
257
0
  FN(MULTI(BASE),free)(multi);
258
0
  FN(EL,free)(el);
259
0
  isl_space_free(multi_space);
260
0
  isl_space_free(el_space);
261
0
  return NULL;
262
941k
}
isl_multi_pw_aff_set_pw_aff
Line
Count
Source
222
14.3k
{
223
14.3k
  isl_space *multi_space = NULL;
224
14.3k
  isl_space *el_space = NULL;
225
14.3k
  isl_bool match;
226
14.3k
227
14.3k
  multi = FN(MULTI(BASE),cow)(multi);
228
14.3k
  if (!multi || !el)
229
0
    goto error;
230
14.3k
231
14.3k
  multi_space = FN(MULTI(BASE),get_space)(multi);
232
14.3k
  match = FN(EL,matching_params)(el, multi_space);
233
14.3k
  if (match < 0)
234
0
    goto error;
235
14.3k
  if (!match) {
236
0
    multi = FN(MULTI(BASE),align_params)(multi,
237
0
                FN(EL,get_space)(el));
238
0
    isl_space_free(multi_space);
239
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
240
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
241
0
  }
242
14.3k
  if (FN(EL,check_match_domain_space)(el, multi_space) < 0)
243
0
    goto error;
244
14.3k
245
14.3k
  if (pos < 0 || pos >= multi->n)
246
14.3k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
247
14.3k
      "index out of bounds", goto error);
248
14.3k
249
14.3k
  FN(EL,free)(multi->p[pos]);
250
14.3k
  multi->p[pos] = el;
251
14.3k
252
14.3k
  isl_space_free(multi_space);
253
14.3k
  isl_space_free(el_space);
254
14.3k
255
14.3k
  return multi;
256
14.3k
error:
257
0
  FN(MULTI(BASE),free)(multi);
258
0
  FN(EL,free)(el);
259
0
  isl_space_free(multi_space);
260
0
  isl_space_free(el_space);
261
0
  return NULL;
262
14.3k
}
isl_multi_union_pw_aff_set_union_pw_aff
Line
Count
Source
222
11.0k
{
223
11.0k
  isl_space *multi_space = NULL;
224
11.0k
  isl_space *el_space = NULL;
225
11.0k
  isl_bool match;
226
11.0k
227
11.0k
  multi = FN(MULTI(BASE),cow)(multi);
228
11.0k
  if (!multi || !el)
229
0
    goto error;
230
11.0k
231
11.0k
  multi_space = FN(MULTI(BASE),get_space)(multi);
232
11.0k
  match = FN(EL,matching_params)(el, multi_space);
233
11.0k
  if (match < 0)
234
0
    goto error;
235
11.0k
  if (!match) {
236
0
    multi = FN(MULTI(BASE),align_params)(multi,
237
0
                FN(EL,get_space)(el));
238
0
    isl_space_free(multi_space);
239
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
240
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
241
0
  }
242
11.0k
  if (FN(EL,check_match_domain_space)(el, multi_space) < 0)
243
0
    goto error;
244
11.0k
245
11.0k
  if (pos < 0 || pos >= multi->n)
246
11.0k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
247
11.0k
      "index out of bounds", goto error);
248
11.0k
249
11.0k
  FN(EL,free)(multi->p[pos]);
250
11.0k
  multi->p[pos] = el;
251
11.0k
252
11.0k
  isl_space_free(multi_space);
253
11.0k
  isl_space_free(el_space);
254
11.0k
255
11.0k
  return multi;
256
11.0k
error:
257
0
  FN(MULTI(BASE),free)(multi);
258
0
  FN(EL,free)(el);
259
0
  isl_space_free(multi_space);
260
0
  isl_space_free(el_space);
261
0
  return NULL;
262
11.0k
}
isl_multi_val_set_val
Line
Count
Source
222
11.3k
{
223
11.3k
  isl_space *multi_space = NULL;
224
11.3k
  isl_space *el_space = NULL;
225
11.3k
  isl_bool match;
226
11.3k
227
11.3k
  multi = FN(MULTI(BASE),cow)(multi);
228
11.3k
  if (!multi || !el)
229
0
    goto error;
230
11.3k
231
11.3k
  multi_space = FN(MULTI(BASE),get_space)(multi);
232
11.3k
  match = FN(EL,matching_params)(el, multi_space);
233
11.3k
  if (match < 0)
234
0
    goto error;
235
11.3k
  if (!match) {
236
0
    multi = FN(MULTI(BASE),align_params)(multi,
237
0
                FN(EL,get_space)(el));
238
0
    isl_space_free(multi_space);
239
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
240
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
241
0
  }
242
11.3k
  if (FN(EL,check_match_domain_space)(el, multi_space) < 0)
243
0
    goto error;
244
11.3k
245
11.3k
  if (pos < 0 || pos >= multi->n)
246
11.3k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
247
11.3k
      "index out of bounds", goto error);
248
11.3k
249
11.3k
  FN(EL,free)(multi->p[pos]);
250
11.3k
  multi->p[pos] = el;
251
11.3k
252
11.3k
  isl_space_free(multi_space);
253
11.3k
  isl_space_free(el_space);
254
11.3k
255
11.3k
  return multi;
256
11.3k
error:
257
0
  FN(MULTI(BASE),free)(multi);
258
0
  FN(EL,free)(el);
259
0
  isl_space_free(multi_space);
260
0
  isl_space_free(el_space);
261
0
  return NULL;
262
11.3k
}
263
264
/* Reset the space of "multi".  This function is called from isl_pw_templ.c
265
 * and doesn't know if the space of an element object is represented
266
 * directly or through its domain.  It therefore passes along both,
267
 * which we pass along to the element function since we don't know how
268
 * that is represented either.
269
 */
270
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space_and_domain)(
271
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space,
272
  __isl_take isl_space *domain)
273
19.9k
{
274
19.9k
  int i;
275
19.9k
276
19.9k
  multi = FN(MULTI(BASE),cow)(multi);
277
19.9k
  if (!multi || !space || !domain)
278
0
    goto error;
279
19.9k
280
73.8k
  
for (i = 0; 19.9k
i < multi->n;
++i53.8k
) {
281
53.8k
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
282
53.8k
         isl_space_copy(domain));
283
53.8k
    if (!multi->p[i])
284
0
      goto error;
285
53.8k
  }
286
19.9k
  isl_space_free(domain);
287
19.9k
  isl_space_free(multi->space);
288
19.9k
  multi->space = space;
289
19.9k
290
19.9k
  return multi;
291
19.9k
error:
292
0
  isl_space_free(domain);
293
0
  isl_space_free(space);
294
0
  FN(MULTI(BASE),free)(multi);
295
0
  return NULL;
296
19.9k
}
isl_multi_aff_reset_space_and_domain
Line
Count
Source
273
5.01k
{
274
5.01k
  int i;
275
5.01k
276
5.01k
  multi = FN(MULTI(BASE),cow)(multi);
277
5.01k
  if (!multi || !space || !domain)
278
0
    goto error;
279
5.01k
280
16.9k
  
for (i = 0; 5.01k
i < multi->n;
++i11.9k
) {
281
11.9k
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
282
11.9k
         isl_space_copy(domain));
283
11.9k
    if (!multi->p[i])
284
0
      goto error;
285
11.9k
  }
286
5.01k
  isl_space_free(domain);
287
5.01k
  isl_space_free(multi->space);
288
5.01k
  multi->space = space;
289
5.01k
290
5.01k
  return multi;
291
5.01k
error:
292
0
  isl_space_free(domain);
293
0
  isl_space_free(space);
294
0
  FN(MULTI(BASE),free)(multi);
295
0
  return NULL;
296
5.01k
}
isl_multi_pw_aff_reset_space_and_domain
Line
Count
Source
273
14.7k
{
274
14.7k
  int i;
275
14.7k
276
14.7k
  multi = FN(MULTI(BASE),cow)(multi);
277
14.7k
  if (!multi || !space || !domain)
278
0
    goto error;
279
14.7k
280
56.5k
  
for (i = 0; 14.7k
i < multi->n;
++i41.7k
) {
281
41.7k
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
282
41.7k
         isl_space_copy(domain));
283
41.7k
    if (!multi->p[i])
284
0
      goto error;
285
41.7k
  }
286
14.7k
  isl_space_free(domain);
287
14.7k
  isl_space_free(multi->space);
288
14.7k
  multi->space = space;
289
14.7k
290
14.7k
  return multi;
291
14.7k
error:
292
0
  isl_space_free(domain);
293
0
  isl_space_free(space);
294
0
  FN(MULTI(BASE),free)(multi);
295
0
  return NULL;
296
14.7k
}
isl_multi_union_pw_aff_reset_space_and_domain
Line
Count
Source
273
181
{
274
181
  int i;
275
181
276
181
  multi = FN(MULTI(BASE),cow)(multi);
277
181
  if (!multi || !space || !domain)
278
0
    goto error;
279
181
280
390
  
for (i = 0; 181
i < multi->n;
++i209
) {
281
209
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
282
209
         isl_space_copy(domain));
283
209
    if (!multi->p[i])
284
0
      goto error;
285
209
  }
286
181
  isl_space_free(domain);
287
181
  isl_space_free(multi->space);
288
181
  multi->space = space;
289
181
290
181
  return multi;
291
181
error:
292
0
  isl_space_free(domain);
293
0
  isl_space_free(space);
294
0
  FN(MULTI(BASE),free)(multi);
295
0
  return NULL;
296
181
}
Unexecuted instantiation: isl_multi_val_reset_space_and_domain
297
298
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_domain_space)(
299
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *domain)
300
174
{
301
174
  isl_space *space;
302
174
303
174
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
304
174
            isl_space_copy(multi->space));
305
174
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
306
174
}
isl_multi_aff_reset_domain_space
Line
Count
Source
300
10
{
301
10
  isl_space *space;
302
10
303
10
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
304
10
            isl_space_copy(multi->space));
305
10
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
306
10
}
Unexecuted instantiation: isl_multi_pw_aff_reset_domain_space
isl_multi_union_pw_aff_reset_domain_space
Line
Count
Source
300
164
{
301
164
  isl_space *space;
302
164
303
164
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
304
164
            isl_space_copy(multi->space));
305
164
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
306
164
}
Unexecuted instantiation: isl_multi_val_reset_domain_space
307
308
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space)(
309
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
310
17.2k
{
311
17.2k
  isl_space *domain;
312
17.2k
313
17.2k
  domain = isl_space_domain(isl_space_copy(space));
314
17.2k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
315
17.2k
}
isl_multi_aff_reset_space
Line
Count
Source
310
2.40k
{
311
2.40k
  isl_space *domain;
312
2.40k
313
2.40k
  domain = isl_space_domain(isl_space_copy(space));
314
2.40k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
315
2.40k
}
isl_multi_pw_aff_reset_space
Line
Count
Source
310
14.7k
{
311
14.7k
  isl_space *domain;
312
14.7k
313
14.7k
  domain = isl_space_domain(isl_space_copy(space));
314
14.7k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
315
14.7k
}
isl_multi_union_pw_aff_reset_space
Line
Count
Source
310
17
{
311
17
  isl_space *domain;
312
17
313
17
  domain = isl_space_domain(isl_space_copy(space));
314
17
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
315
17
}
Unexecuted instantiation: isl_multi_val_reset_space
316
317
/* Set the id of the given dimension of "multi" to "id".
318
 */
319
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_id)(
320
  __isl_take MULTI(BASE) *multi,
321
  enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
322
14.7k
{
323
14.7k
  isl_space *space;
324
14.7k
325
14.7k
  multi = FN(MULTI(BASE),cow)(multi);
326
14.7k
  if (!multi || !id)
327
0
    goto error;
328
14.7k
329
14.7k
  space = FN(MULTI(BASE),get_space)(multi);
330
14.7k
  space = isl_space_set_dim_id(space, type, pos, id);
331
14.7k
332
14.7k
  return FN(MULTI(BASE),reset_space)(multi, space);
333
14.7k
error:
334
0
  isl_id_free(id);
335
0
  FN(MULTI(BASE),free)(multi);
336
0
  return NULL;
337
14.7k
}
Unexecuted instantiation: isl_multi_aff_set_dim_id
isl_multi_pw_aff_set_dim_id
Line
Count
Source
322
14.7k
{
323
14.7k
  isl_space *space;
324
14.7k
325
14.7k
  multi = FN(MULTI(BASE),cow)(multi);
326
14.7k
  if (!multi || !id)
327
0
    goto error;
328
14.7k
329
14.7k
  space = FN(MULTI(BASE),get_space)(multi);
330
14.7k
  space = isl_space_set_dim_id(space, type, pos, id);
331
14.7k
332
14.7k
  return FN(MULTI(BASE),reset_space)(multi, space);
333
14.7k
error:
334
0
  isl_id_free(id);
335
0
  FN(MULTI(BASE),free)(multi);
336
0
  return NULL;
337
14.7k
}
Unexecuted instantiation: isl_multi_union_pw_aff_set_dim_id
Unexecuted instantiation: isl_multi_val_set_dim_id
338
339
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_name)(
340
  __isl_keep MULTI(BASE) *multi, enum isl_dim_type type,
341
  const char *s)
342
0
{
343
0
  isl_space *space;
344
0
345
0
  multi = FN(MULTI(BASE),cow)(multi);
346
0
  if (!multi)
347
0
    return NULL;
348
0
349
0
  space = FN(MULTI(BASE),get_space)(multi);
350
0
  space = isl_space_set_tuple_name(space, type, s);
351
0
352
0
  return FN(MULTI(BASE),reset_space)(multi, space);
353
0
}
Unexecuted instantiation: isl_multi_aff_set_tuple_name
Unexecuted instantiation: isl_multi_pw_aff_set_tuple_name
Unexecuted instantiation: isl_multi_union_pw_aff_set_tuple_name
Unexecuted instantiation: isl_multi_val_set_tuple_name
354
355
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_id)(
356
  __isl_take MULTI(BASE) *multi, enum isl_dim_type type,
357
  __isl_take isl_id *id)
358
116
{
359
116
  isl_space *space;
360
116
361
116
  multi = FN(MULTI(BASE),cow)(multi);
362
116
  if (!multi)
363
0
    goto error;
364
116
365
116
  space = FN(MULTI(BASE),get_space)(multi);
366
116
  space = isl_space_set_tuple_id(space, type, id);
367
116
368
116
  return FN(MULTI(BASE),reset_space)(multi, space);
369
116
error:
370
0
  isl_id_free(id);
371
0
  return NULL;
372
116
}
isl_multi_aff_set_tuple_id
Line
Count
Source
358
113
{
359
113
  isl_space *space;
360
113
361
113
  multi = FN(MULTI(BASE),cow)(multi);
362
113
  if (!multi)
363
0
    goto error;
364
113
365
113
  space = FN(MULTI(BASE),get_space)(multi);
366
113
  space = isl_space_set_tuple_id(space, type, id);
367
113
368
113
  return FN(MULTI(BASE),reset_space)(multi, space);
369
113
error:
370
0
  isl_id_free(id);
371
0
  return NULL;
372
113
}
Unexecuted instantiation: isl_multi_pw_aff_set_tuple_id
isl_multi_union_pw_aff_set_tuple_id
Line
Count
Source
358
3
{
359
3
  isl_space *space;
360
3
361
3
  multi = FN(MULTI(BASE),cow)(multi);
362
3
  if (!multi)
363
0
    goto error;
364
3
365
3
  space = FN(MULTI(BASE),get_space)(multi);
366
3
  space = isl_space_set_tuple_id(space, type, id);
367
3
368
3
  return FN(MULTI(BASE),reset_space)(multi, space);
369
3
error:
370
0
  isl_id_free(id);
371
0
  return NULL;
372
3
}
Unexecuted instantiation: isl_multi_val_set_tuple_id
373
374
/* Drop the id on the specified tuple.
375
 */
376
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_tuple_id)(
377
  __isl_take MULTI(BASE) *multi, enum isl_dim_type type)
378
2.31k
{
379
2.31k
  isl_space *space;
380
2.31k
381
2.31k
  if (!multi)
382
0
    return NULL;
383
2.31k
  if (!FN(MULTI(BASE),has_tuple_id)(multi, type))
384
2.30k
    return multi;
385
14
386
14
  multi = FN(MULTI(BASE),cow)(multi);
387
14
  if (!multi)
388
0
    return NULL;
389
14
390
14
  space = FN(MULTI(BASE),get_space)(multi);
391
14
  space = isl_space_reset_tuple_id(space, type);
392
14
393
14
  return FN(MULTI(BASE),reset_space)(multi, space);
394
14
}
Unexecuted instantiation: isl_multi_aff_reset_tuple_id
Unexecuted instantiation: isl_multi_pw_aff_reset_tuple_id
isl_multi_union_pw_aff_reset_tuple_id
Line
Count
Source
378
2.31k
{
379
2.31k
  isl_space *space;
380
2.31k
381
2.31k
  if (!multi)
382
0
    return NULL;
383
2.31k
  if (!FN(MULTI(BASE),has_tuple_id)(multi, type))
384
2.30k
    return multi;
385
14
386
14
  multi = FN(MULTI(BASE),cow)(multi);
387
14
  if (!multi)
388
0
    return NULL;
389
14
390
14
  space = FN(MULTI(BASE),get_space)(multi);
391
14
  space = isl_space_reset_tuple_id(space, type);
392
14
393
14
  return FN(MULTI(BASE),reset_space)(multi, space);
394
14
}
Unexecuted instantiation: isl_multi_val_reset_tuple_id
395
396
/* Reset the user pointer on all identifiers of parameters and tuples
397
 * of the space of "multi".
398
 */
399
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_user)(
400
  __isl_take MULTI(BASE) *multi)
401
0
{
402
0
  isl_space *space;
403
0
404
0
  space = FN(MULTI(BASE),get_space)(multi);
405
0
  space = isl_space_reset_user(space);
406
0
407
0
  return FN(MULTI(BASE),reset_space)(multi, space);
408
0
}
Unexecuted instantiation: isl_multi_aff_reset_user
Unexecuted instantiation: isl_multi_pw_aff_reset_user
Unexecuted instantiation: isl_multi_union_pw_aff_reset_user
Unexecuted instantiation: isl_multi_val_reset_user
409
410
__isl_give MULTI(BASE) *FN(MULTI(BASE),realign_domain)(
411
  __isl_take MULTI(BASE) *multi, __isl_take isl_reordering *exp)
412
174
{
413
174
  int i;
414
174
415
174
  multi = FN(MULTI(BASE),cow)(multi);
416
174
  if (!multi || !exp)
417
0
    goto error;
418
174
419
338
  
for (i = 0; 174
i < multi->n;
++i164
) {
420
164
    multi->p[i] = FN(EL,realign_domain)(multi->p[i],
421
164
            isl_reordering_copy(exp));
422
164
    if (!multi->p[i])
423
0
      goto error;
424
164
  }
425
174
426
174
  multi = FN(MULTI(BASE),reset_domain_space)(multi,
427
174
                isl_space_copy(exp->dim));
428
174
429
174
  isl_reordering_free(exp);
430
174
  return multi;
431
174
error:
432
0
  isl_reordering_free(exp);
433
0
  FN(MULTI(BASE),free)(multi);
434
0
  return NULL;
435
174
}
isl_multi_aff_realign_domain
Line
Count
Source
412
10
{
413
10
  int i;
414
10
415
10
  multi = FN(MULTI(BASE),cow)(multi);
416
10
  if (!multi || !exp)
417
0
    goto error;
418
10
419
10
  for (i = 0; i < multi->n; 
++i0
) {
420
0
    multi->p[i] = FN(EL,realign_domain)(multi->p[i],
421
0
            isl_reordering_copy(exp));
422
0
    if (!multi->p[i])
423
0
      goto error;
424
0
  }
425
10
426
10
  multi = FN(MULTI(BASE),reset_domain_space)(multi,
427
10
                isl_space_copy(exp->dim));
428
10
429
10
  isl_reordering_free(exp);
430
10
  return multi;
431
10
error:
432
0
  isl_reordering_free(exp);
433
0
  FN(MULTI(BASE),free)(multi);
434
0
  return NULL;
435
10
}
Unexecuted instantiation: isl_multi_pw_aff_realign_domain
isl_multi_union_pw_aff_realign_domain
Line
Count
Source
412
164
{
413
164
  int i;
414
164
415
164
  multi = FN(MULTI(BASE),cow)(multi);
416
164
  if (!multi || !exp)
417
0
    goto error;
418
164
419
328
  
for (i = 0; 164
i < multi->n;
++i164
) {
420
164
    multi->p[i] = FN(EL,realign_domain)(multi->p[i],
421
164
            isl_reordering_copy(exp));
422
164
    if (!multi->p[i])
423
0
      goto error;
424
164
  }
425
164
426
164
  multi = FN(MULTI(BASE),reset_domain_space)(multi,
427
164
                isl_space_copy(exp->dim));
428
164
429
164
  isl_reordering_free(exp);
430
164
  return multi;
431
164
error:
432
0
  isl_reordering_free(exp);
433
0
  FN(MULTI(BASE),free)(multi);
434
0
  return NULL;
435
164
}
Unexecuted instantiation: isl_multi_val_realign_domain
436
437
/* Align the parameters of "multi" to those of "model".
438
 */
439
__isl_give MULTI(BASE) *FN(MULTI(BASE),align_params)(
440
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *model)
441
2.69k
{
442
2.69k
  isl_ctx *ctx;
443
2.69k
  isl_bool equal_params;
444
2.69k
  isl_reordering *exp;
445
2.69k
446
2.69k
  if (!multi || !model)
447
0
    goto error;
448
2.69k
449
2.69k
  equal_params = isl_space_has_equal_params(multi->space, model);
450
2.69k
  if (equal_params < 0)
451
0
    goto error;
452
2.69k
  if (equal_params) {
453
2.52k
    isl_space_free(model);
454
2.52k
    return multi;
455
2.52k
  }
456
174
457
174
  ctx = isl_space_get_ctx(model);
458
174
  if (!isl_space_has_named_params(model))
459
174
    
isl_die0
(ctx, isl_error_invalid,
460
174
      "model has unnamed parameters", goto error);
461
174
  if (!isl_space_has_named_params(multi->space))
462
174
    
isl_die0
(ctx, isl_error_invalid,
463
174
      "input has unnamed parameters", goto error);
464
174
465
174
  model = isl_space_params(model);
466
174
  exp = isl_parameter_alignment_reordering(multi->space, model);
467
174
  exp = isl_reordering_extend_space(exp,
468
174
            FN(MULTI(BASE),get_domain_space)(multi));
469
174
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
470
174
471
174
  isl_space_free(model);
472
174
  return multi;
473
174
error:
474
0
  isl_space_free(model);
475
0
  FN(MULTI(BASE),free)(multi);
476
0
  return NULL;
477
174
}
isl_multi_aff_align_params
Line
Count
Source
441
1.65k
{
442
1.65k
  isl_ctx *ctx;
443
1.65k
  isl_bool equal_params;
444
1.65k
  isl_reordering *exp;
445
1.65k
446
1.65k
  if (!multi || !model)
447
0
    goto error;
448
1.65k
449
1.65k
  equal_params = isl_space_has_equal_params(multi->space, model);
450
1.65k
  if (equal_params < 0)
451
0
    goto error;
452
1.65k
  if (equal_params) {
453
1.64k
    isl_space_free(model);
454
1.64k
    return multi;
455
1.64k
  }
456
10
457
10
  ctx = isl_space_get_ctx(model);
458
10
  if (!isl_space_has_named_params(model))
459
10
    
isl_die0
(ctx, isl_error_invalid,
460
10
      "model has unnamed parameters", goto error);
461
10
  if (!isl_space_has_named_params(multi->space))
462
10
    
isl_die0
(ctx, isl_error_invalid,
463
10
      "input has unnamed parameters", goto error);
464
10
465
10
  model = isl_space_params(model);
466
10
  exp = isl_parameter_alignment_reordering(multi->space, model);
467
10
  exp = isl_reordering_extend_space(exp,
468
10
            FN(MULTI(BASE),get_domain_space)(multi));
469
10
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
470
10
471
10
  isl_space_free(model);
472
10
  return multi;
473
10
error:
474
0
  isl_space_free(model);
475
0
  FN(MULTI(BASE),free)(multi);
476
0
  return NULL;
477
10
}
isl_multi_pw_aff_align_params
Line
Count
Source
441
4
{
442
4
  isl_ctx *ctx;
443
4
  isl_bool equal_params;
444
4
  isl_reordering *exp;
445
4
446
4
  if (!multi || !model)
447
0
    goto error;
448
4
449
4
  equal_params = isl_space_has_equal_params(multi->space, model);
450
4
  if (equal_params < 0)
451
0
    goto error;
452
4
  if (equal_params) {
453
4
    isl_space_free(model);
454
4
    return multi;
455
4
  }
456
0
457
0
  ctx = isl_space_get_ctx(model);
458
0
  if (!isl_space_has_named_params(model))
459
0
    isl_die(ctx, isl_error_invalid,
460
0
      "model has unnamed parameters", goto error);
461
0
  if (!isl_space_has_named_params(multi->space))
462
0
    isl_die(ctx, isl_error_invalid,
463
0
      "input has unnamed parameters", goto error);
464
0
465
0
  model = isl_space_params(model);
466
0
  exp = isl_parameter_alignment_reordering(multi->space, model);
467
0
  exp = isl_reordering_extend_space(exp,
468
0
            FN(MULTI(BASE),get_domain_space)(multi));
469
0
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
470
0
471
0
  isl_space_free(model);
472
0
  return multi;
473
0
error:
474
0
  isl_space_free(model);
475
0
  FN(MULTI(BASE),free)(multi);
476
0
  return NULL;
477
0
}
isl_multi_union_pw_aff_align_params
Line
Count
Source
441
1.04k
{
442
1.04k
  isl_ctx *ctx;
443
1.04k
  isl_bool equal_params;
444
1.04k
  isl_reordering *exp;
445
1.04k
446
1.04k
  if (!multi || !model)
447
0
    goto error;
448
1.04k
449
1.04k
  equal_params = isl_space_has_equal_params(multi->space, model);
450
1.04k
  if (equal_params < 0)
451
0
    goto error;
452
1.04k
  if (equal_params) {
453
876
    isl_space_free(model);
454
876
    return multi;
455
876
  }
456
164
457
164
  ctx = isl_space_get_ctx(model);
458
164
  if (!isl_space_has_named_params(model))
459
164
    
isl_die0
(ctx, isl_error_invalid,
460
164
      "model has unnamed parameters", goto error);
461
164
  if (!isl_space_has_named_params(multi->space))
462
164
    
isl_die0
(ctx, isl_error_invalid,
463
164
      "input has unnamed parameters", goto error);
464
164
465
164
  model = isl_space_params(model);
466
164
  exp = isl_parameter_alignment_reordering(multi->space, model);
467
164
  exp = isl_reordering_extend_space(exp,
468
164
            FN(MULTI(BASE),get_domain_space)(multi));
469
164
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
470
164
471
164
  isl_space_free(model);
472
164
  return multi;
473
164
error:
474
0
  isl_space_free(model);
475
0
  FN(MULTI(BASE),free)(multi);
476
0
  return NULL;
477
164
}
Unexecuted instantiation: isl_multi_val_align_params
478
479
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),LIST(BASE))(
480
  __isl_take isl_space *space, __isl_take LIST(EL) *list)
481
5.35k
{
482
5.35k
  int i;
483
5.35k
  int n;
484
5.35k
  isl_ctx *ctx;
485
5.35k
  MULTI(BASE) *multi;
486
5.35k
487
5.35k
  if (!space || 
!list5.35k
)
488
2
    goto error;
489
5.35k
490
5.35k
  ctx = isl_space_get_ctx(space);
491
5.35k
  n = FN(FN(LIST(EL),n),BASE)(list);
492
5.35k
  if (n != isl_space_dim(space, isl_dim_out))
493
5.35k
    
isl_die0
(ctx, isl_error_invalid,
494
5.35k
      "invalid number of elements in list", goto error);
495
5.35k
496
5.35k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
497
12.7k
  for (i = 0; i < n; 
++i7.44k
) {
498
7.44k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
499
7.44k
          FN(FN(LIST(EL),get),BASE)(list, i));
500
7.44k
  }
501
5.35k
502
5.35k
  isl_space_free(space);
503
5.35k
  FN(LIST(EL),free)(list);
504
5.35k
  return multi;
505
5.35k
error:
506
2
  isl_space_free(space);
507
2
  FN(LIST(EL),free)(list);
508
2
  return NULL;
509
5.35k
}
Unexecuted instantiation: isl_multi_aff_from_aff_list
isl_multi_pw_aff_from_pw_aff_list
Line
Count
Source
481
5.33k
{
482
5.33k
  int i;
483
5.33k
  int n;
484
5.33k
  isl_ctx *ctx;
485
5.33k
  MULTI(BASE) *multi;
486
5.33k
487
5.33k
  if (!space || 
!list5.32k
)
488
2
    goto error;
489
5.32k
490
5.32k
  ctx = isl_space_get_ctx(space);
491
5.32k
  n = FN(FN(LIST(EL),n),BASE)(list);
492
5.32k
  if (n != isl_space_dim(space, isl_dim_out))
493
5.32k
    
isl_die0
(ctx, isl_error_invalid,
494
5.32k
      "invalid number of elements in list", goto error);
495
5.32k
496
5.32k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
497
12.7k
  for (i = 0; i < n; 
++i7.39k
) {
498
7.39k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
499
7.39k
          FN(FN(LIST(EL),get),BASE)(list, i));
500
7.39k
  }
501
5.32k
502
5.32k
  isl_space_free(space);
503
5.32k
  FN(LIST(EL),free)(list);
504
5.32k
  return multi;
505
5.32k
error:
506
2
  isl_space_free(space);
507
2
  FN(LIST(EL),free)(list);
508
2
  return NULL;
509
5.32k
}
isl_multi_union_pw_aff_from_union_pw_aff_list
Line
Count
Source
481
17
{
482
17
  int i;
483
17
  int n;
484
17
  isl_ctx *ctx;
485
17
  MULTI(BASE) *multi;
486
17
487
17
  if (!space || !list)
488
0
    goto error;
489
17
490
17
  ctx = isl_space_get_ctx(space);
491
17
  n = FN(FN(LIST(EL),n),BASE)(list);
492
17
  if (n != isl_space_dim(space, isl_dim_out))
493
17
    
isl_die0
(ctx, isl_error_invalid,
494
17
      "invalid number of elements in list", goto error);
495
17
496
17
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
497
46
  for (i = 0; i < n; 
++i29
) {
498
29
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
499
29
          FN(FN(LIST(EL),get),BASE)(list, i));
500
29
  }
501
17
502
17
  isl_space_free(space);
503
17
  FN(LIST(EL),free)(list);
504
17
  return multi;
505
17
error:
506
0
  isl_space_free(space);
507
0
  FN(LIST(EL),free)(list);
508
0
  return NULL;
509
17
}
isl_multi_val_from_val_list
Line
Count
Source
481
7
{
482
7
  int i;
483
7
  int n;
484
7
  isl_ctx *ctx;
485
7
  MULTI(BASE) *multi;
486
7
487
7
  if (!space || !list)
488
0
    goto error;
489
7
490
7
  ctx = isl_space_get_ctx(space);
491
7
  n = FN(FN(LIST(EL),n),BASE)(list);
492
7
  if (n != isl_space_dim(space, isl_dim_out))
493
7
    
isl_die0
(ctx, isl_error_invalid,
494
7
      "invalid number of elements in list", goto error);
495
7
496
7
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
497
24
  for (i = 0; i < n; 
++i17
) {
498
17
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
499
17
          FN(FN(LIST(EL),get),BASE)(list, i));
500
17
  }
501
7
502
7
  isl_space_free(space);
503
7
  FN(LIST(EL),free)(list);
504
7
  return multi;
505
7
error:
506
0
  isl_space_free(space);
507
0
  FN(LIST(EL),free)(list);
508
0
  return NULL;
509
7
}
510
511
#ifndef NO_IDENTITY
512
/* Create a multi expression in the given space that maps each
513
 * input dimension to the corresponding output dimension.
514
 */
515
__isl_give MULTI(BASE) *FN(MULTI(BASE),identity)(__isl_take isl_space *space)
516
6.12k
{
517
6.12k
  int i, n;
518
6.12k
  isl_local_space *ls;
519
6.12k
  MULTI(BASE) *multi;
520
6.12k
521
6.12k
  if (!space)
522
0
    return NULL;
523
6.12k
524
6.12k
  if (isl_space_is_set(space))
525
6.12k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
526
6.12k
      "expecting map space", goto error);
527
6.12k
528
6.12k
  n = isl_space_dim(space, isl_dim_out);
529
6.12k
  if (n != isl_space_dim(space, isl_dim_in))
530
6.12k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
531
6.12k
      "number of input and output dimensions needs to be "
532
6.12k
      "the same", goto error);
533
6.12k
534
6.12k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
535
6.12k
536
6.12k
  if (!n) {
537
2.05k
    isl_space_free(space);
538
2.05k
    return multi;
539
2.05k
  }
540
4.06k
541
4.06k
  space = isl_space_domain(space);
542
4.06k
  ls = isl_local_space_from_space(space);
543
4.06k
544
28.0k
  for (i = 0; i < n; 
++i23.9k
) {
545
23.9k
    EL *el;
546
23.9k
    el = FN(EL,var_on_domain)(isl_local_space_copy(ls),
547
23.9k
            isl_dim_set, i);
548
23.9k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el);
549
23.9k
  }
550
4.06k
551
4.06k
  isl_local_space_free(ls);
552
4.06k
553
4.06k
  return multi;
554
4.06k
error:
555
0
  isl_space_free(space);
556
0
  return NULL;
557
4.06k
}
isl_multi_aff_identity
Line
Count
Source
516
6.12k
{
517
6.12k
  int i, n;
518
6.12k
  isl_local_space *ls;
519
6.12k
  MULTI(BASE) *multi;
520
6.12k
521
6.12k
  if (!space)
522
0
    return NULL;
523
6.12k
524
6.12k
  if (isl_space_is_set(space))
525
6.12k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
526
6.12k
      "expecting map space", goto error);
527
6.12k
528
6.12k
  n = isl_space_dim(space, isl_dim_out);
529
6.12k
  if (n != isl_space_dim(space, isl_dim_in))
530
6.12k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
531
6.12k
      "number of input and output dimensions needs to be "
532
6.12k
      "the same", goto error);
533
6.12k
534
6.12k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
535
6.12k
536
6.12k
  if (!n) {
537
2.05k
    isl_space_free(space);
538
2.05k
    return multi;
539
2.05k
  }
540
4.06k
541
4.06k
  space = isl_space_domain(space);
542
4.06k
  ls = isl_local_space_from_space(space);
543
4.06k
544
28.0k
  for (i = 0; i < n; 
++i23.9k
) {
545
23.9k
    EL *el;
546
23.9k
    el = FN(EL,var_on_domain)(isl_local_space_copy(ls),
547
23.9k
            isl_dim_set, i);
548
23.9k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el);
549
23.9k
  }
550
4.06k
551
4.06k
  isl_local_space_free(ls);
552
4.06k
553
4.06k
  return multi;
554
4.06k
error:
555
0
  isl_space_free(space);
556
0
  return NULL;
557
4.06k
}
Unexecuted instantiation: isl_multi_pw_aff_identity
558
#endif
559
560
#ifndef NO_ZERO
561
/* Construct a multi expression in the given space with value zero in
562
 * each of the output dimensions.
563
 */
564
__isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space)
565
6.14k
{
566
6.14k
  int n;
567
6.14k
  MULTI(BASE) *multi;
568
6.14k
569
6.14k
  if (!space)
570
0
    return NULL;
571
6.14k
572
6.14k
  n = isl_space_dim(space , isl_dim_out);
573
6.14k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
574
6.14k
575
6.14k
  if (!n)
576
1.26k
    isl_space_free(space);
577
4.88k
  else {
578
4.88k
    int i;
579
4.88k
    isl_local_space *ls;
580
4.88k
    EL *el;
581
4.88k
582
4.88k
    space = isl_space_domain(space);
583
4.88k
    ls = isl_local_space_from_space(space);
584
4.88k
    el = FN(EL,zero_on_domain)(ls);
585
4.88k
586
11.8k
    for (i = 0; i < n; 
++i6.98k
)
587
6.98k
      multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
588
6.98k
                  FN(EL,copy)(el));
589
4.88k
590
4.88k
    FN(EL,free)(el);
591
4.88k
  }
592
6.14k
593
6.14k
  return multi;
594
6.14k
}
isl_multi_aff_zero
Line
Count
Source
565
2.57k
{
566
2.57k
  int n;
567
2.57k
  MULTI(BASE) *multi;
568
2.57k
569
2.57k
  if (!space)
570
0
    return NULL;
571
2.57k
572
2.57k
  n = isl_space_dim(space , isl_dim_out);
573
2.57k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
574
2.57k
575
2.57k
  if (!n)
576
1.21k
    isl_space_free(space);
577
1.36k
  else {
578
1.36k
    int i;
579
1.36k
    isl_local_space *ls;
580
1.36k
    EL *el;
581
1.36k
582
1.36k
    space = isl_space_domain(space);
583
1.36k
    ls = isl_local_space_from_space(space);
584
1.36k
    el = FN(EL,zero_on_domain)(ls);
585
1.36k
586
3.31k
    for (i = 0; i < n; 
++i1.94k
)
587
1.94k
      multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
588
1.94k
                  FN(EL,copy)(el));
589
1.36k
590
1.36k
    FN(EL,free)(el);
591
1.36k
  }
592
2.57k
593
2.57k
  return multi;
594
2.57k
}
Unexecuted instantiation: isl_multi_pw_aff_zero
isl_multi_val_zero
Line
Count
Source
565
3.57k
{
566
3.57k
  int n;
567
3.57k
  MULTI(BASE) *multi;
568
3.57k
569
3.57k
  if (!space)
570
0
    return NULL;
571
3.57k
572
3.57k
  n = isl_space_dim(space , isl_dim_out);
573
3.57k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
574
3.57k
575
3.57k
  if (!n)
576
55
    isl_space_free(space);
577
3.52k
  else {
578
3.52k
    int i;
579
3.52k
    isl_local_space *ls;
580
3.52k
    EL *el;
581
3.52k
582
3.52k
    space = isl_space_domain(space);
583
3.52k
    ls = isl_local_space_from_space(space);
584
3.52k
    el = FN(EL,zero_on_domain)(ls);
585
3.52k
586
8.55k
    for (i = 0; i < n; 
++i5.03k
)
587
5.03k
      multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
588
5.03k
                  FN(EL,copy)(el));
589
3.52k
590
3.52k
    FN(EL,free)(el);
591
3.52k
  }
592
3.57k
593
3.57k
  return multi;
594
3.57k
}
595
#endif
596
597
#ifndef NO_FROM_BASE
598
/* Create a multiple expression with a single output/set dimension
599
 * equal to "el".
600
 * For most multiple expression types, the base type has a single
601
 * output/set dimension and the space of the result is therefore
602
 * the same as the space of the input.
603
 * In the case of isl_multi_union_pw_aff, however, the base type
604
 * lives in a parameter space and we therefore need to add
605
 * a single set dimension.
606
 */
607
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el)
608
248
{
609
248
  isl_space *space;
610
248
  MULTI(BASE) *multi;
611
248
612
248
  space = FN(EL,get_space(el));
613
248
  if (isl_space_is_params(space)) {
614
0
    space = isl_space_set_from_params(space);
615
0
    space = isl_space_add_dims(space, isl_dim_set, 1);
616
0
  }
617
248
  multi = FN(MULTI(BASE),alloc)(space);
618
248
  multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
619
248
620
248
  return multi;
621
248
}
isl_multi_aff_from_aff
Line
Count
Source
608
248
{
609
248
  isl_space *space;
610
248
  MULTI(BASE) *multi;
611
248
612
248
  space = FN(EL,get_space(el));
613
248
  if (isl_space_is_params(space)) {
614
0
    space = isl_space_set_from_params(space);
615
0
    space = isl_space_add_dims(space, isl_dim_set, 1);
616
0
  }
617
248
  multi = FN(MULTI(BASE),alloc)(space);
618
248
  multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
619
248
620
248
  return multi;
621
248
}
Unexecuted instantiation: isl_multi_pw_aff_from_pw_aff
Unexecuted instantiation: isl_multi_union_pw_aff_from_union_pw_aff
622
#endif
623
624
__isl_give MULTI(BASE) *FN(MULTI(BASE),drop_dims)(
625
  __isl_take MULTI(BASE) *multi,
626
  enum isl_dim_type type, unsigned first, unsigned n)
627
1.45k
{
628
1.45k
  int i;
629
1.45k
  unsigned dim;
630
1.45k
631
1.45k
  multi = FN(MULTI(BASE),cow)(multi);
632
1.45k
  if (!multi)
633
0
    return NULL;
634
1.45k
635
1.45k
  dim = FN(MULTI(BASE),dim)(multi, type);
636
1.45k
  if (first + n > dim || first + n < first)
637
1.45k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
638
1.45k
      "index out of bounds",
639
1.45k
      return FN(MULTI(BASE),free)(multi));
640
1.45k
641
1.45k
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
642
1.45k
  if (!multi->space)
643
0
    return FN(MULTI(BASE),free)(multi);
644
1.45k
645
1.45k
  if (type == isl_dim_out) {
646
2.23k
    for (i = 0; i < n; 
++i1.13k
)
647
1.13k
      FN(EL,free)(multi->p[first + i]);
648
1.98k
    for (i = first; i + n < multi->n; 
++i891
)
649
891
      multi->p[i] = multi->p[i + n];
650
1.09k
    multi->n -= n;
651
1.09k
652
1.09k
    return multi;
653
1.09k
  }
654
356
655
1.53k
  
for (i = 0; 356
i < multi->n;
++i1.18k
) {
656
1.18k
    multi->p[i] = FN(EL,drop_dims)(multi->p[i], type, first, n);
657
1.18k
    if (!multi->p[i])
658
0
      return FN(MULTI(BASE),free)(multi);
659
1.18k
  }
660
356
661
356
  return multi;
662
356
}
isl_multi_aff_drop_dims
Line
Count
Source
627
1.38k
{
628
1.38k
  int i;
629
1.38k
  unsigned dim;
630
1.38k
631
1.38k
  multi = FN(MULTI(BASE),cow)(multi);
632
1.38k
  if (!multi)
633
0
    return NULL;
634
1.38k
635
1.38k
  dim = FN(MULTI(BASE),dim)(multi, type);
636
1.38k
  if (first + n > dim || first + n < first)
637
1.38k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
638
1.38k
      "index out of bounds",
639
1.38k
      return FN(MULTI(BASE),free)(multi));
640
1.38k
641
1.38k
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
642
1.38k
  if (!multi->space)
643
0
    return FN(MULTI(BASE),free)(multi);
644
1.38k
645
1.38k
  if (type == isl_dim_out) {
646
2.08k
    for (i = 0; i < n; 
++i1.05k
)
647
1.05k
      FN(EL,free)(multi->p[first + i]);
648
1.87k
    for (i = first; i + n < multi->n; 
++i851
)
649
851
      multi->p[i] = multi->p[i + n];
650
1.02k
    multi->n -= n;
651
1.02k
652
1.02k
    return multi;
653
1.02k
  }
654
356
655
1.53k
  
for (i = 0; 356
i < multi->n;
++i1.18k
) {
656
1.18k
    multi->p[i] = FN(EL,drop_dims)(multi->p[i], type, first, n);
657
1.18k
    if (!multi->p[i])
658
0
      return FN(MULTI(BASE),free)(multi);
659
1.18k
  }
660
356
661
356
  return multi;
662
356
}
Unexecuted instantiation: isl_multi_pw_aff_drop_dims
isl_multi_union_pw_aff_drop_dims
Line
Count
Source
627
68
{
628
68
  int i;
629
68
  unsigned dim;
630
68
631
68
  multi = FN(MULTI(BASE),cow)(multi);
632
68
  if (!multi)
633
0
    return NULL;
634
68
635
68
  dim = FN(MULTI(BASE),dim)(multi, type);
636
68
  if (first + n > dim || first + n < first)
637
68
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
638
68
      "index out of bounds",
639
68
      return FN(MULTI(BASE),free)(multi));
640
68
641
68
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
642
68
  if (!multi->space)
643
0
    return FN(MULTI(BASE),free)(multi);
644
68
645
68
  if (type == isl_dim_out) {
646
154
    for (i = 0; i < n; 
++i86
)
647
86
      FN(EL,free)(multi->p[first + i]);
648
108
    for (i = first; i + n < multi->n; 
++i40
)
649
40
      multi->p[i] = multi->p[i + n];
650
68
    multi->n -= n;
651
68
652
68
    return multi;
653
68
  }
654
0
655
0
  for (i = 0; i < multi->n; ++i) {
656
0
    multi->p[i] = FN(EL,drop_dims)(multi->p[i], type, first, n);
657
0
    if (!multi->p[i])
658
0
      return FN(MULTI(BASE),free)(multi);
659
0
  }
660
0
661
0
  return multi;
662
0
}
Unexecuted instantiation: isl_multi_val_drop_dims
663
664
/* Align the parameters of "multi1" and "multi2" (if needed) and call "fn".
665
 */
666
static __isl_give MULTI(BASE) *FN(MULTI(BASE),align_params_multi_multi_and)(
667
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2,
668
  __isl_give MULTI(BASE) *(*fn)(__isl_take MULTI(BASE) *multi1,
669
    __isl_take MULTI(BASE) *multi2))
670
6.99k
{
671
6.99k
  isl_ctx *ctx;
672
6.99k
  isl_bool equal_params;
673
6.99k
674
6.99k
  if (!multi1 || !multi2)
675
0
    goto error;
676
6.99k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
677
6.99k
  if (equal_params < 0)
678
0
    goto error;
679
6.99k
  if (equal_params)
680
6.97k
    return fn(multi1, multi2);
681
24
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
682
24
  if (!isl_space_has_named_params(multi1->space) ||
683
24
      !isl_space_has_named_params(multi2->space))
684
24
    
isl_die0
(ctx, isl_error_invalid,
685
24
      "unaligned unnamed parameters", goto error);
686
24
  multi1 = FN(MULTI(BASE),align_params)(multi1,
687
24
              FN(MULTI(BASE),get_space)(multi2));
688
24
  multi2 = FN(MULTI(BASE),align_params)(multi2,
689
24
              FN(MULTI(BASE),get_space)(multi1));
690
24
  return fn(multi1, multi2);
691
24
error:
692
0
  FN(MULTI(BASE),free)(multi1);
693
0
  FN(MULTI(BASE),free)(multi2);
694
0
  return NULL;
695
24
}
isl_aff.c:isl_multi_aff_align_params_multi_multi_and
Line
Count
Source
670
4.38k
{
671
4.38k
  isl_ctx *ctx;
672
4.38k
  isl_bool equal_params;
673
4.38k
674
4.38k
  if (!multi1 || !multi2)
675
0
    goto error;
676
4.38k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
677
4.38k
  if (equal_params < 0)
678
0
    goto error;
679
4.38k
  if (equal_params)
680
4.38k
    return fn(multi1, multi2);
681
0
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
682
0
  if (!isl_space_has_named_params(multi1->space) ||
683
0
      !isl_space_has_named_params(multi2->space))
684
0
    isl_die(ctx, isl_error_invalid,
685
0
      "unaligned unnamed parameters", goto error);
686
0
  multi1 = FN(MULTI(BASE),align_params)(multi1,
687
0
              FN(MULTI(BASE),get_space)(multi2));
688
0
  multi2 = FN(MULTI(BASE),align_params)(multi2,
689
0
              FN(MULTI(BASE),get_space)(multi1));
690
0
  return fn(multi1, multi2);
691
0
error:
692
0
  FN(MULTI(BASE),free)(multi1);
693
0
  FN(MULTI(BASE),free)(multi2);
694
0
  return NULL;
695
0
}
isl_aff.c:isl_multi_pw_aff_align_params_multi_multi_and
Line
Count
Source
670
5
{
671
5
  isl_ctx *ctx;
672
5
  isl_bool equal_params;
673
5
674
5
  if (!multi1 || !multi2)
675
0
    goto error;
676
5
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
677
5
  if (equal_params < 0)
678
0
    goto error;
679
5
  if (equal_params)
680
5
    return fn(multi1, multi2);
681
0
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
682
0
  if (!isl_space_has_named_params(multi1->space) ||
683
0
      !isl_space_has_named_params(multi2->space))
684
0
    isl_die(ctx, isl_error_invalid,
685
0
      "unaligned unnamed parameters", goto error);
686
0
  multi1 = FN(MULTI(BASE),align_params)(multi1,
687
0
              FN(MULTI(BASE),get_space)(multi2));
688
0
  multi2 = FN(MULTI(BASE),align_params)(multi2,
689
0
              FN(MULTI(BASE),get_space)(multi1));
690
0
  return fn(multi1, multi2);
691
0
error:
692
0
  FN(MULTI(BASE),free)(multi1);
693
0
  FN(MULTI(BASE),free)(multi2);
694
0
  return NULL;
695
0
}
isl_aff.c:isl_multi_union_pw_aff_align_params_multi_multi_and
Line
Count
Source
670
2.60k
{
671
2.60k
  isl_ctx *ctx;
672
2.60k
  isl_bool equal_params;
673
2.60k
674
2.60k
  if (!multi1 || !multi2)
675
0
    goto error;
676
2.60k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
677
2.60k
  if (equal_params < 0)
678
0
    goto error;
679
2.60k
  if (equal_params)
680
2.58k
    return fn(multi1, multi2);
681
24
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
682
24
  if (!isl_space_has_named_params(multi1->space) ||
683
24
      !isl_space_has_named_params(multi2->space))
684
24
    
isl_die0
(ctx, isl_error_invalid,
685
24
      "unaligned unnamed parameters", goto error);
686
24
  multi1 = FN(MULTI(BASE),align_params)(multi1,
687
24
              FN(MULTI(BASE),get_space)(multi2));
688
24
  multi2 = FN(MULTI(BASE),align_params)(multi2,
689
24
              FN(MULTI(BASE),get_space)(multi1));
690
24
  return fn(multi1, multi2);
691
24
error:
692
0
  FN(MULTI(BASE),free)(multi1);
693
0
  FN(MULTI(BASE),free)(multi2);
694
0
  return NULL;
695
24
}
Unexecuted instantiation: isl_val.c:isl_multi_val_align_params_multi_multi_and
696
697
/* Given two MULTI(BASE)s A -> B and C -> D,
698
 * construct a MULTI(BASE) (A * C) -> [B -> D].
699
 *
700
 * The parameters are assumed to have been aligned.
701
 */
702
static __isl_give MULTI(BASE) *FN(MULTI(BASE),range_product_aligned)(
703
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
704
2.69k
{
705
2.69k
  int i, n1, n2;
706
2.69k
  EL *el;
707
2.69k
  isl_space *space;
708
2.69k
  MULTI(BASE) *res;
709
2.69k
710
2.69k
  if (!multi1 || !multi2)
711
0
    goto error;
712
2.69k
713
2.69k
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
714
2.69k
          FN(MULTI(BASE),get_space)(multi2));
715
2.69k
  res = FN(MULTI(BASE),alloc)(space);
716
2.69k
717
2.69k
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
718
2.69k
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
719
2.69k
720
5.93k
  for (i = 0; i < n1; 
++i3.24k
) {
721
3.24k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
722
3.24k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
723
3.24k
  }
724
2.69k
725
4.54k
  for (i = 0; i < n2; 
++i1.85k
) {
726
1.85k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
727
1.85k
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
728
1.85k
  }
729
2.69k
730
2.69k
  FN(MULTI(BASE),free)(multi1);
731
2.69k
  FN(MULTI(BASE),free)(multi2);
732
2.69k
  return res;
733
2.69k
error:
734
0
  FN(MULTI(BASE),free)(multi1);
735
0
  FN(MULTI(BASE),free)(multi2);
736
0
  return NULL;
737
2.69k
}
isl_aff.c:isl_multi_aff_range_product_aligned
Line
Count
Source
704
235
{
705
235
  int i, n1, n2;
706
235
  EL *el;
707
235
  isl_space *space;
708
235
  MULTI(BASE) *res;
709
235
710
235
  if (!multi1 || !multi2)
711
0
    goto error;
712
235
713
235
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
714
235
          FN(MULTI(BASE),get_space)(multi2));
715
235
  res = FN(MULTI(BASE),alloc)(space);
716
235
717
235
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
718
235
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
719
235
720
898
  for (i = 0; i < n1; 
++i663
) {
721
663
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
722
663
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
723
663
  }
724
235
725
490
  for (i = 0; i < n2; 
++i255
) {
726
255
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
727
255
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
728
255
  }
729
235
730
235
  FN(MULTI(BASE),free)(multi1);
731
235
  FN(MULTI(BASE),free)(multi2);
732
235
  return res;
733
235
error:
734
0
  FN(MULTI(BASE),free)(multi1);
735
0
  FN(MULTI(BASE),free)(multi2);
736
0
  return NULL;
737
235
}
isl_aff.c:isl_multi_pw_aff_range_product_aligned
Line
Count
Source
704
5
{
705
5
  int i, n1, n2;
706
5
  EL *el;
707
5
  isl_space *space;
708
5
  MULTI(BASE) *res;
709
5
710
5
  if (!multi1 || !multi2)
711
0
    goto error;
712
5
713
5
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
714
5
          FN(MULTI(BASE),get_space)(multi2));
715
5
  res = FN(MULTI(BASE),alloc)(space);
716
5
717
5
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
718
5
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
719
5
720
14
  for (i = 0; i < n1; 
++i9
) {
721
9
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
722
9
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
723
9
  }
724
5
725
14
  for (i = 0; i < n2; 
++i9
) {
726
9
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
727
9
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
728
9
  }
729
5
730
5
  FN(MULTI(BASE),free)(multi1);
731
5
  FN(MULTI(BASE),free)(multi2);
732
5
  return res;
733
5
error:
734
0
  FN(MULTI(BASE),free)(multi1);
735
0
  FN(MULTI(BASE),free)(multi2);
736
0
  return NULL;
737
5
}
isl_aff.c:isl_multi_union_pw_aff_range_product_aligned
Line
Count
Source
704
2.45k
{
705
2.45k
  int i, n1, n2;
706
2.45k
  EL *el;
707
2.45k
  isl_space *space;
708
2.45k
  MULTI(BASE) *res;
709
2.45k
710
2.45k
  if (!multi1 || !multi2)
711
0
    goto error;
712
2.45k
713
2.45k
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
714
2.45k
          FN(MULTI(BASE),get_space)(multi2));
715
2.45k
  res = FN(MULTI(BASE),alloc)(space);
716
2.45k
717
2.45k
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
718
2.45k
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
719
2.45k
720
5.01k
  for (i = 0; i < n1; 
++i2.56k
) {
721
2.56k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
722
2.56k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
723
2.56k
  }
724
2.45k
725
4.04k
  for (i = 0; i < n2; 
++i1.59k
) {
726
1.59k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
727
1.59k
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
728
1.59k
  }
729
2.45k
730
2.45k
  FN(MULTI(BASE),free)(multi1);
731
2.45k
  FN(MULTI(BASE),free)(multi2);
732
2.45k
  return res;
733
2.45k
error:
734
0
  FN(MULTI(BASE),free)(multi1);
735
0
  FN(MULTI(BASE),free)(multi2);
736
0
  return NULL;
737
2.45k
}
Unexecuted instantiation: isl_val.c:isl_multi_val_range_product_aligned
738
739
/* Given two MULTI(BASE)s A -> B and C -> D,
740
 * construct a MULTI(BASE) (A * C) -> [B -> D].
741
 */
742
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_product)(
743
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
744
2.69k
{
745
2.69k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
746
2.69k
          &FN(MULTI(BASE),range_product_aligned));
747
2.69k
}
isl_multi_aff_range_product
Line
Count
Source
744
235
{
745
235
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
746
235
          &FN(MULTI(BASE),range_product_aligned));
747
235
}
isl_multi_pw_aff_range_product
Line
Count
Source
744
5
{
745
5
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
746
5
          &FN(MULTI(BASE),range_product_aligned));
747
5
}
isl_multi_union_pw_aff_range_product
Line
Count
Source
744
2.45k
{
745
2.45k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
746
2.45k
          &FN(MULTI(BASE),range_product_aligned));
747
2.45k
}
Unexecuted instantiation: isl_multi_val_range_product
748
749
/* Is the range of "multi" a wrapped relation?
750
 */
751
isl_bool FN(MULTI(BASE),range_is_wrapping)(__isl_keep MULTI(BASE) *multi)
752
993
{
753
993
  if (!multi)
754
0
    return isl_bool_error;
755
993
  return isl_space_range_is_wrapping(multi->space);
756
993
}
Unexecuted instantiation: isl_multi_aff_range_is_wrapping
isl_multi_pw_aff_range_is_wrapping
Line
Count
Source
752
993
{
753
993
  if (!multi)
754
0
    return isl_bool_error;
755
993
  return isl_space_range_is_wrapping(multi->space);
756
993
}
Unexecuted instantiation: isl_multi_union_pw_aff_range_is_wrapping
Unexecuted instantiation: isl_multi_val_range_is_wrapping
757
758
/* Given a function A -> [B -> C], extract the function A -> B.
759
 */
760
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_factor_domain)(
761
  __isl_take MULTI(BASE) *multi)
762
0
{
763
0
  isl_space *space;
764
0
  int total, keep;
765
0
766
0
  if (!multi)
767
0
    return NULL;
768
0
  if (!isl_space_range_is_wrapping(multi->space))
769
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
770
0
      "range is not a product",
771
0
      return FN(MULTI(BASE),free)(multi));
772
0
773
0
  space = FN(MULTI(BASE),get_space)(multi);
774
0
  total = isl_space_dim(space, isl_dim_out);
775
0
  space = isl_space_range_factor_domain(space);
776
0
  keep = isl_space_dim(space, isl_dim_out);
777
0
  multi = FN(MULTI(BASE),drop_dims)(multi,
778
0
          isl_dim_out, keep, total - keep);
779
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
780
0
781
0
  return multi;
782
0
}
Unexecuted instantiation: isl_multi_aff_range_factor_domain
Unexecuted instantiation: isl_multi_pw_aff_range_factor_domain
Unexecuted instantiation: isl_multi_union_pw_aff_range_factor_domain
Unexecuted instantiation: isl_multi_val_range_factor_domain
783
784
/* Given a function A -> [B -> C], extract the function A -> C.
785
 */
786
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_factor_range)(
787
  __isl_take MULTI(BASE) *multi)
788
0
{
789
0
  isl_space *space;
790
0
  int total, keep;
791
0
792
0
  if (!multi)
793
0
    return NULL;
794
0
  if (!isl_space_range_is_wrapping(multi->space))
795
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
796
0
      "range is not a product",
797
0
      return FN(MULTI(BASE),free)(multi));
798
0
799
0
  space = FN(MULTI(BASE),get_space)(multi);
800
0
  total = isl_space_dim(space, isl_dim_out);
801
0
  space = isl_space_range_factor_range(space);
802
0
  keep = isl_space_dim(space, isl_dim_out);
803
0
  multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep);
804
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
805
0
806
0
  return multi;
807
0
}
Unexecuted instantiation: isl_multi_aff_range_factor_range
Unexecuted instantiation: isl_multi_pw_aff_range_factor_range
Unexecuted instantiation: isl_multi_union_pw_aff_range_factor_range
Unexecuted instantiation: isl_multi_val_range_factor_range
808
809
/* Given a function [B -> C], extract the function C.
810
 */
811
__isl_give MULTI(BASE) *FN(MULTI(BASE),factor_range)(
812
  __isl_take MULTI(BASE) *multi)
813
0
{
814
0
  isl_space *space;
815
0
  int total, keep;
816
0
817
0
  if (!multi)
818
0
    return NULL;
819
0
  if (!isl_space_is_wrapping(multi->space))
820
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
821
0
      "not a product", return FN(MULTI(BASE),free)(multi));
822
0
823
0
  space = FN(MULTI(BASE),get_space)(multi);
824
0
  total = isl_space_dim(space, isl_dim_out);
825
0
  space = isl_space_factor_range(space);
826
0
  keep = isl_space_dim(space, isl_dim_out);
827
0
  multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep);
828
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
829
0
830
0
  return multi;
831
0
}
Unexecuted instantiation: isl_multi_aff_factor_range
Unexecuted instantiation: isl_multi_pw_aff_factor_range
Unexecuted instantiation: isl_multi_union_pw_aff_factor_range
Unexecuted instantiation: isl_multi_val_factor_range
832
833
#ifndef NO_PRODUCT
834
/* Given two MULTI(BASE)s A -> B and C -> D,
835
 * construct a MULTI(BASE) [A -> C] -> [B -> D].
836
 *
837
 * The parameters are assumed to have been aligned.
838
 */
839
__isl_give MULTI(BASE) *FN(MULTI(BASE),product_aligned)(
840
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
841
1.85k
{
842
1.85k
  int i;
843
1.85k
  EL *el;
844
1.85k
  isl_space *space;
845
1.85k
  MULTI(BASE) *res;
846
1.85k
  int in1, in2, out1, out2;
847
1.85k
848
1.85k
  in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
849
1.85k
  in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
850
1.85k
  out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
851
1.85k
  out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
852
1.85k
  space = isl_space_product(FN(MULTI(BASE),get_space)(multi1),
853
1.85k
          FN(MULTI(BASE),get_space)(multi2));
854
1.85k
  res = FN(MULTI(BASE),alloc)(isl_space_copy(space));
855
1.85k
  space = isl_space_domain(space);
856
1.85k
857
3.43k
  for (i = 0; i < out1; 
++i1.57k
) {
858
1.57k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
859
1.57k
    el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2);
860
1.57k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
861
1.57k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
862
1.57k
  }
863
1.85k
864
4.42k
  for (i = 0; i < out2; 
++i2.57k
) {
865
2.57k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
866
2.57k
    el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1);
867
2.57k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
868
2.57k
    res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el);
869
2.57k
  }
870
1.85k
871
1.85k
  isl_space_free(space);
872
1.85k
  FN(MULTI(BASE),free)(multi1);
873
1.85k
  FN(MULTI(BASE),free)(multi2);
874
1.85k
  return res;
875
1.85k
}
isl_multi_aff_product_aligned
Line
Count
Source
841
1.85k
{
842
1.85k
  int i;
843
1.85k
  EL *el;
844
1.85k
  isl_space *space;
845
1.85k
  MULTI(BASE) *res;
846
1.85k
  int in1, in2, out1, out2;
847
1.85k
848
1.85k
  in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
849
1.85k
  in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
850
1.85k
  out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
851
1.85k
  out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
852
1.85k
  space = isl_space_product(FN(MULTI(BASE),get_space)(multi1),
853
1.85k
          FN(MULTI(BASE),get_space)(multi2));
854
1.85k
  res = FN(MULTI(BASE),alloc)(isl_space_copy(space));
855
1.85k
  space = isl_space_domain(space);
856
1.85k
857
3.43k
  for (i = 0; i < out1; 
++i1.57k
) {
858
1.57k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
859
1.57k
    el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2);
860
1.57k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
861
1.57k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
862
1.57k
  }
863
1.85k
864
4.42k
  for (i = 0; i < out2; 
++i2.57k
) {
865
2.57k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
866
2.57k
    el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1);
867
2.57k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
868
2.57k
    res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el);
869
2.57k
  }
870
1.85k
871
1.85k
  isl_space_free(space);
872
1.85k
  FN(MULTI(BASE),free)(multi1);
873
1.85k
  FN(MULTI(BASE),free)(multi2);
874
1.85k
  return res;
875
1.85k
}
Unexecuted instantiation: isl_multi_pw_aff_product_aligned
Unexecuted instantiation: isl_multi_val_product_aligned
876
877
/* Given two MULTI(BASE)s A -> B and C -> D,
878
 * construct a MULTI(BASE) [A -> C] -> [B -> D].
879
 */
880
__isl_give MULTI(BASE) *FN(MULTI(BASE),product)(
881
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
882
1.85k
{
883
1.85k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
884
1.85k
          &FN(MULTI(BASE),product_aligned));
885
1.85k
}
isl_multi_aff_product
Line
Count
Source
882
1.85k
{
883
1.85k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
884
1.85k
          &FN(MULTI(BASE),product_aligned));
885
1.85k
}
Unexecuted instantiation: isl_multi_pw_aff_product
Unexecuted instantiation: isl_multi_val_product
886
#endif
887
888
__isl_give MULTI(BASE) *FN(MULTI(BASE),flatten_range)(
889
  __isl_take MULTI(BASE) *multi)
890
3.19k
{
891
3.19k
  if (!multi)
892
0
    return NULL;
893
3.19k
894
3.19k
  if (!multi->space->nested[1])
895
0
    return multi;
896
3.19k
897
3.19k
  multi = FN(MULTI(BASE),cow)(multi);
898
3.19k
  if (!multi)
899
0
    return NULL;
900
3.19k
901
3.19k
  multi->space = isl_space_flatten_range(multi->space);
902
3.19k
  if (!multi->space)
903
0
    return FN(MULTI(BASE),free)(multi);
904
3.19k
905
3.19k
  return multi;
906
3.19k
}
isl_multi_aff_flatten_range
Line
Count
Source
890
739
{
891
739
  if (!multi)
892
0
    return NULL;
893
739
894
739
  if (!multi->space->nested[1])
895
0
    return multi;
896
739
897
739
  multi = FN(MULTI(BASE),cow)(multi);
898
739
  if (!multi)
899
0
    return NULL;
900
739
901
739
  multi->space = isl_space_flatten_range(multi->space);
902
739
  if (!multi->space)
903
0
    return FN(MULTI(BASE),free)(multi);
904
739
905
739
  return multi;
906
739
}
isl_multi_pw_aff_flatten_range
Line
Count
Source
890
1
{
891
1
  if (!multi)
892
0
    return NULL;
893
1
894
1
  if (!multi->space->nested[1])
895
0
    return multi;
896
1
897
1
  multi = FN(MULTI(BASE),cow)(multi);
898
1
  if (!multi)
899
0
    return NULL;
900
1
901
1
  multi->space = isl_space_flatten_range(multi->space);
902
1
  if (!multi->space)
903
0
    return FN(MULTI(BASE),free)(multi);
904
1
905
1
  return multi;
906
1
}
isl_multi_union_pw_aff_flatten_range
Line
Count
Source
890
2.45k
{
891
2.45k
  if (!multi)
892
0
    return NULL;
893
2.45k
894
2.45k
  if (!multi->space->nested[1])
895
0
    return multi;
896
2.45k
897
2.45k
  multi = FN(MULTI(BASE),cow)(multi);
898
2.45k
  if (!multi)
899
0
    return NULL;
900
2.45k
901
2.45k
  multi->space = isl_space_flatten_range(multi->space);
902
2.45k
  if (!multi->space)
903
0
    return FN(MULTI(BASE),free)(multi);
904
2.45k
905
2.45k
  return multi;
906
2.45k
}
Unexecuted instantiation: isl_multi_val_flatten_range
907
908
/* Given two MULTI(BASE)s A -> B and C -> D,
909
 * construct a MULTI(BASE) (A * C) -> (B, D).
910
 */
911
__isl_give MULTI(BASE) *FN(MULTI(BASE),flat_range_product)(
912
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
913
2.57k
{
914
2.57k
  MULTI(BASE) *multi;
915
2.57k
916
2.57k
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
917
2.57k
  multi = FN(MULTI(BASE),flatten_range)(multi);
918
2.57k
  return multi;
919
2.57k
}
isl_multi_aff_flat_range_product
Line
Count
Source
913
122
{
914
122
  MULTI(BASE) *multi;
915
122
916
122
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
917
122
  multi = FN(MULTI(BASE),flatten_range)(multi);
918
122
  return multi;
919
122
}
isl_multi_pw_aff_flat_range_product
Line
Count
Source
913
1
{
914
1
  MULTI(BASE) *multi;
915
1
916
1
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
917
1
  multi = FN(MULTI(BASE),flatten_range)(multi);
918
1
  return multi;
919
1
}
isl_multi_union_pw_aff_flat_range_product
Line
Count
Source
913
2.45k
{
914
2.45k
  MULTI(BASE) *multi;
915
2.45k
916
2.45k
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
917
2.45k
  multi = FN(MULTI(BASE),flatten_range)(multi);
918
2.45k
  return multi;
919
2.45k
}
Unexecuted instantiation: isl_multi_val_flat_range_product
920
921
/* Given two multi expressions, "multi1"
922
 *
923
 *  [A] -> [B1 B2]
924
 *
925
 * where B2 starts at position "pos", and "multi2"
926
 *
927
 *  [A] -> [D]
928
 *
929
 * return the multi expression
930
 *
931
 *  [A] -> [B1 D B2]
932
 */
933
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_splice)(
934
  __isl_take MULTI(BASE) *multi1, unsigned pos,
935
  __isl_take MULTI(BASE) *multi2)
936
9
{
937
9
  MULTI(BASE) *res;
938
9
  unsigned dim;
939
9
940
9
  if (!multi1 || !multi2)
941
0
    goto error;
942
9
943
9
  dim = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
944
9
  if (pos > dim)
945
9
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
946
9
      "index out of bounds", goto error);
947
9
948
9
  res = FN(MULTI(BASE),copy)(multi1);
949
9
  res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos);
950
9
  multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos);
951
9
952
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi2);
953
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi1);
954
9
955
9
  return res;
956
9
error:
957
0
  FN(MULTI(BASE),free)(multi1);
958
0
  FN(MULTI(BASE),free)(multi2);
959
0
  return NULL;
960
9
}
isl_multi_aff_range_splice
Line
Count
Source
936
9
{
937
9
  MULTI(BASE) *res;
938
9
  unsigned dim;
939
9
940
9
  if (!multi1 || !multi2)
941
0
    goto error;
942
9
943
9
  dim = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
944
9
  if (pos > dim)
945
9
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
946
9
      "index out of bounds", goto error);
947
9
948
9
  res = FN(MULTI(BASE),copy)(multi1);
949
9
  res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos);
950
9
  multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos);
951
9
952
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi2);
953
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi1);
954
9
955
9
  return res;
956
9
error:
957
0
  FN(MULTI(BASE),free)(multi1);
958
0
  FN(MULTI(BASE),free)(multi2);
959
0
  return NULL;
960
9
}
Unexecuted instantiation: isl_multi_pw_aff_range_splice
Unexecuted instantiation: isl_multi_union_pw_aff_range_splice
Unexecuted instantiation: isl_multi_val_range_splice
961
962
#ifndef NO_SPLICE
963
/* Given two multi expressions, "multi1"
964
 *
965
 *  [A1 A2] -> [B1 B2]
966
 *
967
 * where A2 starts at position "in_pos" and B2 starts at position "out_pos",
968
 * and "multi2"
969
 *
970
 *  [C] -> [D]
971
 *
972
 * return the multi expression
973
 *
974
 *  [A1 C A2] -> [B1 D B2]
975
 *
976
 * We first insert input dimensions to obtain
977
 *
978
 *  [A1 C A2] -> [B1 B2]
979
 *
980
 * and
981
 *
982
 *  [A1 C A2] -> [D]
983
 *
984
 * and then apply range_splice.
985
 */
986
__isl_give MULTI(BASE) *FN(MULTI(BASE),splice)(
987
  __isl_take MULTI(BASE) *multi1, unsigned in_pos, unsigned out_pos,
988
  __isl_take MULTI(BASE) *multi2)
989
6
{
990
6
  unsigned n_in1;
991
6
  unsigned n_in2;
992
6
993
6
  if (!multi1 || !multi2)
994
0
    goto error;
995
6
996
6
  n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
997
6
  if (in_pos > n_in1)
998
6
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
999
6
      "index out of bounds", goto error);
1000
6
1001
6
  n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
1002
6
1003
6
  multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
1004
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
1005
6
            n_in1 - in_pos);
1006
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos);
1007
6
1008
6
  return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2);
1009
6
error:
1010
0
  FN(MULTI(BASE),free)(multi1);
1011
0
  FN(MULTI(BASE),free)(multi2);
1012
0
  return NULL;
1013
6
}
isl_multi_aff_splice
Line
Count
Source
989
6
{
990
6
  unsigned n_in1;
991
6
  unsigned n_in2;
992
6
993
6
  if (!multi1 || !multi2)
994
0
    goto error;
995
6
996
6
  n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
997
6
  if (in_pos > n_in1)
998
6
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
999
6
      "index out of bounds", goto error);
1000
6
1001
6
  n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
1002
6
1003
6
  multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
1004
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
1005
6
            n_in1 - in_pos);
1006
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos);
1007
6
1008
6
  return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2);
1009
6
error:
1010
0
  FN(MULTI(BASE),free)(multi1);
1011
0
  FN(MULTI(BASE),free)(multi2);
1012
0
  return NULL;
1013
6
}
Unexecuted instantiation: isl_multi_pw_aff_splice
Unexecuted instantiation: isl_multi_val_splice
1014
#endif
1015
1016
/* This function is currently only used from isl_aff.c
1017
 */
1018
static __isl_give MULTI(BASE) *FN(MULTI(BASE),bin_op)(
1019
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2,
1020
  __isl_give EL *(*fn)(__isl_take EL *, __isl_take EL *))
1021
  __attribute__ ((unused));
1022
1023
/* Pairwise perform "fn" to the elements of "multi1" and "multi2" and
1024
 * return the result.
1025
 */
1026
static __isl_give MULTI(BASE) *FN(MULTI(BASE),bin_op)(
1027
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2,
1028
  __isl_give EL *(*fn)(__isl_take EL *, __isl_take EL *))
1029
159
{
1030
159
  int i;
1031
159
  isl_ctx *ctx;
1032
159
1033
159
  multi1 = FN(MULTI(BASE),cow)(multi1);
1034
159
  if (!multi1 || !multi2)
1035
0
    goto error;
1036
159
1037
159
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
1038
159
  if (!isl_space_is_equal(multi1->space, multi2->space))
1039
159
    
isl_die0
(ctx, isl_error_invalid,
1040
159
      "spaces don't match", goto error);
1041
159
1042
438
  
for (i = 0; 159
i < multi1->n;
++i279
) {
1043
279
    multi1->p[i] = fn(multi1->p[i], FN(EL,copy)(multi2->p[i]));
1044
279
    if (!multi1->p[i])
1045
0
      goto error;
1046
279
  }
1047
159
1048
159
  FN(MULTI(BASE),free)(multi2);
1049
159
  return multi1;
1050
159
error:
1051
0
  FN(MULTI(BASE),free)(multi1);
1052
0
  FN(MULTI(BASE),free)(multi2);
1053
0
  return NULL;
1054
159
}
isl_aff.c:isl_multi_aff_bin_op
Line
Count
Source
1029
3
{
1030
3
  int i;
1031
3
  isl_ctx *ctx;
1032
3
1033
3
  multi1 = FN(MULTI(BASE),cow)(multi1);
1034
3
  if (!multi1 || !multi2)
1035
0
    goto error;
1036
3
1037
3
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
1038
3
  if (!isl_space_is_equal(multi1->space, multi2->space))
1039
3
    
isl_die0
(ctx, isl_error_invalid,
1040
3
      "spaces don't match", goto error);
1041
3
1042
6
  
for (i = 0; 3
i < multi1->n;
++i3
) {
1043
3
    multi1->p[i] = fn(multi1->p[i], FN(EL,copy)(multi2->p[i]));
1044
3
    if (!multi1->p[i])
1045
0
      goto error;
1046
3
  }
1047
3
1048
3
  FN(MULTI(BASE),free)(multi2);
1049
3
  return multi1;
1050
3
error:
1051
0
  FN(MULTI(BASE),free)(multi1);
1052
0
  FN(MULTI(BASE),free)(multi2);
1053
0
  return NULL;
1054
3
}
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_bin_op
isl_aff.c:isl_multi_union_pw_aff_bin_op
Line
Count
Source
1029
156
{
1030
156
  int i;
1031
156
  isl_ctx *ctx;
1032
156
1033
156
  multi1 = FN(MULTI(BASE),cow)(multi1);
1034
156
  if (!multi1 || !multi2)
1035
0
    goto error;
1036
156
1037
156
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
1038
156
  if (!isl_space_is_equal(multi1->space, multi2->space))
1039
156
    
isl_die0
(ctx, isl_error_invalid,
1040
156
      "spaces don't match", goto error);
1041
156
1042
432
  
for (i = 0; 156
i < multi1->n;
++i276
) {
1043
276
    multi1->p[i] = fn(multi1->p[i], FN(EL,copy)(multi2->p[i]));
1044
276
    if (!multi1->p[i])
1045
0
      goto error;
1046
276
  }
1047
156
1048
156
  FN(MULTI(BASE),free)(multi2);
1049
156
  return multi1;
1050
156
error:
1051
0
  FN(MULTI(BASE),free)(multi1);
1052
0
  FN(MULTI(BASE),free)(multi2);
1053
0
  return NULL;
1054
156
}
Unexecuted instantiation: isl_val.c:isl_multi_val_bin_op
1055
1056
/* Add "multi2" from "multi1" and return the result.
1057
 *
1058
 * The parameters of "multi1" and "multi2" are assumed to have been aligned.
1059
 */
1060
static __isl_give MULTI(BASE) *FN(MULTI(BASE),add_aligned)(
1061
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
1062
3
{
1063
3
  return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,add));
1064
3
}
isl_aff.c:isl_multi_aff_add_aligned
Line
Count
Source
1062
3
{
1063
3
  return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,add));
1064
3
}
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_add_aligned
Unexecuted instantiation: isl_aff.c:isl_multi_union_pw_aff_add_aligned
Unexecuted instantiation: isl_val.c:isl_multi_val_add_aligned
1065
1066
/* Add "multi2" from "multi1" and return the result.
1067
 */
1068
__isl_give MULTI(BASE) *FN(MULTI(BASE),add)(__isl_take MULTI(BASE) *multi1,
1069
  __isl_take MULTI(BASE) *multi2)
1070
3
{
1071
3
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1072
3
            &FN(MULTI(BASE),add_aligned));
1073
3
}
isl_multi_aff_add
Line
Count
Source
1070
3
{
1071
3
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1072
3
            &FN(MULTI(BASE),add_aligned));
1073
3
}
Unexecuted instantiation: isl_multi_pw_aff_add
Unexecuted instantiation: isl_multi_union_pw_aff_add
Unexecuted instantiation: isl_multi_val_add
1074
1075
/* Subtract "multi2" from "multi1" and return the result.
1076
 *
1077
 * The parameters of "multi1" and "multi2" are assumed to have been aligned.
1078
 */
1079
static __isl_give MULTI(BASE) *FN(MULTI(BASE),sub_aligned)(
1080
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
1081
76
{
1082
76
  return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,sub));
1083
76
}
Unexecuted instantiation: isl_aff.c:isl_multi_aff_sub_aligned
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_sub_aligned
isl_aff.c:isl_multi_union_pw_aff_sub_aligned
Line
Count
Source
1081
76
{
1082
76
  return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,sub));
1083
76
}
Unexecuted instantiation: isl_val.c:isl_multi_val_sub_aligned
1084
1085
/* Subtract "multi2" from "multi1" and return the result.
1086
 */
1087
__isl_give MULTI(BASE) *FN(MULTI(BASE),sub)(__isl_take MULTI(BASE) *multi1,
1088
  __isl_take MULTI(BASE) *multi2)
1089
76
{
1090
76
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1091
76
            &FN(MULTI(BASE),sub_aligned));
1092
76
}
Unexecuted instantiation: isl_multi_aff_sub
Unexecuted instantiation: isl_multi_pw_aff_sub
isl_multi_union_pw_aff_sub
Line
Count
Source
1089
76
{
1090
76
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1091
76
            &FN(MULTI(BASE),sub_aligned));
1092
76
}
Unexecuted instantiation: isl_multi_val_sub
1093
1094
/* Multiply the elements of "multi" by "v" and return the result.
1095
 */
1096
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_val)(__isl_take MULTI(BASE) *multi,
1097
  __isl_take isl_val *v)
1098
0
{
1099
0
  int i;
1100
0
1101
0
  if (!multi || !v)
1102
0
    goto error;
1103
0
1104
0
  if (isl_val_is_one(v)) {
1105
0
    isl_val_free(v);
1106
0
    return multi;
1107
0
  }
1108
0
1109
0
  if (!isl_val_is_rat(v))
1110
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
1111
0
      "expecting rational factor", goto error);
1112
0
1113
0
  multi = FN(MULTI(BASE),cow)(multi);
1114
0
  if (!multi)
1115
0
    return NULL;
1116
0
1117
0
  for (i = 0; i < multi->n; ++i) {
1118
0
    multi->p[i] = FN(EL,scale_val)(multi->p[i], isl_val_copy(v));
1119
0
    if (!multi->p[i])
1120
0
      goto error;
1121
0
  }
1122
0
1123
0
  isl_val_free(v);
1124
0
  return multi;
1125
0
error:
1126
0
  isl_val_free(v);
1127
0
  return FN(MULTI(BASE),free)(multi);
1128
0
}
Unexecuted instantiation: isl_multi_aff_scale_val
Unexecuted instantiation: isl_multi_pw_aff_scale_val
Unexecuted instantiation: isl_multi_union_pw_aff_scale_val
Unexecuted instantiation: isl_multi_val_scale_val
1129
1130
/* Divide the elements of "multi" by "v" and return the result.
1131
 */
1132
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_down_val)(
1133
  __isl_take MULTI(BASE) *multi, __isl_take isl_val *v)
1134
0
{
1135
0
  int i;
1136
0
1137
0
  if (!multi || !v)
1138
0
    goto error;
1139
0
1140
0
  if (isl_val_is_one(v)) {
1141
0
    isl_val_free(v);
1142
0
    return multi;
1143
0
  }
1144
0
1145
0
  if (!isl_val_is_rat(v))
1146
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
1147
0
      "expecting rational factor", goto error);
1148
0
  if (isl_val_is_zero(v))
1149
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
1150
0
      "cannot scale down by zero", goto error);
1151
0
1152
0
  multi = FN(MULTI(BASE),cow)(multi);
1153
0
  if (!multi)
1154
0
    return NULL;
1155
0
1156
0
  for (i = 0; i < multi->n; ++i) {
1157
0
    multi->p[i] = FN(EL,scale_down_val)(multi->p[i],
1158
0
                isl_val_copy(v));
1159
0
    if (!multi->p[i])
1160
0
      goto error;
1161
0
  }
1162
0
1163
0
  isl_val_free(v);
1164
0
  return multi;
1165
0
error:
1166
0
  isl_val_free(v);
1167
0
  return FN(MULTI(BASE),free)(multi);
1168
0
}
Unexecuted instantiation: isl_multi_aff_scale_down_val
Unexecuted instantiation: isl_multi_pw_aff_scale_down_val
Unexecuted instantiation: isl_multi_union_pw_aff_scale_down_val
Unexecuted instantiation: isl_multi_val_scale_down_val
1169
1170
/* Multiply the elements of "multi" by the corresponding element of "mv"
1171
 * and return the result.
1172
 */
1173
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_multi_val)(
1174
  __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
1175
75
{
1176
75
  int i;
1177
75
1178
75
  if (!multi || !mv)
1179
0
    goto error;
1180
75
1181
75
  if (!isl_space_tuple_is_equal(multi->space, isl_dim_out,
1182
75
          mv->space, isl_dim_set))
1183
75
    
isl_die0
(isl_multi_val_get_ctx(mv), isl_error_invalid,
1184
75
      "spaces don't match", goto error);
1185
75
1186
75
  multi = FN(MULTI(BASE),cow)(multi);
1187
75
  if (!multi)
1188
0
    goto error;
1189
75
1190
241
  
for (i = 0; 75
i < multi->n;
++i166
) {
1191
166
    isl_val *v;
1192
166
1193
166
    v = isl_multi_val_get_val(mv, i);
1194
166
    multi->p[i] = FN(EL,scale_val)(multi->p[i], v);
1195
166
    if (!multi->p[i])
1196
0
      goto error;
1197
166
  }
1198
75
1199
75
  isl_multi_val_free(mv);
1200
75
  return multi;
1201
75
error:
1202
0
  isl_multi_val_free(mv);
1203
0
  return FN(MULTI(BASE),free)(multi);
1204
75
}
Unexecuted instantiation: isl_multi_aff_scale_multi_val
Unexecuted instantiation: isl_multi_pw_aff_scale_multi_val
isl_multi_union_pw_aff_scale_multi_val
Line
Count
Source
1175
75
{
1176
75
  int i;
1177
75
1178
75
  if (!multi || !mv)
1179
0
    goto error;
1180
75
1181
75
  if (!isl_space_tuple_is_equal(multi->space, isl_dim_out,
1182
75
          mv->space, isl_dim_set))
1183
75
    
isl_die0
(isl_multi_val_get_ctx(mv), isl_error_invalid,
1184
75
      "spaces don't match", goto error);
1185
75
1186
75
  multi = FN(MULTI(BASE),cow)(multi);
1187
75
  if (!multi)
1188
0
    goto error;
1189
75
1190
241
  
for (i = 0; 75
i < multi->n;
++i166
) {
1191
166
    isl_val *v;
1192
166
1193
166
    v = isl_multi_val_get_val(mv, i);
1194
166
    multi->p[i] = FN(EL,scale_val)(multi->p[i], v);
1195
166
    if (!multi->p[i])
1196
0
      goto error;
1197
166
  }
1198
75
1199
75
  isl_multi_val_free(mv);
1200
75
  return multi;
1201
75
error:
1202
0
  isl_multi_val_free(mv);
1203
0
  return FN(MULTI(BASE),free)(multi);
1204
75
}
Unexecuted instantiation: isl_multi_val_scale_multi_val
1205
1206
/* Divide the elements of "multi" by the corresponding element of "mv"
1207
 * and return the result.
1208
 */
1209
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_down_multi_val)(
1210
  __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
1211
0
{
1212
0
  int i;
1213
0
1214
0
  if (!multi || !mv)
1215
0
    goto error;
1216
0
1217
0
  if (!isl_space_tuple_is_equal(multi->space, isl_dim_out,
1218
0
          mv->space, isl_dim_set))
1219
0
    isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid,
1220
0
      "spaces don't match", goto error);
1221
0
1222
0
  multi = FN(MULTI(BASE),cow)(multi);
1223
0
  if (!multi)
1224
0
    return NULL;
1225
0
1226
0
  for (i = 0; i < multi->n; ++i) {
1227
0
    isl_val *v;
1228
0
1229
0
    v = isl_multi_val_get_val(mv, i);
1230
0
    multi->p[i] = FN(EL,scale_down_val)(multi->p[i], v);
1231
0
    if (!multi->p[i])
1232
0
      goto error;
1233
0
  }
1234
0
1235
0
  isl_multi_val_free(mv);
1236
0
  return multi;
1237
0
error:
1238
0
  isl_multi_val_free(mv);
1239
0
  return FN(MULTI(BASE),free)(multi);
1240
0
}
Unexecuted instantiation: isl_multi_aff_scale_down_multi_val
Unexecuted instantiation: isl_multi_pw_aff_scale_down_multi_val
Unexecuted instantiation: isl_multi_union_pw_aff_scale_down_multi_val
Unexecuted instantiation: isl_multi_val_scale_down_multi_val
1241
1242
/* Compute the residues of the elements of "multi" modulo
1243
 * the corresponding element of "mv" and return the result.
1244
 */
1245
__isl_give MULTI(BASE) *FN(MULTI(BASE),mod_multi_val)(
1246
  __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
1247
0
{
1248
0
  int i;
1249
0
1250
0
  if (!multi || !mv)
1251
0
    goto error;
1252
0
1253
0
  if (!isl_space_tuple_is_equal(multi->space, isl_dim_out,
1254
0
          mv->space, isl_dim_set))
1255
0
    isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid,
1256
0
      "spaces don't match", goto error);
1257
0
1258
0
  multi = FN(MULTI(BASE),cow)(multi);
1259
0
  if (!multi)
1260
0
    goto error;
1261
0
1262
0
  for (i = 0; i < multi->n; ++i) {
1263
0
    isl_val *v;
1264
0
1265
0
    v = isl_multi_val_get_val(mv, i);
1266
0
    multi->p[i] = FN(EL,mod_val)(multi->p[i], v);
1267
0
    if (!multi->p[i])
1268
0
      goto error;
1269
0
  }
1270
0
1271
0
  isl_multi_val_free(mv);
1272
0
  return multi;
1273
0
error:
1274
0
  isl_multi_val_free(mv);
1275
0
  return FN(MULTI(BASE),free)(multi);
1276
0
}
Unexecuted instantiation: isl_multi_aff_mod_multi_val
Unexecuted instantiation: isl_multi_pw_aff_mod_multi_val
Unexecuted instantiation: isl_multi_union_pw_aff_mod_multi_val
Unexecuted instantiation: isl_multi_val_mod_multi_val
1277
1278
#ifndef NO_MOVE_DIMS
1279
/* Move the "n" dimensions of "src_type" starting at "src_pos" of "multi"
1280
 * to dimensions of "dst_type" at "dst_pos".
1281
 *
1282
 * We only support moving input dimensions to parameters and vice versa.
1283
 */
1284
__isl_give MULTI(BASE) *FN(MULTI(BASE),move_dims)(__isl_take MULTI(BASE) *multi,
1285
  enum isl_dim_type dst_type, unsigned dst_pos,
1286
  enum isl_dim_type src_type, unsigned src_pos, unsigned n)
1287
0
{
1288
0
  int i;
1289
0
1290
0
  if (!multi)
1291
0
    return NULL;
1292
0
1293
0
  if (n == 0 &&
1294
0
      !isl_space_is_named_or_nested(multi->space, src_type) &&
1295
0
      !isl_space_is_named_or_nested(multi->space, dst_type))
1296
0
    return multi;
1297
0
1298
0
  if (dst_type == isl_dim_out || src_type == isl_dim_out)
1299
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1300
0
      "cannot move output/set dimension",
1301
0
      return FN(MULTI(BASE),free)(multi));
1302
0
  if (dst_type == isl_dim_div || src_type == isl_dim_div)
1303
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1304
0
      "cannot move divs",
1305
0
      return FN(MULTI(BASE),free)(multi));
1306
0
  if (src_pos + n > isl_space_dim(multi->space, src_type))
1307
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1308
0
      "range out of bounds",
1309
0
      return FN(MULTI(BASE),free)(multi));
1310
0
  if (dst_type == src_type)
1311
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_unsupported,
1312
0
      "moving dims within the same type not supported",
1313
0
      return FN(MULTI(BASE),free)(multi));
1314
0
1315
0
  multi = FN(MULTI(BASE),cow)(multi);
1316
0
  if (!multi)
1317
0
    return NULL;
1318
0
1319
0
  multi->space = isl_space_move_dims(multi->space, dst_type, dst_pos,
1320
0
            src_type, src_pos, n);
1321
0
  if (!multi->space)
1322
0
    return FN(MULTI(BASE),free)(multi);
1323
0
1324
0
  for (i = 0; i < multi->n; ++i) {
1325
0
    multi->p[i] = FN(EL,move_dims)(multi->p[i], dst_type, dst_pos,
1326
0
            src_type, src_pos, n);
1327
0
    if (!multi->p[i])
1328
0
      return FN(MULTI(BASE),free)(multi);
1329
0
  }
1330
0
1331
0
  return multi;
1332
0
}
Unexecuted instantiation: isl_multi_aff_move_dims
Unexecuted instantiation: isl_multi_pw_aff_move_dims
1333
#endif
1334
1335
/* Convert a multiple expression defined over a parameter domain
1336
 * into one that is defined over a zero-dimensional set.
1337
 */
1338
__isl_give MULTI(BASE) *FN(MULTI(BASE),from_range)(
1339
  __isl_take MULTI(BASE) *multi)
1340
0
{
1341
0
  isl_space *space;
1342
0
1343
0
  if (!multi)
1344
0
    return NULL;
1345
0
  if (!isl_space_is_set(multi->space))
1346
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1347
0
      "not living in a set space",
1348
0
      return FN(MULTI(BASE),free)(multi));
1349
0
1350
0
  space = FN(MULTI(BASE),get_space)(multi);
1351
0
  space = isl_space_from_range(space);
1352
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
1353
0
1354
0
  return multi;
1355
0
}
Unexecuted instantiation: isl_multi_aff_from_range
Unexecuted instantiation: isl_multi_pw_aff_from_range
Unexecuted instantiation: isl_multi_union_pw_aff_from_range
Unexecuted instantiation: isl_multi_val_from_range
1356
1357
/* Are "multi1" and "multi2" obviously equal?
1358
 */
1359
isl_bool FN(MULTI(BASE),plain_is_equal)(__isl_keep MULTI(BASE) *multi1,
1360
  __isl_keep MULTI(BASE) *multi2)
1361
1.75k
{
1362
1.75k
  int i;
1363
1.75k
  isl_bool equal;
1364
1.75k
1365
1.75k
  if (!multi1 || !multi2)
1366
0
    return isl_bool_error;
1367
1.75k
  if (multi1->n != multi2->n)
1368
0
    return isl_bool_false;
1369
1.75k
  equal = isl_space_is_equal(multi1->space, multi2->space);
1370
1.75k
  if (equal < 0 || !equal)
1371
0
    return equal;
1372
1.75k
1373
2.33k
  
for (i = 0; 1.75k
i < multi1->n;
++i574
) {
1374
2.21k
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1375
2.21k
    if (equal < 0 || !equal)
1376
1.64k
      return equal;
1377
2.21k
  }
1378
1.75k
1379
1.75k
  
return isl_bool_true114
;
1380
1.75k
}
isl_multi_aff_plain_is_equal
Line
Count
Source
1361
1.74k
{
1362
1.74k
  int i;
1363
1.74k
  isl_bool equal;
1364
1.74k
1365
1.74k
  if (!multi1 || !multi2)
1366
0
    return isl_bool_error;
1367
1.74k
  if (multi1->n != multi2->n)
1368
0
    return isl_bool_false;
1369
1.74k
  equal = isl_space_is_equal(multi1->space, multi2->space);
1370
1.74k
  if (equal < 0 || !equal)
1371
0
    return equal;
1372
1.74k
1373
2.30k
  
for (i = 0; 1.74k
i < multi1->n;
++i555
) {
1374
2.20k
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1375
2.20k
    if (equal < 0 || !equal)
1376
1.64k
      return equal;
1377
2.20k
  }
1378
1.74k
1379
1.74k
  
return isl_bool_true104
;
1380
1.74k
}
isl_multi_pw_aff_plain_is_equal
Line
Count
Source
1361
1
{
1362
1
  int i;
1363
1
  isl_bool equal;
1364
1
1365
1
  if (!multi1 || !multi2)
1366
0
    return isl_bool_error;
1367
1
  if (multi1->n != multi2->n)
1368
0
    return isl_bool_false;
1369
1
  equal = isl_space_is_equal(multi1->space, multi2->space);
1370
1
  if (equal < 0 || !equal)
1371
0
    return equal;
1372
1
1373
3
  
for (i = 0; 1
i < multi1->n;
++i2
) {
1374
2
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1375
2
    if (equal < 0 || !equal)
1376
0
      return equal;
1377
2
  }
1378
1
1379
1
  return isl_bool_true;
1380
1
}
isl_multi_union_pw_aff_plain_is_equal
Line
Count
Source
1361
9
{
1362
9
  int i;
1363
9
  isl_bool equal;
1364
9
1365
9
  if (!multi1 || !multi2)
1366
0
    return isl_bool_error;
1367
9
  if (multi1->n != multi2->n)
1368
0
    return isl_bool_false;
1369
9
  equal = isl_space_is_equal(multi1->space, multi2->space);
1370
9
  if (equal < 0 || !equal)
1371
0
    return equal;
1372
9
1373
26
  
for (i = 0; 9
i < multi1->n;
++i17
) {
1374
17
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1375
17
    if (equal < 0 || !equal)
1376
0
      return equal;
1377
17
  }
1378
9
1379
9
  return isl_bool_true;
1380
9
}
Unexecuted instantiation: isl_multi_val_plain_is_equal
1381
1382
/* Does "multi" involve any NaNs?
1383
 */
1384
isl_bool FN(MULTI(BASE),involves_nan)(__isl_keep MULTI(BASE) *multi)
1385
1.03k
{
1386
1.03k
  int i;
1387
1.03k
1388
1.03k
  if (!multi)
1389
0
    return isl_bool_error;
1390
1.03k
  if (multi->n == 0)
1391
0
    return isl_bool_false;
1392
1.03k
1393
3.01k
  
for (i = 0; 1.03k
i < multi->n;
++i1.97k
) {
1394
1.98k
    isl_bool has_nan = FN(EL,involves_nan)(multi->p[i]);
1395
1.98k
    if (has_nan < 0 || has_nan)
1396
2
      return has_nan;
1397
1.98k
  }
1398
1.03k
1399
1.03k
  
return isl_bool_false1.03k
;
1400
1.03k
}
isl_multi_aff_involves_nan
Line
Count
Source
1385
1.03k
{
1386
1.03k
  int i;
1387
1.03k
1388
1.03k
  if (!multi)
1389
0
    return isl_bool_error;
1390
1.03k
  if (multi->n == 0)
1391
0
    return isl_bool_false;
1392
1.03k
1393
3.01k
  
for (i = 0; 1.03k
i < multi->n;
++i1.97k
) {
1394
1.98k
    isl_bool has_nan = FN(EL,involves_nan)(multi->p[i]);
1395
1.98k
    if (has_nan < 0 || has_nan)
1396
2
      return has_nan;
1397
1.98k
  }
1398
1.03k
1399
1.03k
  
return isl_bool_false1.03k
;
1400
1.03k
}
Unexecuted instantiation: isl_multi_pw_aff_involves_nan
Unexecuted instantiation: isl_multi_union_pw_aff_involves_nan
Unexecuted instantiation: isl_multi_val_involves_nan
1401
1402
#ifndef NO_DOMAIN
1403
/* Return the shared domain of the elements of "multi".
1404
 */
1405
__isl_give isl_set *FN(MULTI(BASE),domain)(__isl_take MULTI(BASE) *multi)
1406
0
{
1407
0
  int i;
1408
0
  isl_set *dom;
1409
0
1410
0
  if (!multi)
1411
0
    return NULL;
1412
0
1413
0
  dom = isl_set_universe(FN(MULTI(BASE),get_domain_space)(multi));
1414
0
  for (i = 0; i < multi->n; ++i) {
1415
0
    isl_set *dom_i;
1416
0
1417
0
    dom_i = FN(EL,domain)(FN(FN(MULTI(BASE),get),BASE)(multi, i));
1418
0
    dom = isl_set_intersect(dom, dom_i);
1419
0
  }
1420
0
1421
0
  FN(MULTI(BASE),free)(multi);
1422
0
  return dom;
1423
0
}
1424
#endif
1425
1426
#ifndef NO_NEG
1427
/* Return the opposite of "multi".
1428
 */
1429
__isl_give MULTI(BASE) *FN(MULTI(BASE),neg)(__isl_take MULTI(BASE) *multi)
1430
0
{
1431
0
  int i;
1432
0
1433
0
  multi = FN(MULTI(BASE),cow)(multi);
1434
0
  if (!multi)
1435
0
    return NULL;
1436
0
1437
0
  for (i = 0; i < multi->n; ++i) {
1438
0
    multi->p[i] = FN(EL,neg)(multi->p[i]);
1439
0
    if (!multi->p[i])
1440
0
      return FN(MULTI(BASE),free)(multi);
1441
0
  }
1442
0
1443
0
  return multi;
1444
0
}
Unexecuted instantiation: isl_multi_aff_neg
Unexecuted instantiation: isl_multi_pw_aff_neg
Unexecuted instantiation: isl_multi_union_pw_aff_neg
Unexecuted instantiation: isl_multi_val_neg
1445
#endif