Coverage Report

Created: 2017-08-18 19:41

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/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
76.3k
{
23
76.3k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
76.3k
}
isl_multi_val_get_ctx
Line
Count
Source
22
6.58k
{
23
6.58k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
6.58k
}
isl_multi_union_pw_aff_get_ctx
Line
Count
Source
22
22.8k
{
23
22.8k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
22.8k
}
isl_multi_pw_aff_get_ctx
Line
Count
Source
22
17.2k
{
23
17.2k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
17.2k
}
isl_multi_aff_get_ctx
Line
Count
Source
22
29.6k
{
23
29.6k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
24
29.6k
}
25
26
__isl_give isl_space *FN(MULTI(BASE),get_space)(__isl_keep MULTI(BASE) *multi)
27
873k
{
28
873k
  return multi ? isl_space_copy(multi->space) : NULL;
29
873k
}
isl_multi_pw_aff_get_space
Line
Count
Source
27
29.6k
{
28
29.6k
  return multi ? isl_space_copy(multi->space) : NULL;
29
29.6k
}
isl_multi_val_get_space
Line
Count
Source
27
13.9k
{
28
13.9k
  return multi ? isl_space_copy(multi->space) : NULL;
29
13.9k
}
isl_multi_aff_get_space
Line
Count
Source
27
808k
{
28
808k
  return multi ? isl_space_copy(multi->space) : NULL;
29
808k
}
isl_multi_union_pw_aff_get_space
Line
Count
Source
27
21.4k
{
28
21.4k
  return multi ? isl_space_copy(multi->space) : NULL;
29
21.4k
}
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_union_pw_aff_find_dim_by_name
Unexecuted instantiation: isl_multi_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
58.0k
{
46
58.0k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
58.0k
}
isl_multi_aff_get_domain_space
Line
Count
Source
45
57.8k
{
46
57.8k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
57.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
106
{
46
106
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
47
106
}
Unexecuted instantiation: isl_multi_val_get_domain_space
48
49
__isl_give MULTI(BASE) *FN(MULTI(BASE),alloc)(__isl_take isl_space *space)
50
138k
{
51
138k
  isl_ctx *ctx;
52
138k
  int n;
53
138k
  MULTI(BASE) *multi;
54
138k
55
138k
  if (!space)
56
0
    return NULL;
57
138k
58
138k
  ctx = isl_space_get_ctx(space);
59
138k
  n = isl_space_dim(space, isl_dim_out);
60
138k
  multi = isl_calloc(ctx, MULTI(BASE),
61
138k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
138k
  if (!multi)
63
0
    goto error;
64
138k
65
138k
  multi->space = space;
66
138k
  multi->n = n;
67
138k
  multi->ref = 1;
68
138k
  return multi;
69
138k
error:
70
0
  isl_space_free(space);
71
138k
  return NULL;
72
138k
}
isl_multi_union_pw_aff_alloc
Line
Count
Source
50
8.42k
{
51
8.42k
  isl_ctx *ctx;
52
8.42k
  int n;
53
8.42k
  MULTI(BASE) *multi;
54
8.42k
55
8.42k
  if (!space)
56
0
    return NULL;
57
8.42k
58
8.42k
  ctx = isl_space_get_ctx(space);
59
8.42k
  n = isl_space_dim(space, isl_dim_out);
60
8.42k
  multi = isl_calloc(ctx, MULTI(BASE),
61
8.42k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
8.42k
  if (!multi)
63
0
    goto error;
64
8.42k
65
8.42k
  multi->space = space;
66
8.42k
  multi->n = n;
67
8.42k
  multi->ref = 1;
68
8.42k
  return multi;
69
8.42k
error:
70
0
  isl_space_free(space);
71
8.42k
  return NULL;
72
8.42k
}
isl_multi_val_alloc
Line
Count
Source
50
2.53k
{
51
2.53k
  isl_ctx *ctx;
52
2.53k
  int n;
53
2.53k
  MULTI(BASE) *multi;
54
2.53k
55
2.53k
  if (!space)
56
0
    return NULL;
57
2.53k
58
2.53k
  ctx = isl_space_get_ctx(space);
59
2.53k
  n = isl_space_dim(space, isl_dim_out);
60
2.53k
  multi = isl_calloc(ctx, MULTI(BASE),
61
2.53k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
2.53k
  if (!multi)
63
0
    goto error;
64
2.53k
65
2.53k
  multi->space = space;
66
2.53k
  multi->n = n;
67
2.53k
  multi->ref = 1;
68
2.53k
  return multi;
69
2.53k
error:
70
0
  isl_space_free(space);
71
2.53k
  return NULL;
72
2.53k
}
isl_multi_aff_alloc
Line
Count
Source
50
119k
{
51
119k
  isl_ctx *ctx;
52
119k
  int n;
53
119k
  MULTI(BASE) *multi;
54
119k
55
119k
  if (!space)
56
0
    return NULL;
57
119k
58
119k
  ctx = isl_space_get_ctx(space);
59
119k
  n = isl_space_dim(space, isl_dim_out);
60
119k
  multi = isl_calloc(ctx, MULTI(BASE),
61
119k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
119k
  if (!multi)
63
0
    goto error;
64
119k
65
119k
  multi->space = space;
66
119k
  multi->n = n;
67
119k
  multi->ref = 1;
68
119k
  return multi;
69
119k
error:
70
0
  isl_space_free(space);
71
119k
  return NULL;
72
119k
}
isl_multi_pw_aff_alloc
Line
Count
Source
50
7.83k
{
51
7.83k
  isl_ctx *ctx;
52
7.83k
  int n;
53
7.83k
  MULTI(BASE) *multi;
54
7.83k
55
7.83k
  if (!space)
56
0
    return NULL;
57
7.83k
58
7.83k
  ctx = isl_space_get_ctx(space);
59
7.83k
  n = isl_space_dim(space, isl_dim_out);
60
7.83k
  multi = isl_calloc(ctx, MULTI(BASE),
61
7.83k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
62
7.83k
  if (!multi)
63
0
    goto error;
64
7.83k
65
7.83k
  multi->space = space;
66
7.83k
  multi->n = n;
67
7.83k
  multi->ref = 1;
68
7.83k
  return multi;
69
7.83k
error:
70
0
  isl_space_free(space);
71
7.83k
  return NULL;
72
7.83k
}
73
74
__isl_give MULTI(BASE) *FN(MULTI(BASE),dup)(__isl_keep MULTI(BASE) *multi)
75
92.7k
{
76
92.7k
  int i;
77
92.7k
  MULTI(BASE) *dup;
78
92.7k
79
92.7k
  if (!multi)
80
0
    return NULL;
81
92.7k
82
92.7k
  
dup = 92.7k
FN92.7k
(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
92.7k
  if (!dup)
84
0
    return NULL;
85
92.7k
86
688k
  
for (i = 0; 92.7k
i < multi->n688k
;
++i596k
)
87
596k
    
dup = 596k
FN596k
(FN(MULTI(BASE),set),BASE)(dup, i,
88
596k
                FN(EL,copy)(multi->p[i]));
89
92.7k
90
92.7k
  return dup;
91
92.7k
}
Unexecuted instantiation: isl_multi_pw_aff_dup
isl_multi_union_pw_aff_dup
Line
Count
Source
75
1.06k
{
76
1.06k
  int i;
77
1.06k
  MULTI(BASE) *dup;
78
1.06k
79
1.06k
  if (!multi)
80
0
    return NULL;
81
1.06k
82
1.06k
  
dup = 1.06k
FN1.06k
(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
1.06k
  if (!dup)
84
0
    return NULL;
85
1.06k
86
3.04k
  
for (i = 0; 1.06k
i < multi->n3.04k
;
++i1.97k
)
87
1.97k
    
dup = 1.97k
FN1.97k
(FN(MULTI(BASE),set),BASE)(dup, i,
88
1.97k
                FN(EL,copy)(multi->p[i]));
89
1.06k
90
1.06k
  return dup;
91
1.06k
}
isl_multi_aff_dup
Line
Count
Source
75
91.4k
{
76
91.4k
  int i;
77
91.4k
  MULTI(BASE) *dup;
78
91.4k
79
91.4k
  if (!multi)
80
0
    return NULL;
81
91.4k
82
91.4k
  
dup = 91.4k
FN91.4k
(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
91.4k
  if (!dup)
84
0
    return NULL;
85
91.4k
86
685k
  
for (i = 0; 91.4k
i < multi->n685k
;
++i593k
)
87
593k
    
dup = 593k
FN593k
(FN(MULTI(BASE),set),BASE)(dup, i,
88
593k
                FN(EL,copy)(multi->p[i]));
89
91.4k
90
91.4k
  return dup;
91
91.4k
}
isl_multi_val_dup
Line
Count
Source
75
164
{
76
164
  int i;
77
164
  MULTI(BASE) *dup;
78
164
79
164
  if (!multi)
80
0
    return NULL;
81
164
82
164
  
dup = 164
FN164
(MULTI(BASE),alloc)(isl_space_copy(multi->space));
83
164
  if (!dup)
84
0
    return NULL;
85
164
86
576
  
for (i = 0; 164
i < multi->n576
;
++i412
)
87
412
    
dup = 412
FN412
(FN(MULTI(BASE),set),BASE)(dup, i,
88
412
                FN(EL,copy)(multi->p[i]));
89
164
90
164
  return dup;
91
164
}
92
93
__isl_give MULTI(BASE) *FN(MULTI(BASE),cow)(__isl_take MULTI(BASE) *multi)
94
806k
{
95
806k
  if (!multi)
96
0
    return NULL;
97
806k
98
806k
  
if (806k
multi->ref == 1806k
)
99
713k
    return multi;
100
806k
101
806k
  multi->ref--;
102
92.7k
  return FN(MULTI(BASE),dup)(multi);
103
806k
}
isl_multi_union_pw_aff_cow
Line
Count
Source
94
12.8k
{
95
12.8k
  if (!multi)
96
0
    return NULL;
97
12.8k
98
12.8k
  
if (12.8k
multi->ref == 112.8k
)
99
11.7k
    return multi;
100
12.8k
101
12.8k
  multi->ref--;
102
1.06k
  return FN(MULTI(BASE),dup)(multi);
103
12.8k
}
isl_multi_pw_aff_cow
Line
Count
Source
94
34.1k
{
95
34.1k
  if (!multi)
96
0
    return NULL;
97
34.1k
98
34.1k
  
if (34.1k
multi->ref == 134.1k
)
99
34.1k
    return multi;
100
34.1k
101
34.1k
  multi->ref--;
102
0
  return FN(MULTI(BASE),dup)(multi);
103
34.1k
}
isl_multi_val_cow
Line
Count
Source
94
8.69k
{
95
8.69k
  if (!multi)
96
0
    return NULL;
97
8.69k
98
8.69k
  
if (8.69k
multi->ref == 18.69k
)
99
8.53k
    return multi;
100
8.69k
101
8.69k
  multi->ref--;
102
164
  return FN(MULTI(BASE),dup)(multi);
103
8.69k
}
isl_multi_aff_cow
Line
Count
Source
94
750k
{
95
750k
  if (!multi)
96
0
    return NULL;
97
750k
98
750k
  
if (750k
multi->ref == 1750k
)
99
659k
    return multi;
100
750k
101
750k
  multi->ref--;
102
91.4k
  return FN(MULTI(BASE),dup)(multi);
103
750k
}
104
105
__isl_give MULTI(BASE) *FN(MULTI(BASE),copy)(__isl_keep MULTI(BASE) *multi)
106
213k
{
107
213k
  if (!multi)
108
378
    return NULL;
109
213k
110
213k
  multi->ref++;
111
213k
  return multi;
112
213k
}
isl_multi_aff_copy
Line
Count
Source
106
189k
{
107
189k
  if (!multi)
108
378
    return NULL;
109
189k
110
189k
  multi->ref++;
111
189k
  return multi;
112
189k
}
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
14.1k
{
107
14.1k
  if (!multi)
108
0
    return NULL;
109
14.1k
110
14.1k
  multi->ref++;
111
14.1k
  return multi;
112
14.1k
}
isl_multi_val_copy
Line
Count
Source
106
9.82k
{
107
9.82k
  if (!multi)
108
0
    return NULL;
109
9.82k
110
9.82k
  multi->ref++;
111
9.82k
  return multi;
112
9.82k
}
113
114
__isl_null MULTI(BASE) *FN(MULTI(BASE),free)(__isl_take MULTI(BASE) *multi)
115
293k
{
116
293k
  int i;
117
293k
118
293k
  if (!multi)
119
35.3k
    return NULL;
120
293k
121
258k
  
if (258k
--multi->ref > 0258k
)
122
120k
    return NULL;
123
258k
124
258k
  isl_space_free(multi->space);
125
803k
  for (i = 0; 
i < multi->n803k
;
++i665k
)
126
665k
    
FN665k
(EL,free)(multi->p[i])665k
;
127
138k
  free(multi);
128
138k
129
258k
  return NULL;
130
293k
}
isl_multi_union_pw_aff_free
Line
Count
Source
115
21.4k
{
116
21.4k
  int i;
117
21.4k
118
21.4k
  if (!multi)
119
0
    return NULL;
120
21.4k
121
21.4k
  
if (21.4k
--multi->ref > 021.4k
)
122
13.0k
    return NULL;
123
21.4k
124
21.4k
  isl_space_free(multi->space);
125
16.0k
  for (i = 0; 
i < multi->n16.0k
;
++i7.64k
)
126
7.64k
    
FN7.64k
(EL,free)(multi->p[i])7.64k
;
127
8.39k
  free(multi);
128
8.39k
129
21.4k
  return NULL;
130
21.4k
}
isl_multi_val_free
Line
Count
Source
115
12.1k
{
116
12.1k
  int i;
117
12.1k
118
12.1k
  if (!multi)
119
4
    return NULL;
120
12.1k
121
12.1k
  
if (12.1k
--multi->ref > 012.1k
)
122
9.65k
    return NULL;
123
12.1k
124
12.1k
  isl_space_free(multi->space);
125
6.39k
  for (i = 0; 
i < multi->n6.39k
;
++i3.85k
)
126
3.85k
    
FN3.85k
(EL,free)(multi->p[i])3.85k
;
127
2.53k
  free(multi);
128
2.53k
129
12.1k
  return NULL;
130
12.1k
}
isl_multi_aff_free
Line
Count
Source
115
252k
{
116
252k
  int i;
117
252k
118
252k
  if (!multi)
119
35.3k
    return NULL;
120
252k
121
217k
  
if (217k
--multi->ref > 0217k
)
122
97.7k
    return NULL;
123
217k
124
217k
  isl_space_free(multi->space);
125
760k
  for (i = 0; 
i < multi->n760k
;
++i640k
)
126
640k
    
FN640k
(EL,free)(multi->p[i])640k
;
127
119k
  free(multi);
128
119k
129
217k
  return NULL;
130
252k
}
isl_multi_pw_aff_free
Line
Count
Source
115
7.83k
{
116
7.83k
  int i;
117
7.83k
118
7.83k
  if (!multi)
119
0
    return NULL;
120
7.83k
121
7.83k
  
if (7.83k
--multi->ref > 07.83k
)
122
2
    return NULL;
123
7.83k
124
7.83k
  isl_space_free(multi->space);
125
20.4k
  for (i = 0; 
i < multi->n20.4k
;
++i12.6k
)
126
12.6k
    
FN12.6k
(EL,free)(multi->p[i])12.6k
;
127
7.83k
  free(multi);
128
7.83k
129
7.83k
  return NULL;
130
7.83k
}
131
132
#ifndef NO_DIMS
133
/* Check whether "multi" has non-zero coefficients for any dimension
134
 * in the given range or if any of these dimensions appear
135
 * with non-zero coefficients in any of the integer divisions involved.
136
 */
137
isl_bool FN(MULTI(BASE),involves_dims)(__isl_keep MULTI(BASE) *multi,
138
  enum isl_dim_type type, unsigned first, unsigned n)
139
0
{
140
0
  int i;
141
0
142
0
  if (!multi)
143
0
    return isl_bool_error;
144
0
  
if (0
multi->n == 0 || 0
n == 00
)
145
0
    return isl_bool_false;
146
0
147
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
148
0
    isl_bool involves;
149
0
150
0
    involves = FN(EL,involves_dims)(multi->p[i], type, first, n);
151
0
    if (
involves < 0 || 0
involves0
)
152
0
      return involves;
153
0
  }
154
0
155
0
  return isl_bool_false;
156
0
}
Unexecuted instantiation: isl_multi_aff_involves_dims
Unexecuted instantiation: isl_multi_val_involves_dims
Unexecuted instantiation: isl_multi_pw_aff_involves_dims
157
158
__isl_give MULTI(BASE) *FN(MULTI(BASE),insert_dims)(
159
  __isl_take MULTI(BASE) *multi,
160
  enum isl_dim_type type, unsigned first, unsigned n)
161
18
{
162
18
  int i;
163
18
164
18
  if (!multi)
165
0
    return NULL;
166
18
  
if (18
type == isl_dim_out18
)
167
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
168
18
      "cannot insert output/set dimensions",
169
18
      return FN(MULTI(BASE),free)(multi));
170
18
  
if (18
n == 0 && 18
!isl_space_is_named_or_nested(multi->space, type)6
)
171
6
    return multi;
172
18
173
12
  
multi = 12
FN12
(MULTI(BASE),cow)(multi);
174
12
  if (!multi)
175
0
    return NULL;
176
12
177
12
  multi->space = isl_space_insert_dims(multi->space, type, first, n);
178
12
  if (!multi->space)
179
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
180
12
181
24
  
for (i = 0; 12
i < multi->n24
;
++i12
)
{12
182
12
    multi->p[i] = FN(EL,insert_dims)(multi->p[i], type, first, n);
183
12
    if (!multi->p[i])
184
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
185
12
  }
186
12
187
12
  return multi;
188
18
}
Unexecuted instantiation: isl_multi_pw_aff_insert_dims
Unexecuted instantiation: isl_multi_val_insert_dims
isl_multi_aff_insert_dims
Line
Count
Source
161
18
{
162
18
  int i;
163
18
164
18
  if (!multi)
165
0
    return NULL;
166
18
  
if (18
type == isl_dim_out18
)
167
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
168
18
      "cannot insert output/set dimensions",
169
18
      return FN(MULTI(BASE),free)(multi));
170
18
  
if (18
n == 0 && 18
!isl_space_is_named_or_nested(multi->space, type)6
)
171
6
    return multi;
172
18
173
12
  
multi = 12
FN12
(MULTI(BASE),cow)(multi);
174
12
  if (!multi)
175
0
    return NULL;
176
12
177
12
  multi->space = isl_space_insert_dims(multi->space, type, first, n);
178
12
  if (!multi->space)
179
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
180
12
181
24
  
for (i = 0; 12
i < multi->n24
;
++i12
)
{12
182
12
    multi->p[i] = FN(EL,insert_dims)(multi->p[i], type, first, n);
183
12
    if (!multi->p[i])
184
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
185
12
  }
186
12
187
12
  return multi;
188
18
}
189
190
__isl_give MULTI(BASE) *FN(MULTI(BASE),add_dims)(__isl_take MULTI(BASE) *multi,
191
  enum isl_dim_type type, unsigned n)
192
0
{
193
0
  unsigned pos;
194
0
195
0
  pos = FN(MULTI(BASE),dim)(multi, type);
196
0
197
0
  return FN(MULTI(BASE),insert_dims)(multi, type, pos, n);
198
0
}
Unexecuted instantiation: isl_multi_val_add_dims
Unexecuted instantiation: isl_multi_pw_aff_add_dims
Unexecuted instantiation: isl_multi_aff_add_dims
199
#endif
200
201
unsigned FN(MULTI(BASE),dim)(__isl_keep MULTI(BASE) *multi,
202
  enum isl_dim_type type)
203
911k
{
204
911k
  return multi ? 
isl_space_dim(multi->space, type)911k
:
00
;
205
911k
}
isl_multi_aff_dim
Line
Count
Source
203
873k
{
204
873k
  return multi ? 
isl_space_dim(multi->space, type)873k
:
00
;
205
873k
}
isl_multi_val_dim
Line
Count
Source
203
5.95k
{
204
5.95k
  return multi ? 
isl_space_dim(multi->space, type)5.95k
:
00
;
205
5.95k
}
isl_multi_union_pw_aff_dim
Line
Count
Source
203
21.1k
{
204
21.1k
  return multi ? 
isl_space_dim(multi->space, type)21.1k
:
00
;
205
21.1k
}
isl_multi_pw_aff_dim
Line
Count
Source
203
10.3k
{
204
10.3k
  return multi ? 
isl_space_dim(multi->space, type)10.3k
:
00
;
205
10.3k
}
206
207
/* Return the position of the first dimension of "type" with id "id".
208
 * Return -1 if there is no such dimension.
209
 */
210
int FN(MULTI(BASE),find_dim_by_id)(__isl_keep MULTI(BASE) *multi,
211
  enum isl_dim_type type, __isl_keep isl_id *id)
212
0
{
213
0
  if (!multi)
214
0
    return -1;
215
0
  return isl_space_find_dim_by_id(multi->space, type, id);
216
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_find_dim_by_id
Unexecuted instantiation: isl_multi_val_find_dim_by_id
Unexecuted instantiation: isl_multi_pw_aff_find_dim_by_id
Unexecuted instantiation: isl_multi_aff_find_dim_by_id
217
218
/* Return the id of the given dimension.
219
 */
220
__isl_give isl_id *FN(MULTI(BASE),get_dim_id)(__isl_keep MULTI(BASE) *multi,
221
  enum isl_dim_type type, unsigned pos)
222
0
{
223
0
  return multi ? isl_space_get_dim_id(multi->space, type, pos) : NULL;
224
0
}
Unexecuted instantiation: isl_multi_val_get_dim_id
Unexecuted instantiation: isl_multi_aff_get_dim_id
Unexecuted instantiation: isl_multi_union_pw_aff_get_dim_id
Unexecuted instantiation: isl_multi_pw_aff_get_dim_id
225
226
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_name)(
227
  __isl_take MULTI(BASE) *multi,
228
  enum isl_dim_type type, unsigned pos, const char *s)
229
0
{
230
0
  int i;
231
0
232
0
  multi = FN(MULTI(BASE),cow)(multi);
233
0
  if (!multi)
234
0
    return NULL;
235
0
236
0
  multi->space = isl_space_set_dim_name(multi->space, type, pos, s);
237
0
  if (!multi->space)
238
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
239
0
240
0
  
if (0
type == isl_dim_out0
)
241
0
    return multi;
242
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
243
0
    multi->p[i] = FN(EL,set_dim_name)(multi->p[i], type, pos, s);
244
0
    if (!multi->p[i])
245
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
246
0
  }
247
0
248
0
  return multi;
249
0
}
Unexecuted instantiation: isl_multi_aff_set_dim_name
Unexecuted instantiation: isl_multi_val_set_dim_name
Unexecuted instantiation: isl_multi_union_pw_aff_set_dim_name
Unexecuted instantiation: isl_multi_pw_aff_set_dim_name
250
251
const char *FN(MULTI(BASE),get_tuple_name)(__isl_keep MULTI(BASE) *multi,
252
  enum isl_dim_type type)
253
0
{
254
0
  return multi ? isl_space_get_tuple_name(multi->space, type) : NULL;
255
0
}
Unexecuted instantiation: isl_multi_pw_aff_get_tuple_name
Unexecuted instantiation: isl_multi_aff_get_tuple_name
Unexecuted instantiation: isl_multi_val_get_tuple_name
Unexecuted instantiation: isl_multi_union_pw_aff_get_tuple_name
256
257
/* Does the specified tuple have an id?
258
 */
259
isl_bool FN(MULTI(BASE),has_tuple_id)(__isl_keep MULTI(BASE) *multi,
260
  enum isl_dim_type type)
261
4.82k
{
262
4.82k
  if (!multi)
263
0
    return isl_bool_error;
264
4.82k
  return isl_space_has_tuple_id(multi->space, type);
265
4.82k
}
Unexecuted instantiation: isl_multi_val_has_tuple_id
Unexecuted instantiation: isl_multi_aff_has_tuple_id
isl_multi_pw_aff_has_tuple_id
Line
Count
Source
261
2.58k
{
262
2.58k
  if (!multi)
263
0
    return isl_bool_error;
264
2.58k
  return isl_space_has_tuple_id(multi->space, type);
265
2.58k
}
isl_multi_union_pw_aff_has_tuple_id
Line
Count
Source
261
2.24k
{
262
2.24k
  if (!multi)
263
0
    return isl_bool_error;
264
2.24k
  return isl_space_has_tuple_id(multi->space, type);
265
2.24k
}
266
267
/* Return the id of the specified tuple.
268
 */
269
__isl_give isl_id *FN(MULTI(BASE),get_tuple_id)(__isl_keep MULTI(BASE) *multi,
270
  enum isl_dim_type type)
271
2.58k
{
272
2.58k
  return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
273
2.58k
}
Unexecuted instantiation: isl_multi_aff_get_tuple_id
isl_multi_pw_aff_get_tuple_id
Line
Count
Source
271
2.58k
{
272
2.58k
  return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
273
2.58k
}
Unexecuted instantiation: isl_multi_union_pw_aff_get_tuple_id
Unexecuted instantiation: isl_multi_val_get_tuple_id
274
275
__isl_give EL *FN(FN(MULTI(BASE),get),BASE)(__isl_keep MULTI(BASE) *multi,
276
  int pos)
277
66.4k
{
278
66.4k
  isl_ctx *ctx;
279
66.4k
280
66.4k
  if (!multi)
281
0
    return NULL;
282
66.4k
  
ctx = 66.4k
FN66.4k
(MULTI(BASE),get_ctx)(multi);
283
66.4k
  if (
pos < 0 || 66.4k
pos >= multi->n66.4k
)
284
0
    isl_die(ctx, isl_error_invalid,
285
66.4k
      "index out of bounds", return NULL);
286
66.4k
  
return 66.4k
FN66.4k
(EL,copy)(multi->p[pos]);
287
66.4k
}
isl_multi_val_get_val
Line
Count
Source
277
6.51k
{
278
6.51k
  isl_ctx *ctx;
279
6.51k
280
6.51k
  if (!multi)
281
0
    return NULL;
282
6.51k
  
ctx = 6.51k
FN6.51k
(MULTI(BASE),get_ctx)(multi);
283
6.51k
  if (
pos < 0 || 6.51k
pos >= multi->n6.51k
)
284
0
    isl_die(ctx, isl_error_invalid,
285
6.51k
      "index out of bounds", return NULL);
286
6.51k
  
return 6.51k
FN6.51k
(EL,copy)(multi->p[pos]);
287
6.51k
}
isl_multi_union_pw_aff_get_union_pw_aff
Line
Count
Source
277
17.7k
{
278
17.7k
  isl_ctx *ctx;
279
17.7k
280
17.7k
  if (!multi)
281
0
    return NULL;
282
17.7k
  
ctx = 17.7k
FN17.7k
(MULTI(BASE),get_ctx)(multi);
283
17.7k
  if (
pos < 0 || 17.7k
pos >= multi->n17.7k
)
284
0
    isl_die(ctx, isl_error_invalid,
285
17.7k
      "index out of bounds", return NULL);
286
17.7k
  
return 17.7k
FN17.7k
(EL,copy)(multi->p[pos]);
287
17.7k
}
isl_multi_pw_aff_get_pw_aff
Line
Count
Source
277
12.6k
{
278
12.6k
  isl_ctx *ctx;
279
12.6k
280
12.6k
  if (!multi)
281
0
    return NULL;
282
12.6k
  
ctx = 12.6k
FN12.6k
(MULTI(BASE),get_ctx)(multi);
283
12.6k
  if (
pos < 0 || 12.6k
pos >= multi->n12.6k
)
284
0
    isl_die(ctx, isl_error_invalid,
285
12.6k
      "index out of bounds", return NULL);
286
12.6k
  
return 12.6k
FN12.6k
(EL,copy)(multi->p[pos]);
287
12.6k
}
isl_multi_aff_get_aff
Line
Count
Source
277
29.6k
{
278
29.6k
  isl_ctx *ctx;
279
29.6k
280
29.6k
  if (!multi)
281
0
    return NULL;
282
29.6k
  
ctx = 29.6k
FN29.6k
(MULTI(BASE),get_ctx)(multi);
283
29.6k
  if (
pos < 0 || 29.6k
pos >= multi->n29.6k
)
284
0
    isl_die(ctx, isl_error_invalid,
285
29.6k
      "index out of bounds", return NULL);
286
29.6k
  
return 29.6k
FN29.6k
(EL,copy)(multi->p[pos]);
287
29.6k
}
288
289
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),set),BASE)(
290
  __isl_take MULTI(BASE) *multi, int pos, __isl_take EL *el)
291
676k
{
292
676k
  isl_space *multi_space = NULL;
293
676k
  isl_space *el_space = NULL;
294
676k
  isl_bool match;
295
676k
296
676k
  multi = FN(MULTI(BASE),cow)(multi);
297
676k
  if (
!multi || 676k
!el676k
)
298
0
    goto error;
299
676k
300
676k
  
multi_space = 676k
FN676k
(MULTI(BASE),get_space)(multi);
301
676k
  match = FN(EL,matching_params)(el, multi_space);
302
676k
  if (match < 0)
303
0
    goto error;
304
676k
  
if (676k
!match676k
)
{0
305
0
    multi = FN(MULTI(BASE),align_params)(multi,
306
0
                FN(EL,get_space)(el));
307
0
    isl_space_free(multi_space);
308
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
309
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
310
676k
  }
311
676k
  if (
FN676k
(EL,check_match_domain_space)(el, multi_space) < 0676k
)
312
0
    goto error;
313
676k
314
676k
  
if (676k
pos < 0 || 676k
pos >= multi->n676k
)
315
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
316
676k
      "index out of bounds", goto error);
317
676k
318
676k
  
FN676k
(EL,free)(multi->p[pos]);676k
319
676k
  multi->p[pos] = el;
320
676k
321
676k
  isl_space_free(multi_space);
322
676k
  isl_space_free(el_space);
323
676k
324
676k
  return multi;
325
676k
error:
326
0
  FN(MULTI(BASE),free)(multi);
327
0
  FN(EL,free)(el);
328
0
  isl_space_free(multi_space);
329
0
  isl_space_free(el_space);
330
676k
  return NULL;
331
676k
}
isl_multi_val_set_val
Line
Count
Source
291
8.69k
{
292
8.69k
  isl_space *multi_space = NULL;
293
8.69k
  isl_space *el_space = NULL;
294
8.69k
  isl_bool match;
295
8.69k
296
8.69k
  multi = FN(MULTI(BASE),cow)(multi);
297
8.69k
  if (
!multi || 8.69k
!el8.69k
)
298
0
    goto error;
299
8.69k
300
8.69k
  
multi_space = 8.69k
FN8.69k
(MULTI(BASE),get_space)(multi);
301
8.69k
  match = FN(EL,matching_params)(el, multi_space);
302
8.69k
  if (match < 0)
303
0
    goto error;
304
8.69k
  
if (8.69k
!match8.69k
)
{0
305
0
    multi = FN(MULTI(BASE),align_params)(multi,
306
0
                FN(EL,get_space)(el));
307
0
    isl_space_free(multi_space);
308
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
309
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
310
8.69k
  }
311
8.69k
  if (
FN8.69k
(EL,check_match_domain_space)(el, multi_space) < 08.69k
)
312
0
    goto error;
313
8.69k
314
8.69k
  
if (8.69k
pos < 0 || 8.69k
pos >= multi->n8.69k
)
315
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
316
8.69k
      "index out of bounds", goto error);
317
8.69k
318
8.69k
  
FN8.69k
(EL,free)(multi->p[pos]);8.69k
319
8.69k
  multi->p[pos] = el;
320
8.69k
321
8.69k
  isl_space_free(multi_space);
322
8.69k
  isl_space_free(el_space);
323
8.69k
324
8.69k
  return multi;
325
8.69k
error:
326
0
  FN(MULTI(BASE),free)(multi);
327
0
  FN(EL,free)(el);
328
0
  isl_space_free(multi_space);
329
0
  isl_space_free(el_space);
330
8.69k
  return NULL;
331
8.69k
}
isl_multi_aff_set_aff
Line
Count
Source
291
646k
{
292
646k
  isl_space *multi_space = NULL;
293
646k
  isl_space *el_space = NULL;
294
646k
  isl_bool match;
295
646k
296
646k
  multi = FN(MULTI(BASE),cow)(multi);
297
646k
  if (
!multi || 646k
!el646k
)
298
0
    goto error;
299
646k
300
646k
  
multi_space = 646k
FN646k
(MULTI(BASE),get_space)(multi);
301
646k
  match = FN(EL,matching_params)(el, multi_space);
302
646k
  if (match < 0)
303
0
    goto error;
304
646k
  
if (646k
!match646k
)
{0
305
0
    multi = FN(MULTI(BASE),align_params)(multi,
306
0
                FN(EL,get_space)(el));
307
0
    isl_space_free(multi_space);
308
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
309
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
310
646k
  }
311
646k
  if (
FN646k
(EL,check_match_domain_space)(el, multi_space) < 0646k
)
312
0
    goto error;
313
646k
314
646k
  
if (646k
pos < 0 || 646k
pos >= multi->n646k
)
315
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
316
646k
      "index out of bounds", goto error);
317
646k
318
646k
  
FN646k
(EL,free)(multi->p[pos]);646k
319
646k
  multi->p[pos] = el;
320
646k
321
646k
  isl_space_free(multi_space);
322
646k
  isl_space_free(el_space);
323
646k
324
646k
  return multi;
325
646k
error:
326
0
  FN(MULTI(BASE),free)(multi);
327
0
  FN(EL,free)(el);
328
0
  isl_space_free(multi_space);
329
0
  isl_space_free(el_space);
330
646k
  return NULL;
331
646k
}
isl_multi_union_pw_aff_set_union_pw_aff
Line
Count
Source
291
8.38k
{
292
8.38k
  isl_space *multi_space = NULL;
293
8.38k
  isl_space *el_space = NULL;
294
8.38k
  isl_bool match;
295
8.38k
296
8.38k
  multi = FN(MULTI(BASE),cow)(multi);
297
8.38k
  if (
!multi || 8.38k
!el8.38k
)
298
0
    goto error;
299
8.38k
300
8.38k
  
multi_space = 8.38k
FN8.38k
(MULTI(BASE),get_space)(multi);
301
8.38k
  match = FN(EL,matching_params)(el, multi_space);
302
8.38k
  if (match < 0)
303
0
    goto error;
304
8.38k
  
if (8.38k
!match8.38k
)
{0
305
0
    multi = FN(MULTI(BASE),align_params)(multi,
306
0
                FN(EL,get_space)(el));
307
0
    isl_space_free(multi_space);
308
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
309
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
310
8.38k
  }
311
8.38k
  if (
FN8.38k
(EL,check_match_domain_space)(el, multi_space) < 08.38k
)
312
0
    goto error;
313
8.38k
314
8.38k
  
if (8.38k
pos < 0 || 8.38k
pos >= multi->n8.38k
)
315
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
316
8.38k
      "index out of bounds", goto error);
317
8.38k
318
8.38k
  
FN8.38k
(EL,free)(multi->p[pos]);8.38k
319
8.38k
  multi->p[pos] = el;
320
8.38k
321
8.38k
  isl_space_free(multi_space);
322
8.38k
  isl_space_free(el_space);
323
8.38k
324
8.38k
  return multi;
325
8.38k
error:
326
0
  FN(MULTI(BASE),free)(multi);
327
0
  FN(EL,free)(el);
328
0
  isl_space_free(multi_space);
329
0
  isl_space_free(el_space);
330
8.38k
  return NULL;
331
8.38k
}
isl_multi_pw_aff_set_pw_aff
Line
Count
Source
291
12.6k
{
292
12.6k
  isl_space *multi_space = NULL;
293
12.6k
  isl_space *el_space = NULL;
294
12.6k
  isl_bool match;
295
12.6k
296
12.6k
  multi = FN(MULTI(BASE),cow)(multi);
297
12.6k
  if (
!multi || 12.6k
!el12.6k
)
298
0
    goto error;
299
12.6k
300
12.6k
  
multi_space = 12.6k
FN12.6k
(MULTI(BASE),get_space)(multi);
301
12.6k
  match = FN(EL,matching_params)(el, multi_space);
302
12.6k
  if (match < 0)
303
0
    goto error;
304
12.6k
  
if (12.6k
!match12.6k
)
{0
305
0
    multi = FN(MULTI(BASE),align_params)(multi,
306
0
                FN(EL,get_space)(el));
307
0
    isl_space_free(multi_space);
308
0
    multi_space = FN(MULTI(BASE),get_space)(multi);
309
0
    el = FN(EL,align_params)(el, isl_space_copy(multi_space));
310
12.6k
  }
311
12.6k
  if (
FN12.6k
(EL,check_match_domain_space)(el, multi_space) < 012.6k
)
312
0
    goto error;
313
12.6k
314
12.6k
  
if (12.6k
pos < 0 || 12.6k
pos >= multi->n12.6k
)
315
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
316
12.6k
      "index out of bounds", goto error);
317
12.6k
318
12.6k
  
FN12.6k
(EL,free)(multi->p[pos]);12.6k
319
12.6k
  multi->p[pos] = el;
320
12.6k
321
12.6k
  isl_space_free(multi_space);
322
12.6k
  isl_space_free(el_space);
323
12.6k
324
12.6k
  return multi;
325
12.6k
error:
326
0
  FN(MULTI(BASE),free)(multi);
327
0
  FN(EL,free)(el);
328
0
  isl_space_free(multi_space);
329
0
  isl_space_free(el_space);
330
12.6k
  return NULL;
331
12.6k
}
332
333
/* Reset the space of "multi".  This function is called from isl_pw_templ.c
334
 * and doesn't know if the space of an element object is represented
335
 * directly or through its domain.  It therefore passes along both,
336
 * which we pass along to the element function since we don't how
337
 * that is represented either.
338
 */
339
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space_and_domain)(
340
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space,
341
  __isl_take isl_space *domain)
342
14.4k
{
343
14.4k
  int i;
344
14.4k
345
14.4k
  multi = FN(MULTI(BASE),cow)(multi);
346
14.4k
  if (
!multi || 14.4k
!space14.4k
||
!domain14.4k
)
347
0
    goto error;
348
14.4k
349
52.4k
  
for (i = 0; 14.4k
i < multi->n52.4k
;
++i37.9k
)
{37.9k
350
37.9k
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
351
37.9k
         isl_space_copy(domain));
352
37.9k
    if (!multi->p[i])
353
0
      goto error;
354
37.9k
  }
355
14.4k
  isl_space_free(domain);
356
14.4k
  isl_space_free(multi->space);
357
14.4k
  multi->space = space;
358
14.4k
359
14.4k
  return multi;
360
14.4k
error:
361
0
  isl_space_free(domain);
362
0
  isl_space_free(space);
363
0
  FN(MULTI(BASE),free)(multi);
364
14.4k
  return NULL;
365
14.4k
}
isl_multi_union_pw_aff_reset_space_and_domain
Line
Count
Source
342
123
{
343
123
  int i;
344
123
345
123
  multi = FN(MULTI(BASE),cow)(multi);
346
123
  if (
!multi || 123
!space123
||
!domain123
)
347
0
    goto error;
348
123
349
274
  
for (i = 0; 123
i < multi->n274
;
++i151
)
{151
350
151
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
351
151
         isl_space_copy(domain));
352
151
    if (!multi->p[i])
353
0
      goto error;
354
151
  }
355
123
  isl_space_free(domain);
356
123
  isl_space_free(multi->space);
357
123
  multi->space = space;
358
123
359
123
  return multi;
360
123
error:
361
0
  isl_space_free(domain);
362
0
  isl_space_free(space);
363
0
  FN(MULTI(BASE),free)(multi);
364
123
  return NULL;
365
123
}
isl_multi_pw_aff_reset_space_and_domain
Line
Count
Source
342
10.6k
{
343
10.6k
  int i;
344
10.6k
345
10.6k
  multi = FN(MULTI(BASE),cow)(multi);
346
10.6k
  if (
!multi || 10.6k
!space10.6k
||
!domain10.6k
)
347
0
    goto error;
348
10.6k
349
40.1k
  
for (i = 0; 10.6k
i < multi->n40.1k
;
++i29.5k
)
{29.5k
350
29.5k
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
351
29.5k
         isl_space_copy(domain));
352
29.5k
    if (!multi->p[i])
353
0
      goto error;
354
29.5k
  }
355
10.6k
  isl_space_free(domain);
356
10.6k
  isl_space_free(multi->space);
357
10.6k
  multi->space = space;
358
10.6k
359
10.6k
  return multi;
360
10.6k
error:
361
0
  isl_space_free(domain);
362
0
  isl_space_free(space);
363
0
  FN(MULTI(BASE),free)(multi);
364
10.6k
  return NULL;
365
10.6k
}
isl_multi_aff_reset_space_and_domain
Line
Count
Source
342
3.70k
{
343
3.70k
  int i;
344
3.70k
345
3.70k
  multi = FN(MULTI(BASE),cow)(multi);
346
3.70k
  if (
!multi || 3.70k
!space3.70k
||
!domain3.70k
)
347
0
    goto error;
348
3.70k
349
12.0k
  
for (i = 0; 3.70k
i < multi->n12.0k
;
++i8.31k
)
{8.31k
350
8.31k
    multi->p[i] = FN(EL,reset_domain_space)(multi->p[i],
351
8.31k
         isl_space_copy(domain));
352
8.31k
    if (!multi->p[i])
353
0
      goto error;
354
8.31k
  }
355
3.70k
  isl_space_free(domain);
356
3.70k
  isl_space_free(multi->space);
357
3.70k
  multi->space = space;
358
3.70k
359
3.70k
  return multi;
360
3.70k
error:
361
0
  isl_space_free(domain);
362
0
  isl_space_free(space);
363
0
  FN(MULTI(BASE),free)(multi);
364
3.70k
  return NULL;
365
3.70k
}
Unexecuted instantiation: isl_multi_val_reset_space_and_domain
366
367
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_domain_space)(
368
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *domain)
369
116
{
370
116
  isl_space *space;
371
116
372
116
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
373
116
            isl_space_copy(multi->space));
374
116
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
375
116
}
isl_multi_union_pw_aff_reset_domain_space
Line
Count
Source
369
106
{
370
106
  isl_space *space;
371
106
372
106
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
373
106
            isl_space_copy(multi->space));
374
106
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
375
106
}
Unexecuted instantiation: isl_multi_val_reset_domain_space
isl_multi_aff_reset_domain_space
Line
Count
Source
369
10
{
370
10
  isl_space *space;
371
10
372
10
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
373
10
            isl_space_copy(multi->space));
374
10
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
375
10
}
Unexecuted instantiation: isl_multi_pw_aff_reset_domain_space
376
377
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space)(
378
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
379
12.5k
{
380
12.5k
  isl_space *domain;
381
12.5k
382
12.5k
  domain = isl_space_domain(isl_space_copy(space));
383
12.5k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
384
12.5k
}
isl_multi_aff_reset_space
Line
Count
Source
379
1.84k
{
380
1.84k
  isl_space *domain;
381
1.84k
382
1.84k
  domain = isl_space_domain(isl_space_copy(space));
383
1.84k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
384
1.84k
}
isl_multi_pw_aff_reset_space
Line
Count
Source
379
10.6k
{
380
10.6k
  isl_space *domain;
381
10.6k
382
10.6k
  domain = isl_space_domain(isl_space_copy(space));
383
10.6k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
384
10.6k
}
isl_multi_union_pw_aff_reset_space
Line
Count
Source
379
17
{
380
17
  isl_space *domain;
381
17
382
17
  domain = isl_space_domain(isl_space_copy(space));
383
17
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
384
17
}
Unexecuted instantiation: isl_multi_val_reset_space
385
386
/* Set the id of the given dimension of "multi" to "id".
387
 */
388
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_id)(
389
  __isl_take MULTI(BASE) *multi,
390
  enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
391
10.6k
{
392
10.6k
  isl_space *space;
393
10.6k
394
10.6k
  multi = FN(MULTI(BASE),cow)(multi);
395
10.6k
  if (
!multi || 10.6k
!id10.6k
)
396
0
    goto error;
397
10.6k
398
10.6k
  
space = 10.6k
FN10.6k
(MULTI(BASE),get_space)(multi);
399
10.6k
  space = isl_space_set_dim_id(space, type, pos, id);
400
10.6k
401
10.6k
  return FN(MULTI(BASE),reset_space)(multi, space);
402
10.6k
error:
403
0
  isl_id_free(id);
404
0
  FN(MULTI(BASE),free)(multi);
405
10.6k
  return NULL;
406
10.6k
}
Unexecuted instantiation: isl_multi_union_pw_aff_set_dim_id
Unexecuted instantiation: isl_multi_aff_set_dim_id
Unexecuted instantiation: isl_multi_val_set_dim_id
isl_multi_pw_aff_set_dim_id
Line
Count
Source
391
10.6k
{
392
10.6k
  isl_space *space;
393
10.6k
394
10.6k
  multi = FN(MULTI(BASE),cow)(multi);
395
10.6k
  if (
!multi || 10.6k
!id10.6k
)
396
0
    goto error;
397
10.6k
398
10.6k
  
space = 10.6k
FN10.6k
(MULTI(BASE),get_space)(multi);
399
10.6k
  space = isl_space_set_dim_id(space, type, pos, id);
400
10.6k
401
10.6k
  return FN(MULTI(BASE),reset_space)(multi, space);
402
10.6k
error:
403
0
  isl_id_free(id);
404
0
  FN(MULTI(BASE),free)(multi);
405
10.6k
  return NULL;
406
10.6k
}
407
408
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_name)(
409
  __isl_keep MULTI(BASE) *multi, enum isl_dim_type type,
410
  const char *s)
411
0
{
412
0
  isl_space *space;
413
0
414
0
  multi = FN(MULTI(BASE),cow)(multi);
415
0
  if (!multi)
416
0
    return NULL;
417
0
418
0
  
space = 0
FN0
(MULTI(BASE),get_space)(multi);
419
0
  space = isl_space_set_tuple_name(space, type, s);
420
0
421
0
  return FN(MULTI(BASE),reset_space)(multi, space);
422
0
}
Unexecuted instantiation: isl_multi_aff_set_tuple_name
Unexecuted instantiation: isl_multi_pw_aff_set_tuple_name
Unexecuted instantiation: isl_multi_val_set_tuple_name
Unexecuted instantiation: isl_multi_union_pw_aff_set_tuple_name
423
424
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_id)(
425
  __isl_take MULTI(BASE) *multi, enum isl_dim_type type,
426
  __isl_take isl_id *id)
427
90
{
428
90
  isl_space *space;
429
90
430
90
  multi = FN(MULTI(BASE),cow)(multi);
431
90
  if (!multi)
432
0
    goto error;
433
90
434
90
  
space = 90
FN90
(MULTI(BASE),get_space)(multi);
435
90
  space = isl_space_set_tuple_id(space, type, id);
436
90
437
90
  return FN(MULTI(BASE),reset_space)(multi, space);
438
90
error:
439
0
  isl_id_free(id);
440
90
  return NULL;
441
90
}
isl_multi_aff_set_tuple_id
Line
Count
Source
427
87
{
428
87
  isl_space *space;
429
87
430
87
  multi = FN(MULTI(BASE),cow)(multi);
431
87
  if (!multi)
432
0
    goto error;
433
87
434
87
  
space = 87
FN87
(MULTI(BASE),get_space)(multi);
435
87
  space = isl_space_set_tuple_id(space, type, id);
436
87
437
87
  return FN(MULTI(BASE),reset_space)(multi, space);
438
87
error:
439
0
  isl_id_free(id);
440
87
  return NULL;
441
87
}
Unexecuted instantiation: isl_multi_pw_aff_set_tuple_id
Unexecuted instantiation: isl_multi_val_set_tuple_id
isl_multi_union_pw_aff_set_tuple_id
Line
Count
Source
427
3
{
428
3
  isl_space *space;
429
3
430
3
  multi = FN(MULTI(BASE),cow)(multi);
431
3
  if (!multi)
432
0
    goto error;
433
3
434
3
  
space = 3
FN3
(MULTI(BASE),get_space)(multi);
435
3
  space = isl_space_set_tuple_id(space, type, id);
436
3
437
3
  return FN(MULTI(BASE),reset_space)(multi, space);
438
3
error:
439
0
  isl_id_free(id);
440
3
  return NULL;
441
3
}
442
443
/* Drop the id on the specified tuple.
444
 */
445
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_tuple_id)(
446
  __isl_take MULTI(BASE) *multi, enum isl_dim_type type)
447
2.24k
{
448
2.24k
  isl_space *space;
449
2.24k
450
2.24k
  if (!multi)
451
0
    return NULL;
452
2.24k
  
if (2.24k
!2.24k
FN2.24k
(MULTI(BASE),has_tuple_id)(multi, type))
453
2.22k
    return multi;
454
2.24k
455
14
  
multi = 14
FN14
(MULTI(BASE),cow)(multi);
456
14
  if (!multi)
457
0
    return NULL;
458
14
459
14
  
space = 14
FN14
(MULTI(BASE),get_space)(multi);
460
14
  space = isl_space_reset_tuple_id(space, type);
461
14
462
14
  return FN(MULTI(BASE),reset_space)(multi, space);
463
2.24k
}
Unexecuted instantiation: isl_multi_pw_aff_reset_tuple_id
Unexecuted instantiation: isl_multi_aff_reset_tuple_id
Unexecuted instantiation: isl_multi_val_reset_tuple_id
isl_multi_union_pw_aff_reset_tuple_id
Line
Count
Source
447
2.24k
{
448
2.24k
  isl_space *space;
449
2.24k
450
2.24k
  if (!multi)
451
0
    return NULL;
452
2.24k
  
if (2.24k
!2.24k
FN2.24k
(MULTI(BASE),has_tuple_id)(multi, type))
453
2.22k
    return multi;
454
2.24k
455
14
  
multi = 14
FN14
(MULTI(BASE),cow)(multi);
456
14
  if (!multi)
457
0
    return NULL;
458
14
459
14
  
space = 14
FN14
(MULTI(BASE),get_space)(multi);
460
14
  space = isl_space_reset_tuple_id(space, type);
461
14
462
14
  return FN(MULTI(BASE),reset_space)(multi, space);
463
2.24k
}
464
465
/* Reset the user pointer on all identifiers of parameters and tuples
466
 * of the space of "multi".
467
 */
468
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_user)(
469
  __isl_take MULTI(BASE) *multi)
470
0
{
471
0
  isl_space *space;
472
0
473
0
  space = FN(MULTI(BASE),get_space)(multi);
474
0
  space = isl_space_reset_user(space);
475
0
476
0
  return FN(MULTI(BASE),reset_space)(multi, space);
477
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_reset_user
Unexecuted instantiation: isl_multi_pw_aff_reset_user
Unexecuted instantiation: isl_multi_val_reset_user
Unexecuted instantiation: isl_multi_aff_reset_user
478
479
__isl_give MULTI(BASE) *FN(MULTI(BASE),realign_domain)(
480
  __isl_take MULTI(BASE) *multi, __isl_take isl_reordering *exp)
481
116
{
482
116
  int i;
483
116
484
116
  multi = FN(MULTI(BASE),cow)(multi);
485
116
  if (
!multi || 116
!exp116
)
486
0
    goto error;
487
116
488
222
  
for (i = 0; 116
i < multi->n222
;
++i106
)
{106
489
106
    multi->p[i] = FN(EL,realign_domain)(multi->p[i],
490
106
            isl_reordering_copy(exp));
491
106
    if (!multi->p[i])
492
0
      goto error;
493
116
  }
494
116
495
116
  
multi = 116
FN116
(MULTI(BASE),reset_domain_space)(multi,
496
116
                isl_space_copy(exp->dim));
497
116
498
116
  isl_reordering_free(exp);
499
116
  return multi;
500
116
error:
501
0
  isl_reordering_free(exp);
502
0
  FN(MULTI(BASE),free)(multi);
503
116
  return NULL;
504
116
}
Unexecuted instantiation: isl_multi_pw_aff_realign_domain
isl_multi_union_pw_aff_realign_domain
Line
Count
Source
481
106
{
482
106
  int i;
483
106
484
106
  multi = FN(MULTI(BASE),cow)(multi);
485
106
  if (
!multi || 106
!exp106
)
486
0
    goto error;
487
106
488
212
  
for (i = 0; 106
i < multi->n212
;
++i106
)
{106
489
106
    multi->p[i] = FN(EL,realign_domain)(multi->p[i],
490
106
            isl_reordering_copy(exp));
491
106
    if (!multi->p[i])
492
0
      goto error;
493
106
  }
494
106
495
106
  
multi = 106
FN106
(MULTI(BASE),reset_domain_space)(multi,
496
106
                isl_space_copy(exp->dim));
497
106
498
106
  isl_reordering_free(exp);
499
106
  return multi;
500
106
error:
501
0
  isl_reordering_free(exp);
502
0
  FN(MULTI(BASE),free)(multi);
503
106
  return NULL;
504
106
}
Unexecuted instantiation: isl_multi_val_realign_domain
isl_multi_aff_realign_domain
Line
Count
Source
481
10
{
482
10
  int i;
483
10
484
10
  multi = FN(MULTI(BASE),cow)(multi);
485
10
  if (
!multi || 10
!exp10
)
486
0
    goto error;
487
10
488
10
  
for (i = 0; 10
i < multi->n10
;
++i0
)
{0
489
0
    multi->p[i] = FN(EL,realign_domain)(multi->p[i],
490
0
            isl_reordering_copy(exp));
491
0
    if (!multi->p[i])
492
0
      goto error;
493
10
  }
494
10
495
10
  
multi = 10
FN10
(MULTI(BASE),reset_domain_space)(multi,
496
10
                isl_space_copy(exp->dim));
497
10
498
10
  isl_reordering_free(exp);
499
10
  return multi;
500
10
error:
501
0
  isl_reordering_free(exp);
502
0
  FN(MULTI(BASE),free)(multi);
503
10
  return NULL;
504
10
}
505
506
/* Align the parameters of "multi" to those of "model".
507
 */
508
__isl_give MULTI(BASE) *FN(MULTI(BASE),align_params)(
509
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *model)
510
2.48k
{
511
2.48k
  isl_ctx *ctx;
512
2.48k
  isl_bool equal_params;
513
2.48k
  isl_reordering *exp;
514
2.48k
515
2.48k
  if (
!multi || 2.48k
!model2.48k
)
516
0
    goto error;
517
2.48k
518
2.48k
  equal_params = isl_space_has_equal_params(multi->space, model);
519
2.48k
  if (equal_params < 0)
520
0
    goto error;
521
2.48k
  
if (2.48k
equal_params2.48k
)
{2.37k
522
2.37k
    isl_space_free(model);
523
2.37k
    return multi;
524
2.48k
  }
525
2.48k
526
2.48k
  ctx = isl_space_get_ctx(model);
527
116
  if (!isl_space_has_named_params(model))
528
0
    isl_die(ctx, isl_error_invalid,
529
116
      "model has unnamed parameters", goto error);
530
116
  
if (116
!isl_space_has_named_params(multi->space)116
)
531
0
    isl_die(ctx, isl_error_invalid,
532
116
      "input has unnamed parameters", goto error);
533
116
534
116
  model = isl_space_params(model);
535
116
  exp = isl_parameter_alignment_reordering(multi->space, model);
536
116
  exp = isl_reordering_extend_space(exp,
537
116
            FN(MULTI(BASE),get_domain_space)(multi));
538
116
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
539
116
540
116
  isl_space_free(model);
541
116
  return multi;
542
116
error:
543
0
  isl_space_free(model);
544
0
  FN(MULTI(BASE),free)(multi);
545
116
  return NULL;
546
2.48k
}
isl_multi_union_pw_aff_align_params
Line
Count
Source
510
901
{
511
901
  isl_ctx *ctx;
512
901
  isl_bool equal_params;
513
901
  isl_reordering *exp;
514
901
515
901
  if (
!multi || 901
!model901
)
516
0
    goto error;
517
901
518
901
  equal_params = isl_space_has_equal_params(multi->space, model);
519
901
  if (equal_params < 0)
520
0
    goto error;
521
901
  
if (901
equal_params901
)
{795
522
795
    isl_space_free(model);
523
795
    return multi;
524
901
  }
525
901
526
901
  ctx = isl_space_get_ctx(model);
527
106
  if (!isl_space_has_named_params(model))
528
0
    isl_die(ctx, isl_error_invalid,
529
106
      "model has unnamed parameters", goto error);
530
106
  
if (106
!isl_space_has_named_params(multi->space)106
)
531
0
    isl_die(ctx, isl_error_invalid,
532
106
      "input has unnamed parameters", goto error);
533
106
534
106
  model = isl_space_params(model);
535
106
  exp = isl_parameter_alignment_reordering(multi->space, model);
536
106
  exp = isl_reordering_extend_space(exp,
537
106
            FN(MULTI(BASE),get_domain_space)(multi));
538
106
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
539
106
540
106
  isl_space_free(model);
541
106
  return multi;
542
106
error:
543
0
  isl_space_free(model);
544
0
  FN(MULTI(BASE),free)(multi);
545
106
  return NULL;
546
901
}
isl_multi_pw_aff_align_params
Line
Count
Source
510
4
{
511
4
  isl_ctx *ctx;
512
4
  isl_bool equal_params;
513
4
  isl_reordering *exp;
514
4
515
4
  if (
!multi || 4
!model4
)
516
0
    goto error;
517
4
518
4
  equal_params = isl_space_has_equal_params(multi->space, model);
519
4
  if (equal_params < 0)
520
0
    goto error;
521
4
  
if (4
equal_params4
)
{4
522
4
    isl_space_free(model);
523
4
    return multi;
524
4
  }
525
4
526
4
  ctx = isl_space_get_ctx(model);
527
0
  if (!isl_space_has_named_params(model))
528
0
    isl_die(ctx, isl_error_invalid,
529
0
      "model has unnamed parameters", goto error);
530
0
  
if (0
!isl_space_has_named_params(multi->space)0
)
531
0
    isl_die(ctx, isl_error_invalid,
532
0
      "input has unnamed parameters", goto error);
533
0
534
0
  model = isl_space_params(model);
535
0
  exp = isl_parameter_alignment_reordering(multi->space, model);
536
0
  exp = isl_reordering_extend_space(exp,
537
0
            FN(MULTI(BASE),get_domain_space)(multi));
538
0
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
539
0
540
0
  isl_space_free(model);
541
0
  return multi;
542
0
error:
543
0
  isl_space_free(model);
544
0
  FN(MULTI(BASE),free)(multi);
545
0
  return NULL;
546
4
}
Unexecuted instantiation: isl_multi_val_align_params
isl_multi_aff_align_params
Line
Count
Source
510
1.58k
{
511
1.58k
  isl_ctx *ctx;
512
1.58k
  isl_bool equal_params;
513
1.58k
  isl_reordering *exp;
514
1.58k
515
1.58k
  if (
!multi || 1.58k
!model1.58k
)
516
0
    goto error;
517
1.58k
518
1.58k
  equal_params = isl_space_has_equal_params(multi->space, model);
519
1.58k
  if (equal_params < 0)
520
0
    goto error;
521
1.58k
  
if (1.58k
equal_params1.58k
)
{1.57k
522
1.57k
    isl_space_free(model);
523
1.57k
    return multi;
524
1.58k
  }
525
1.58k
526
1.58k
  ctx = isl_space_get_ctx(model);
527
10
  if (!isl_space_has_named_params(model))
528
0
    isl_die(ctx, isl_error_invalid,
529
10
      "model has unnamed parameters", goto error);
530
10
  
if (10
!isl_space_has_named_params(multi->space)10
)
531
0
    isl_die(ctx, isl_error_invalid,
532
10
      "input has unnamed parameters", goto error);
533
10
534
10
  model = isl_space_params(model);
535
10
  exp = isl_parameter_alignment_reordering(multi->space, model);
536
10
  exp = isl_reordering_extend_space(exp,
537
10
            FN(MULTI(BASE),get_domain_space)(multi));
538
10
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
539
10
540
10
  isl_space_free(model);
541
10
  return multi;
542
10
error:
543
0
  isl_space_free(model);
544
0
  FN(MULTI(BASE),free)(multi);
545
10
  return NULL;
546
1.58k
}
547
548
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),LIST(BASE))(
549
  __isl_take isl_space *space, __isl_take LIST(EL) *list)
550
4.97k
{
551
4.97k
  int i;
552
4.97k
  int n;
553
4.97k
  isl_ctx *ctx;
554
4.97k
  MULTI(BASE) *multi;
555
4.97k
556
4.97k
  if (
!space || 4.97k
!list4.97k
)
557
2
    goto error;
558
4.97k
559
4.97k
  ctx = isl_space_get_ctx(space);
560
4.97k
  n = FN(FN(LIST(EL),n),BASE)(list);
561
4.97k
  if (n != isl_space_dim(space, isl_dim_out))
562
0
    isl_die(ctx, isl_error_invalid,
563
4.97k
      "invalid number of elements in list", goto error);
564
4.97k
565
4.97k
  
multi = 4.97k
FN4.97k
(MULTI(BASE),alloc)(isl_space_copy(space));
566
12.1k
  for (i = 0; 
i < n12.1k
;
++i7.17k
)
{7.17k
567
7.17k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
568
7.17k
          FN(FN(LIST(EL),get),BASE)(list, i));
569
7.17k
  }
570
4.97k
571
4.97k
  isl_space_free(space);
572
4.97k
  FN(LIST(EL),free)(list);
573
4.97k
  return multi;
574
4.97k
error:
575
2
  isl_space_free(space);
576
2
  FN(LIST(EL),free)(list);
577
4.97k
  return NULL;
578
4.97k
}
isl_multi_union_pw_aff_from_union_pw_aff_list
Line
Count
Source
550
15
{
551
15
  int i;
552
15
  int n;
553
15
  isl_ctx *ctx;
554
15
  MULTI(BASE) *multi;
555
15
556
15
  if (
!space || 15
!list15
)
557
0
    goto error;
558
15
559
15
  ctx = isl_space_get_ctx(space);
560
15
  n = FN(FN(LIST(EL),n),BASE)(list);
561
15
  if (n != isl_space_dim(space, isl_dim_out))
562
0
    isl_die(ctx, isl_error_invalid,
563
15
      "invalid number of elements in list", goto error);
564
15
565
15
  
multi = 15
FN15
(MULTI(BASE),alloc)(isl_space_copy(space));
566
42
  for (i = 0; 
i < n42
;
++i27
)
{27
567
27
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
568
27
          FN(FN(LIST(EL),get),BASE)(list, i));
569
27
  }
570
15
571
15
  isl_space_free(space);
572
15
  FN(LIST(EL),free)(list);
573
15
  return multi;
574
15
error:
575
0
  isl_space_free(space);
576
0
  FN(LIST(EL),free)(list);
577
15
  return NULL;
578
15
}
isl_multi_pw_aff_from_pw_aff_list
Line
Count
Source
550
4.95k
{
551
4.95k
  int i;
552
4.95k
  int n;
553
4.95k
  isl_ctx *ctx;
554
4.95k
  MULTI(BASE) *multi;
555
4.95k
556
4.95k
  if (
!space || 4.95k
!list4.95k
)
557
2
    goto error;
558
4.95k
559
4.95k
  ctx = isl_space_get_ctx(space);
560
4.95k
  n = FN(FN(LIST(EL),n),BASE)(list);
561
4.95k
  if (n != isl_space_dim(space, isl_dim_out))
562
0
    isl_die(ctx, isl_error_invalid,
563
4.95k
      "invalid number of elements in list", goto error);
564
4.95k
565
4.95k
  
multi = 4.95k
FN4.95k
(MULTI(BASE),alloc)(isl_space_copy(space));
566
12.0k
  for (i = 0; 
i < n12.0k
;
++i7.12k
)
{7.12k
567
7.12k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
568
7.12k
          FN(FN(LIST(EL),get),BASE)(list, i));
569
7.12k
  }
570
4.95k
571
4.95k
  isl_space_free(space);
572
4.95k
  FN(LIST(EL),free)(list);
573
4.95k
  return multi;
574
4.95k
error:
575
2
  isl_space_free(space);
576
2
  FN(LIST(EL),free)(list);
577
4.95k
  return NULL;
578
4.95k
}
isl_multi_val_from_val_list
Line
Count
Source
550
11
{
551
11
  int i;
552
11
  int n;
553
11
  isl_ctx *ctx;
554
11
  MULTI(BASE) *multi;
555
11
556
11
  if (
!space || 11
!list11
)
557
0
    goto error;
558
11
559
11
  ctx = isl_space_get_ctx(space);
560
11
  n = FN(FN(LIST(EL),n),BASE)(list);
561
11
  if (n != isl_space_dim(space, isl_dim_out))
562
0
    isl_die(ctx, isl_error_invalid,
563
11
      "invalid number of elements in list", goto error);
564
11
565
11
  
multi = 11
FN11
(MULTI(BASE),alloc)(isl_space_copy(space));
566
32
  for (i = 0; 
i < n32
;
++i21
)
{21
567
21
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
568
21
          FN(FN(LIST(EL),get),BASE)(list, i));
569
21
  }
570
11
571
11
  isl_space_free(space);
572
11
  FN(LIST(EL),free)(list);
573
11
  return multi;
574
11
error:
575
0
  isl_space_free(space);
576
0
  FN(LIST(EL),free)(list);
577
11
  return NULL;
578
11
}
Unexecuted instantiation: isl_multi_aff_from_aff_list
579
580
#ifndef NO_IDENTITY
581
/* Create a multi expression in the given space that maps each
582
 * input dimension to the corresponding output dimension.
583
 */
584
__isl_give MULTI(BASE) *FN(MULTI(BASE),identity)(__isl_take isl_space *space)
585
4.59k
{
586
4.59k
  int i, n;
587
4.59k
  isl_local_space *ls;
588
4.59k
  MULTI(BASE) *multi;
589
4.59k
590
4.59k
  if (!space)
591
0
    return NULL;
592
4.59k
593
4.59k
  
if (4.59k
isl_space_is_set(space)4.59k
)
594
0
    isl_die(isl_space_get_ctx(space), isl_error_invalid,
595
4.59k
      "expecting map space", goto error);
596
4.59k
597
4.59k
  n = isl_space_dim(space, isl_dim_out);
598
4.59k
  if (n != isl_space_dim(space, isl_dim_in))
599
0
    isl_die(isl_space_get_ctx(space), isl_error_invalid,
600
4.59k
      "number of input and output dimensions needs to be "
601
4.59k
      "the same", goto error);
602
4.59k
603
4.59k
  
multi = 4.59k
FN4.59k
(MULTI(BASE),alloc)(isl_space_copy(space));
604
4.59k
605
4.59k
  if (
!n4.59k
)
{1.99k
606
1.99k
    isl_space_free(space);
607
1.99k
    return multi;
608
4.59k
  }
609
4.59k
610
4.59k
  space = isl_space_domain(space);
611
2.60k
  ls = isl_local_space_from_space(space);
612
2.60k
613
14.2k
  for (i = 0; 
i < n14.2k
;
++i11.6k
)
{11.6k
614
11.6k
    EL *el;
615
11.6k
    el = FN(EL,var_on_domain)(isl_local_space_copy(ls),
616
11.6k
            isl_dim_set, i);
617
11.6k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el);
618
11.6k
  }
619
2.60k
620
2.60k
  isl_local_space_free(ls);
621
2.60k
622
4.59k
  return multi;
623
4.59k
error:
624
0
  isl_space_free(space);
625
4.59k
  return NULL;
626
4.59k
}
Unexecuted instantiation: isl_multi_pw_aff_identity
isl_multi_aff_identity
Line
Count
Source
585
4.59k
{
586
4.59k
  int i, n;
587
4.59k
  isl_local_space *ls;
588
4.59k
  MULTI(BASE) *multi;
589
4.59k
590
4.59k
  if (!space)
591
0
    return NULL;
592
4.59k
593
4.59k
  
if (4.59k
isl_space_is_set(space)4.59k
)
594
0
    isl_die(isl_space_get_ctx(space), isl_error_invalid,
595
4.59k
      "expecting map space", goto error);
596
4.59k
597
4.59k
  n = isl_space_dim(space, isl_dim_out);
598
4.59k
  if (n != isl_space_dim(space, isl_dim_in))
599
0
    isl_die(isl_space_get_ctx(space), isl_error_invalid,
600
4.59k
      "number of input and output dimensions needs to be "
601
4.59k
      "the same", goto error);
602
4.59k
603
4.59k
  
multi = 4.59k
FN4.59k
(MULTI(BASE),alloc)(isl_space_copy(space));
604
4.59k
605
4.59k
  if (
!n4.59k
)
{1.99k
606
1.99k
    isl_space_free(space);
607
1.99k
    return multi;
608
4.59k
  }
609
4.59k
610
4.59k
  space = isl_space_domain(space);
611
2.60k
  ls = isl_local_space_from_space(space);
612
2.60k
613
14.2k
  for (i = 0; 
i < n14.2k
;
++i11.6k
)
{11.6k
614
11.6k
    EL *el;
615
11.6k
    el = FN(EL,var_on_domain)(isl_local_space_copy(ls),
616
11.6k
            isl_dim_set, i);
617
11.6k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el);
618
11.6k
  }
619
2.60k
620
2.60k
  isl_local_space_free(ls);
621
2.60k
622
4.59k
  return multi;
623
4.59k
error:
624
0
  isl_space_free(space);
625
4.59k
  return NULL;
626
4.59k
}
627
#endif
628
629
#ifndef NO_ZERO
630
/* Construct a multi expression in the given space with value zero in
631
 * each of the output dimensions.
632
 */
633
__isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space)
634
4.79k
{
635
4.79k
  int n;
636
4.79k
  MULTI(BASE) *multi;
637
4.79k
638
4.79k
  if (!space)
639
0
    return NULL;
640
4.79k
641
4.79k
  n = isl_space_dim(space , isl_dim_out);
642
4.79k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
643
4.79k
644
4.79k
  if (!n)
645
1.17k
    isl_space_free(space);
646
4.79k
  else {
647
3.62k
    int i;
648
3.62k
    isl_local_space *ls;
649
3.62k
    EL *el;
650
3.62k
651
3.62k
    space = isl_space_domain(space);
652
3.62k
    ls = isl_local_space_from_space(space);
653
3.62k
    el = FN(EL,zero_on_domain)(ls);
654
3.62k
655
8.86k
    for (i = 0; 
i < n8.86k
;
++i5.23k
)
656
5.23k
      
multi = 5.23k
FN5.23k
(FN(MULTI(BASE),set),BASE)(multi, i,
657
5.23k
                  FN(EL,copy)(el));
658
3.62k
659
3.62k
    FN(EL,free)(el);
660
4.79k
  }
661
4.79k
662
4.79k
  return multi;
663
4.79k
}
isl_multi_aff_zero
Line
Count
Source
634
2.44k
{
635
2.44k
  int n;
636
2.44k
  MULTI(BASE) *multi;
637
2.44k
638
2.44k
  if (!space)
639
0
    return NULL;
640
2.44k
641
2.44k
  n = isl_space_dim(space , isl_dim_out);
642
2.44k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
643
2.44k
644
2.44k
  if (!n)
645
1.15k
    isl_space_free(space);
646
2.44k
  else {
647
1.29k
    int i;
648
1.29k
    isl_local_space *ls;
649
1.29k
    EL *el;
650
1.29k
651
1.29k
    space = isl_space_domain(space);
652
1.29k
    ls = isl_local_space_from_space(space);
653
1.29k
    el = FN(EL,zero_on_domain)(ls);
654
1.29k
655
3.10k
    for (i = 0; 
i < n3.10k
;
++i1.81k
)
656
1.81k
      
multi = 1.81k
FN1.81k
(FN(MULTI(BASE),set),BASE)(multi, i,
657
1.81k
                  FN(EL,copy)(el));
658
1.29k
659
1.29k
    FN(EL,free)(el);
660
2.44k
  }
661
2.44k
662
2.44k
  return multi;
663
2.44k
}
Unexecuted instantiation: isl_multi_pw_aff_zero
isl_multi_val_zero
Line
Count
Source
634
2.35k
{
635
2.35k
  int n;
636
2.35k
  MULTI(BASE) *multi;
637
2.35k
638
2.35k
  if (!space)
639
0
    return NULL;
640
2.35k
641
2.35k
  n = isl_space_dim(space , isl_dim_out);
642
2.35k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
643
2.35k
644
2.35k
  if (!n)
645
25
    isl_space_free(space);
646
2.35k
  else {
647
2.33k
    int i;
648
2.33k
    isl_local_space *ls;
649
2.33k
    EL *el;
650
2.33k
651
2.33k
    space = isl_space_domain(space);
652
2.33k
    ls = isl_local_space_from_space(space);
653
2.33k
    el = FN(EL,zero_on_domain)(ls);
654
2.33k
655
5.75k
    for (i = 0; 
i < n5.75k
;
++i3.42k
)
656
3.42k
      
multi = 3.42k
FN3.42k
(FN(MULTI(BASE),set),BASE)(multi, i,
657
3.42k
                  FN(EL,copy)(el));
658
2.33k
659
2.33k
    FN(EL,free)(el);
660
2.35k
  }
661
2.35k
662
2.35k
  return multi;
663
2.35k
}
664
#endif
665
666
#ifndef NO_FROM_BASE
667
/* Create a multiple expression with a single output/set dimension
668
 * equal to "el".
669
 * For most multiple expression types, the base type has a single
670
 * output/set dimension and the space of the result is therefore
671
 * the same as the space of the input.
672
 * In the case of isl_multi_union_pw_aff, however, the base type
673
 * lives in a parameter space and we therefore need to add
674
 * a single set dimension.
675
 */
676
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el)
677
253
{
678
253
  isl_space *space;
679
253
  MULTI(BASE) *multi;
680
253
681
253
  space = FN(EL,get_space(el));
682
253
  if (
isl_space_is_params(space)253
)
{0
683
0
    space = isl_space_set_from_params(space);
684
0
    space = isl_space_add_dims(space, isl_dim_set, 1);
685
253
  }
686
253
  multi = FN(MULTI(BASE),alloc)(space);
687
253
  multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
688
253
689
253
  return multi;
690
253
}
Unexecuted instantiation: isl_multi_union_pw_aff_from_union_pw_aff
Unexecuted instantiation: isl_multi_pw_aff_from_pw_aff
isl_multi_aff_from_aff
Line
Count
Source
677
253
{
678
253
  isl_space *space;
679
253
  MULTI(BASE) *multi;
680
253
681
253
  space = FN(EL,get_space(el));
682
253
  if (
isl_space_is_params(space)253
)
{0
683
0
    space = isl_space_set_from_params(space);
684
0
    space = isl_space_add_dims(space, isl_dim_set, 1);
685
253
  }
686
253
  multi = FN(MULTI(BASE),alloc)(space);
687
253
  multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
688
253
689
253
  return multi;
690
253
}
691
#endif
692
693
__isl_give MULTI(BASE) *FN(MULTI(BASE),drop_dims)(
694
  __isl_take MULTI(BASE) *multi,
695
  enum isl_dim_type type, unsigned first, unsigned n)
696
1.12k
{
697
1.12k
  int i;
698
1.12k
  unsigned dim;
699
1.12k
700
1.12k
  multi = FN(MULTI(BASE),cow)(multi);
701
1.12k
  if (!multi)
702
0
    return NULL;
703
1.12k
704
1.12k
  
dim = 1.12k
FN1.12k
(MULTI(BASE),dim)(multi, type);
705
1.12k
  if (
first + n > dim || 1.12k
first + n < first1.12k
)
706
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
707
1.12k
      "index out of bounds",
708
1.12k
      return FN(MULTI(BASE),free)(multi));
709
1.12k
710
1.12k
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
711
1.12k
  if (!multi->space)
712
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
713
1.12k
714
1.12k
  
if (1.12k
type == isl_dim_out1.12k
)
{987
715
2.02k
    for (i = 0; 
i < n2.02k
;
++i1.03k
)
716
1.03k
      
FN1.03k
(EL,free)(multi->p[first + i])1.03k
;
717
1.79k
    for (i = first; 
i + n < multi->n1.79k
;
++i803
)
718
803
      multi->p[i] = multi->p[i + n];
719
987
    multi->n -= n;
720
987
721
987
    return multi;
722
1.12k
  }
723
1.12k
724
536
  
for (i = 0; 136
i < multi->n536
;
++i400
)
{400
725
400
    multi->p[i] = FN(EL,drop_dims)(multi->p[i], type, first, n);
726
400
    if (!multi->p[i])
727
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
728
400
  }
729
136
730
136
  return multi;
731
1.12k
}
isl_multi_union_pw_aff_drop_dims
Line
Count
Source
696
66
{
697
66
  int i;
698
66
  unsigned dim;
699
66
700
66
  multi = FN(MULTI(BASE),cow)(multi);
701
66
  if (!multi)
702
0
    return NULL;
703
66
704
66
  
dim = 66
FN66
(MULTI(BASE),dim)(multi, type);
705
66
  if (
first + n > dim || 66
first + n < first66
)
706
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
707
66
      "index out of bounds",
708
66
      return FN(MULTI(BASE),free)(multi));
709
66
710
66
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
711
66
  if (!multi->space)
712
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
713
66
714
66
  
if (66
type == isl_dim_out66
)
{66
715
150
    for (i = 0; 
i < n150
;
++i84
)
716
84
      
FN84
(EL,free)(multi->p[first + i])84
;
717
105
    for (i = first; 
i + n < multi->n105
;
++i39
)
718
39
      multi->p[i] = multi->p[i + n];
719
66
    multi->n -= n;
720
66
721
66
    return multi;
722
66
  }
723
66
724
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
725
0
    multi->p[i] = FN(EL,drop_dims)(multi->p[i], type, first, n);
726
0
    if (!multi->p[i])
727
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
728
0
  }
729
0
730
0
  return multi;
731
66
}
Unexecuted instantiation: isl_multi_pw_aff_drop_dims
Unexecuted instantiation: isl_multi_val_drop_dims
isl_multi_aff_drop_dims
Line
Count
Source
696
1.05k
{
697
1.05k
  int i;
698
1.05k
  unsigned dim;
699
1.05k
700
1.05k
  multi = FN(MULTI(BASE),cow)(multi);
701
1.05k
  if (!multi)
702
0
    return NULL;
703
1.05k
704
1.05k
  
dim = 1.05k
FN1.05k
(MULTI(BASE),dim)(multi, type);
705
1.05k
  if (
first + n > dim || 1.05k
first + n < first1.05k
)
706
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
707
1.05k
      "index out of bounds",
708
1.05k
      return FN(MULTI(BASE),free)(multi));
709
1.05k
710
1.05k
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
711
1.05k
  if (!multi->space)
712
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
713
1.05k
714
1.05k
  
if (1.05k
type == isl_dim_out1.05k
)
{921
715
1.87k
    for (i = 0; 
i < n1.87k
;
++i951
)
716
951
      
FN951
(EL,free)(multi->p[first + i])951
;
717
1.68k
    for (i = first; 
i + n < multi->n1.68k
;
++i764
)
718
764
      multi->p[i] = multi->p[i + n];
719
921
    multi->n -= n;
720
921
721
921
    return multi;
722
1.05k
  }
723
1.05k
724
536
  
for (i = 0; 136
i < multi->n536
;
++i400
)
{400
725
400
    multi->p[i] = FN(EL,drop_dims)(multi->p[i], type, first, n);
726
400
    if (!multi->p[i])
727
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
728
400
  }
729
136
730
136
  return multi;
731
1.05k
}
732
733
/* Align the parameters of "multi1" and "multi2" (if needed) and call "fn".
734
 */
735
static __isl_give MULTI(BASE) *FN(MULTI(BASE),align_params_multi_multi_and)(
736
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2,
737
  __isl_give MULTI(BASE) *(*fn)(__isl_take MULTI(BASE) *multi1,
738
    __isl_take MULTI(BASE) *multi2))
739
5.85k
{
740
5.85k
  isl_ctx *ctx;
741
5.85k
  isl_bool equal_params;
742
5.85k
743
5.85k
  if (
!multi1 || 5.85k
!multi25.85k
)
744
0
    goto error;
745
5.85k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
746
5.85k
  if (equal_params < 0)
747
0
    goto error;
748
5.85k
  
if (5.85k
equal_params5.85k
)
749
5.84k
    return fn(multi1, multi2);
750
12
  
ctx = 12
FN12
(MULTI(BASE),get_ctx)(multi1);
751
12
  if (!isl_space_has_named_params(multi1->space) ||
752
12
      !isl_space_has_named_params(multi2->space))
753
0
    isl_die(ctx, isl_error_invalid,
754
12
      "unaligned unnamed parameters", goto error);
755
12
  
multi1 = 12
FN12
(MULTI(BASE),align_params)(multi1,
756
12
              FN(MULTI(BASE),get_space)(multi2));
757
12
  multi2 = FN(MULTI(BASE),align_params)(multi2,
758
12
              FN(MULTI(BASE),get_space)(multi1));
759
12
  return fn(multi1, multi2);
760
12
error:
761
0
  FN(MULTI(BASE),free)(multi1);
762
0
  FN(MULTI(BASE),free)(multi2);
763
12
  return NULL;
764
5.85k
}
Unexecuted instantiation: isl_val.c:isl_multi_val_align_params_multi_multi_and
isl_aff.c:isl_multi_aff_align_params_multi_multi_and
Line
Count
Source
739
3.79k
{
740
3.79k
  isl_ctx *ctx;
741
3.79k
  isl_bool equal_params;
742
3.79k
743
3.79k
  if (
!multi1 || 3.79k
!multi23.79k
)
744
0
    goto error;
745
3.79k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
746
3.79k
  if (equal_params < 0)
747
0
    goto error;
748
3.79k
  
if (3.79k
equal_params3.79k
)
749
3.79k
    return fn(multi1, multi2);
750
0
  
ctx = 0
FN0
(MULTI(BASE),get_ctx)(multi1);
751
0
  if (!isl_space_has_named_params(multi1->space) ||
752
0
      !isl_space_has_named_params(multi2->space))
753
0
    isl_die(ctx, isl_error_invalid,
754
0
      "unaligned unnamed parameters", goto error);
755
0
  
multi1 = 0
FN0
(MULTI(BASE),align_params)(multi1,
756
0
              FN(MULTI(BASE),get_space)(multi2));
757
0
  multi2 = FN(MULTI(BASE),align_params)(multi2,
758
0
              FN(MULTI(BASE),get_space)(multi1));
759
0
  return fn(multi1, multi2);
760
0
error:
761
0
  FN(MULTI(BASE),free)(multi1);
762
0
  FN(MULTI(BASE),free)(multi2);
763
0
  return NULL;
764
3.79k
}
isl_aff.c:isl_multi_pw_aff_align_params_multi_multi_and
Line
Count
Source
739
5
{
740
5
  isl_ctx *ctx;
741
5
  isl_bool equal_params;
742
5
743
5
  if (
!multi1 || 5
!multi25
)
744
0
    goto error;
745
5
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
746
5
  if (equal_params < 0)
747
0
    goto error;
748
5
  
if (5
equal_params5
)
749
5
    return fn(multi1, multi2);
750
0
  
ctx = 0
FN0
(MULTI(BASE),get_ctx)(multi1);
751
0
  if (!isl_space_has_named_params(multi1->space) ||
752
0
      !isl_space_has_named_params(multi2->space))
753
0
    isl_die(ctx, isl_error_invalid,
754
0
      "unaligned unnamed parameters", goto error);
755
0
  
multi1 = 0
FN0
(MULTI(BASE),align_params)(multi1,
756
0
              FN(MULTI(BASE),get_space)(multi2));
757
0
  multi2 = FN(MULTI(BASE),align_params)(multi2,
758
0
              FN(MULTI(BASE),get_space)(multi1));
759
0
  return fn(multi1, multi2);
760
0
error:
761
0
  FN(MULTI(BASE),free)(multi1);
762
0
  FN(MULTI(BASE),free)(multi2);
763
0
  return NULL;
764
5
}
isl_aff.c:isl_multi_union_pw_aff_align_params_multi_multi_and
Line
Count
Source
739
2.05k
{
740
2.05k
  isl_ctx *ctx;
741
2.05k
  isl_bool equal_params;
742
2.05k
743
2.05k
  if (
!multi1 || 2.05k
!multi22.05k
)
744
0
    goto error;
745
2.05k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
746
2.05k
  if (equal_params < 0)
747
0
    goto error;
748
2.05k
  
if (2.05k
equal_params2.05k
)
749
2.04k
    return fn(multi1, multi2);
750
12
  
ctx = 12
FN12
(MULTI(BASE),get_ctx)(multi1);
751
12
  if (!isl_space_has_named_params(multi1->space) ||
752
12
      !isl_space_has_named_params(multi2->space))
753
0
    isl_die(ctx, isl_error_invalid,
754
12
      "unaligned unnamed parameters", goto error);
755
12
  
multi1 = 12
FN12
(MULTI(BASE),align_params)(multi1,
756
12
              FN(MULTI(BASE),get_space)(multi2));
757
12
  multi2 = FN(MULTI(BASE),align_params)(multi2,
758
12
              FN(MULTI(BASE),get_space)(multi1));
759
12
  return fn(multi1, multi2);
760
12
error:
761
0
  FN(MULTI(BASE),free)(multi1);
762
0
  FN(MULTI(BASE),free)(multi2);
763
12
  return NULL;
764
2.05k
}
765
766
/* Given two MULTI(BASE)s A -> B and C -> D,
767
 * construct a MULTI(BASE) (A * C) -> [B -> D].
768
 *
769
 * The parameters are assumed to have been aligned.
770
 */
771
static __isl_give MULTI(BASE) *FN(MULTI(BASE),range_product_aligned)(
772
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
773
2.15k
{
774
2.15k
  int i, n1, n2;
775
2.15k
  EL *el;
776
2.15k
  isl_space *space;
777
2.15k
  MULTI(BASE) *res;
778
2.15k
779
2.15k
  if (
!multi1 || 2.15k
!multi22.15k
)
780
0
    goto error;
781
2.15k
782
2.15k
  
space = isl_space_range_product(2.15k
FN2.15k
(MULTI(BASE),get_space)(multi1),
783
2.15k
          FN(MULTI(BASE),get_space)(multi2));
784
2.15k
  res = FN(MULTI(BASE),alloc)(space);
785
2.15k
786
2.15k
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
787
2.15k
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
788
2.15k
789
4.85k
  for (i = 0; 
i < n14.85k
;
++i2.69k
)
{2.69k
790
2.69k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
791
2.69k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
792
2.69k
  }
793
2.15k
794
3.87k
  for (i = 0; 
i < n23.87k
;
++i1.72k
)
{1.72k
795
1.72k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
796
1.72k
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
797
2.15k
  }
798
2.15k
799
2.15k
  FN(MULTI(BASE),free)(multi1);
800
2.15k
  FN(MULTI(BASE),free)(multi2);
801
2.15k
  return res;
802
2.15k
error:
803
0
  FN(MULTI(BASE),free)(multi1);
804
0
  FN(MULTI(BASE),free)(multi2);
805
2.15k
  return NULL;
806
2.15k
}
isl_aff.c:isl_multi_aff_range_product_aligned
Line
Count
Source
773
243
{
774
243
  int i, n1, n2;
775
243
  EL *el;
776
243
  isl_space *space;
777
243
  MULTI(BASE) *res;
778
243
779
243
  if (
!multi1 || 243
!multi2243
)
780
0
    goto error;
781
243
782
243
  
space = isl_space_range_product(243
FN243
(MULTI(BASE),get_space)(multi1),
783
243
          FN(MULTI(BASE),get_space)(multi2));
784
243
  res = FN(MULTI(BASE),alloc)(space);
785
243
786
243
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
787
243
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
788
243
789
911
  for (i = 0; 
i < n1911
;
++i668
)
{668
790
668
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
791
668
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
792
668
  }
793
243
794
504
  for (i = 0; 
i < n2504
;
++i261
)
{261
795
261
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
796
261
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
797
261
  }
798
243
799
243
  FN(MULTI(BASE),free)(multi1);
800
243
  FN(MULTI(BASE),free)(multi2);
801
243
  return res;
802
243
error:
803
0
  FN(MULTI(BASE),free)(multi1);
804
0
  FN(MULTI(BASE),free)(multi2);
805
243
  return NULL;
806
243
}
isl_aff.c:isl_multi_pw_aff_range_product_aligned
Line
Count
Source
773
5
{
774
5
  int i, n1, n2;
775
5
  EL *el;
776
5
  isl_space *space;
777
5
  MULTI(BASE) *res;
778
5
779
5
  if (
!multi1 || 5
!multi25
)
780
0
    goto error;
781
5
782
5
  
space = isl_space_range_product(5
FN5
(MULTI(BASE),get_space)(multi1),
783
5
          FN(MULTI(BASE),get_space)(multi2));
784
5
  res = FN(MULTI(BASE),alloc)(space);
785
5
786
5
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
787
5
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
788
5
789
14
  for (i = 0; 
i < n114
;
++i9
)
{9
790
9
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
791
9
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
792
9
  }
793
5
794
14
  for (i = 0; 
i < n214
;
++i9
)
{9
795
9
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
796
9
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
797
9
  }
798
5
799
5
  FN(MULTI(BASE),free)(multi1);
800
5
  FN(MULTI(BASE),free)(multi2);
801
5
  return res;
802
5
error:
803
0
  FN(MULTI(BASE),free)(multi1);
804
0
  FN(MULTI(BASE),free)(multi2);
805
5
  return NULL;
806
5
}
isl_aff.c:isl_multi_union_pw_aff_range_product_aligned
Line
Count
Source
773
1.90k
{
774
1.90k
  int i, n1, n2;
775
1.90k
  EL *el;
776
1.90k
  isl_space *space;
777
1.90k
  MULTI(BASE) *res;
778
1.90k
779
1.90k
  if (
!multi1 || 1.90k
!multi21.90k
)
780
0
    goto error;
781
1.90k
782
1.90k
  
space = isl_space_range_product(1.90k
FN1.90k
(MULTI(BASE),get_space)(multi1),
783
1.90k
          FN(MULTI(BASE),get_space)(multi2));
784
1.90k
  res = FN(MULTI(BASE),alloc)(space);
785
1.90k
786
1.90k
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
787
1.90k
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
788
1.90k
789
3.92k
  for (i = 0; 
i < n13.92k
;
++i2.02k
)
{2.02k
790
2.02k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
791
2.02k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
792
2.02k
  }
793
1.90k
794
3.35k
  for (i = 0; 
i < n23.35k
;
++i1.45k
)
{1.45k
795
1.45k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
796
1.45k
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
797
1.90k
  }
798
1.90k
799
1.90k
  FN(MULTI(BASE),free)(multi1);
800
1.90k
  FN(MULTI(BASE),free)(multi2);
801
1.90k
  return res;
802
1.90k
error:
803
0
  FN(MULTI(BASE),free)(multi1);
804
0
  FN(MULTI(BASE),free)(multi2);
805
1.90k
  return NULL;
806
1.90k
}
Unexecuted instantiation: isl_val.c:isl_multi_val_range_product_aligned
807
808
/* Given two MULTI(BASE)s A -> B and C -> D,
809
 * construct a MULTI(BASE) (A * C) -> [B -> D].
810
 */
811
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_product)(
812
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
813
2.15k
{
814
2.15k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
815
2.15k
          &FN(MULTI(BASE),range_product_aligned));
816
2.15k
}
isl_multi_union_pw_aff_range_product
Line
Count
Source
813
1.90k
{
814
1.90k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
815
1.90k
          &FN(MULTI(BASE),range_product_aligned));
816
1.90k
}
isl_multi_pw_aff_range_product
Line
Count
Source
813
5
{
814
5
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
815
5
          &FN(MULTI(BASE),range_product_aligned));
816
5
}
Unexecuted instantiation: isl_multi_val_range_product
isl_multi_aff_range_product
Line
Count
Source
813
243
{
814
243
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
815
243
          &FN(MULTI(BASE),range_product_aligned));
816
243
}
817
818
/* Is the range of "multi" a wrapped relation?
819
 */
820
isl_bool FN(MULTI(BASE),range_is_wrapping)(__isl_keep MULTI(BASE) *multi)
821
968
{
822
968
  if (!multi)
823
0
    return isl_bool_error;
824
968
  return isl_space_range_is_wrapping(multi->space);
825
968
}
Unexecuted instantiation: isl_multi_val_range_is_wrapping
Unexecuted instantiation: isl_multi_aff_range_is_wrapping
isl_multi_pw_aff_range_is_wrapping
Line
Count
Source
821
968
{
822
968
  if (!multi)
823
0
    return isl_bool_error;
824
968
  return isl_space_range_is_wrapping(multi->space);
825
968
}
Unexecuted instantiation: isl_multi_union_pw_aff_range_is_wrapping
826
827
/* Given a function A -> [B -> C], extract the function A -> B.
828
 */
829
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_factor_domain)(
830
  __isl_take MULTI(BASE) *multi)
831
0
{
832
0
  isl_space *space;
833
0
  int total, keep;
834
0
835
0
  if (!multi)
836
0
    return NULL;
837
0
  
if (0
!isl_space_range_is_wrapping(multi->space)0
)
838
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
839
0
      "range is not a product",
840
0
      return FN(MULTI(BASE),free)(multi));
841
0
842
0
  
space = 0
FN0
(MULTI(BASE),get_space)(multi);
843
0
  total = isl_space_dim(space, isl_dim_out);
844
0
  space = isl_space_range_factor_domain(space);
845
0
  keep = isl_space_dim(space, isl_dim_out);
846
0
  multi = FN(MULTI(BASE),drop_dims)(multi,
847
0
          isl_dim_out, keep, total - keep);
848
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
849
0
850
0
  return multi;
851
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_range_factor_domain
Unexecuted instantiation: isl_multi_aff_range_factor_domain
Unexecuted instantiation: isl_multi_pw_aff_range_factor_domain
Unexecuted instantiation: isl_multi_val_range_factor_domain
852
853
/* Given a function A -> [B -> C], extract the function A -> C.
854
 */
855
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_factor_range)(
856
  __isl_take MULTI(BASE) *multi)
857
0
{
858
0
  isl_space *space;
859
0
  int total, keep;
860
0
861
0
  if (!multi)
862
0
    return NULL;
863
0
  
if (0
!isl_space_range_is_wrapping(multi->space)0
)
864
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
865
0
      "range is not a product",
866
0
      return FN(MULTI(BASE),free)(multi));
867
0
868
0
  
space = 0
FN0
(MULTI(BASE),get_space)(multi);
869
0
  total = isl_space_dim(space, isl_dim_out);
870
0
  space = isl_space_range_factor_range(space);
871
0
  keep = isl_space_dim(space, isl_dim_out);
872
0
  multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep);
873
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
874
0
875
0
  return multi;
876
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_range_factor_range
Unexecuted instantiation: isl_multi_val_range_factor_range
Unexecuted instantiation: isl_multi_pw_aff_range_factor_range
Unexecuted instantiation: isl_multi_aff_range_factor_range
877
878
/* Given a function [B -> C], extract the function C.
879
 */
880
__isl_give MULTI(BASE) *FN(MULTI(BASE),factor_range)(
881
  __isl_take MULTI(BASE) *multi)
882
0
{
883
0
  isl_space *space;
884
0
  int total, keep;
885
0
886
0
  if (!multi)
887
0
    return NULL;
888
0
  
if (0
!isl_space_is_wrapping(multi->space)0
)
889
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
890
0
      "not a product", return FN(MULTI(BASE),free)(multi));
891
0
892
0
  
space = 0
FN0
(MULTI(BASE),get_space)(multi);
893
0
  total = isl_space_dim(space, isl_dim_out);
894
0
  space = isl_space_factor_range(space);
895
0
  keep = isl_space_dim(space, isl_dim_out);
896
0
  multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_out, 0, total - keep);
897
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
898
0
899
0
  return multi;
900
0
}
Unexecuted instantiation: isl_multi_val_factor_range
Unexecuted instantiation: isl_multi_union_pw_aff_factor_range
Unexecuted instantiation: isl_multi_pw_aff_factor_range
Unexecuted instantiation: isl_multi_aff_factor_range
901
902
#ifndef NO_PRODUCT
903
/* Given two MULTI(BASE)s A -> B and C -> D,
904
 * construct a MULTI(BASE) [A -> C] -> [B -> D].
905
 *
906
 * The parameters are assumed to have been aligned.
907
 */
908
__isl_give MULTI(BASE) *FN(MULTI(BASE),product_aligned)(
909
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
910
1.79k
{
911
1.79k
  int i;
912
1.79k
  EL *el;
913
1.79k
  isl_space *space;
914
1.79k
  MULTI(BASE) *res;
915
1.79k
  int in1, in2, out1, out2;
916
1.79k
917
1.79k
  in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
918
1.79k
  in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
919
1.79k
  out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
920
1.79k
  out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
921
1.79k
  space = isl_space_product(FN(MULTI(BASE),get_space)(multi1),
922
1.79k
          FN(MULTI(BASE),get_space)(multi2));
923
1.79k
  res = FN(MULTI(BASE),alloc)(isl_space_copy(space));
924
1.79k
  space = isl_space_domain(space);
925
1.79k
926
3.34k
  for (i = 0; 
i < out13.34k
;
++i1.55k
)
{1.55k
927
1.55k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
928
1.55k
    el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2);
929
1.55k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
930
1.55k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
931
1.79k
  }
932
1.79k
933
4.29k
  for (i = 0; 
i < out24.29k
;
++i2.50k
)
{2.50k
934
2.50k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
935
2.50k
    el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1);
936
2.50k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
937
2.50k
    res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el);
938
2.50k
  }
939
1.79k
940
1.79k
  isl_space_free(space);
941
1.79k
  FN(MULTI(BASE),free)(multi1);
942
1.79k
  FN(MULTI(BASE),free)(multi2);
943
1.79k
  return res;
944
1.79k
}
Unexecuted instantiation: isl_multi_val_product_aligned
isl_multi_aff_product_aligned
Line
Count
Source
910
1.79k
{
911
1.79k
  int i;
912
1.79k
  EL *el;
913
1.79k
  isl_space *space;
914
1.79k
  MULTI(BASE) *res;
915
1.79k
  int in1, in2, out1, out2;
916
1.79k
917
1.79k
  in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
918
1.79k
  in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
919
1.79k
  out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
920
1.79k
  out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
921
1.79k
  space = isl_space_product(FN(MULTI(BASE),get_space)(multi1),
922
1.79k
          FN(MULTI(BASE),get_space)(multi2));
923
1.79k
  res = FN(MULTI(BASE),alloc)(isl_space_copy(space));
924
1.79k
  space = isl_space_domain(space);
925
1.79k
926
3.34k
  for (i = 0; 
i < out13.34k
;
++i1.55k
)
{1.55k
927
1.55k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
928
1.55k
    el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2);
929
1.55k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
930
1.55k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
931
1.79k
  }
932
1.79k
933
4.29k
  for (i = 0; 
i < out24.29k
;
++i2.50k
)
{2.50k
934
2.50k
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
935
2.50k
    el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1);
936
2.50k
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
937
2.50k
    res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el);
938
2.50k
  }
939
1.79k
940
1.79k
  isl_space_free(space);
941
1.79k
  FN(MULTI(BASE),free)(multi1);
942
1.79k
  FN(MULTI(BASE),free)(multi2);
943
1.79k
  return res;
944
1.79k
}
Unexecuted instantiation: isl_multi_pw_aff_product_aligned
945
946
/* Given two MULTI(BASE)s A -> B and C -> D,
947
 * construct a MULTI(BASE) [A -> C] -> [B -> D].
948
 */
949
__isl_give MULTI(BASE) *FN(MULTI(BASE),product)(
950
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
951
1.79k
{
952
1.79k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
953
1.79k
          &FN(MULTI(BASE),product_aligned));
954
1.79k
}
Unexecuted instantiation: isl_multi_val_product
isl_multi_aff_product
Line
Count
Source
951
1.79k
{
952
1.79k
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
953
1.79k
          &FN(MULTI(BASE),product_aligned));
954
1.79k
}
Unexecuted instantiation: isl_multi_pw_aff_product
955
#endif
956
957
__isl_give MULTI(BASE) *FN(MULTI(BASE),flatten_range)(
958
  __isl_take MULTI(BASE) *multi)
959
2.63k
{
960
2.63k
  if (!multi)
961
0
    return NULL;
962
2.63k
963
2.63k
  
if (2.63k
!multi->space->nested[1]2.63k
)
964
0
    return multi;
965
2.63k
966
2.63k
  
multi = 2.63k
FN2.63k
(MULTI(BASE),cow)(multi);
967
2.63k
  if (!multi)
968
0
    return NULL;
969
2.63k
970
2.63k
  multi->space = isl_space_flatten_range(multi->space);
971
2.63k
  if (!multi->space)
972
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
973
2.63k
974
2.63k
  return multi;
975
2.63k
}
Unexecuted instantiation: isl_multi_val_flatten_range
isl_multi_union_pw_aff_flatten_range
Line
Count
Source
959
1.90k
{
960
1.90k
  if (!multi)
961
0
    return NULL;
962
1.90k
963
1.90k
  
if (1.90k
!multi->space->nested[1]1.90k
)
964
0
    return multi;
965
1.90k
966
1.90k
  
multi = 1.90k
FN1.90k
(MULTI(BASE),cow)(multi);
967
1.90k
  if (!multi)
968
0
    return NULL;
969
1.90k
970
1.90k
  multi->space = isl_space_flatten_range(multi->space);
971
1.90k
  if (!multi->space)
972
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
973
1.90k
974
1.90k
  return multi;
975
1.90k
}
isl_multi_pw_aff_flatten_range
Line
Count
Source
959
1
{
960
1
  if (!multi)
961
0
    return NULL;
962
1
963
1
  
if (1
!multi->space->nested[1]1
)
964
0
    return multi;
965
1
966
1
  
multi = 1
FN1
(MULTI(BASE),cow)(multi);
967
1
  if (!multi)
968
0
    return NULL;
969
1
970
1
  multi->space = isl_space_flatten_range(multi->space);
971
1
  if (!multi->space)
972
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
973
1
974
1
  return multi;
975
1
}
isl_multi_aff_flatten_range
Line
Count
Source
959
729
{
960
729
  if (!multi)
961
0
    return NULL;
962
729
963
729
  
if (729
!multi->space->nested[1]729
)
964
0
    return multi;
965
729
966
729
  
multi = 729
FN729
(MULTI(BASE),cow)(multi);
967
729
  if (!multi)
968
0
    return NULL;
969
729
970
729
  multi->space = isl_space_flatten_range(multi->space);
971
729
  if (!multi->space)
972
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
973
729
974
729
  return multi;
975
729
}
976
977
/* Given two MULTI(BASE)s A -> B and C -> D,
978
 * construct a MULTI(BASE) (A * C) -> (B, D).
979
 */
980
__isl_give MULTI(BASE) *FN(MULTI(BASE),flat_range_product)(
981
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
982
2.03k
{
983
2.03k
  MULTI(BASE) *multi;
984
2.03k
985
2.03k
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
986
2.03k
  multi = FN(MULTI(BASE),flatten_range)(multi);
987
2.03k
  return multi;
988
2.03k
}
Unexecuted instantiation: isl_multi_val_flat_range_product
isl_multi_aff_flat_range_product
Line
Count
Source
982
132
{
983
132
  MULTI(BASE) *multi;
984
132
985
132
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
986
132
  multi = FN(MULTI(BASE),flatten_range)(multi);
987
132
  return multi;
988
132
}
isl_multi_pw_aff_flat_range_product
Line
Count
Source
982
1
{
983
1
  MULTI(BASE) *multi;
984
1
985
1
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
986
1
  multi = FN(MULTI(BASE),flatten_range)(multi);
987
1
  return multi;
988
1
}
isl_multi_union_pw_aff_flat_range_product
Line
Count
Source
982
1.90k
{
983
1.90k
  MULTI(BASE) *multi;
984
1.90k
985
1.90k
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
986
1.90k
  multi = FN(MULTI(BASE),flatten_range)(multi);
987
1.90k
  return multi;
988
1.90k
}
989
990
/* Given two multi expressions, "multi1"
991
 *
992
 *  [A] -> [B1 B2]
993
 *
994
 * where B2 starts at position "pos", and "multi2"
995
 *
996
 *  [A] -> [D]
997
 *
998
 * return the multi expression
999
 *
1000
 *  [A] -> [B1 D B2]
1001
 */
1002
__isl_give MULTI(BASE) *FN(MULTI(BASE),range_splice)(
1003
  __isl_take MULTI(BASE) *multi1, unsigned pos,
1004
  __isl_take MULTI(BASE) *multi2)
1005
9
{
1006
9
  MULTI(BASE) *res;
1007
9
  unsigned dim;
1008
9
1009
9
  if (
!multi1 || 9
!multi29
)
1010
0
    goto error;
1011
9
1012
9
  
dim = 9
FN9
(MULTI(BASE),dim)(multi1, isl_dim_out);
1013
9
  if (pos > dim)
1014
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1015
9
      "index out of bounds", goto error);
1016
9
1017
9
  
res = 9
FN9
(MULTI(BASE),copy)(multi1);
1018
9
  res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos);
1019
9
  multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos);
1020
9
1021
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi2);
1022
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi1);
1023
9
1024
9
  return res;
1025
9
error:
1026
0
  FN(MULTI(BASE),free)(multi1);
1027
0
  FN(MULTI(BASE),free)(multi2);
1028
9
  return NULL;
1029
9
}
Unexecuted instantiation: isl_multi_val_range_splice
Unexecuted instantiation: isl_multi_pw_aff_range_splice
isl_multi_aff_range_splice
Line
Count
Source
1005
9
{
1006
9
  MULTI(BASE) *res;
1007
9
  unsigned dim;
1008
9
1009
9
  if (
!multi1 || 9
!multi29
)
1010
0
    goto error;
1011
9
1012
9
  
dim = 9
FN9
(MULTI(BASE),dim)(multi1, isl_dim_out);
1013
9
  if (pos > dim)
1014
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1015
9
      "index out of bounds", goto error);
1016
9
1017
9
  
res = 9
FN9
(MULTI(BASE),copy)(multi1);
1018
9
  res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos);
1019
9
  multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos);
1020
9
1021
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi2);
1022
9
  res = FN(MULTI(BASE),flat_range_product)(res, multi1);
1023
9
1024
9
  return res;
1025
9
error:
1026
0
  FN(MULTI(BASE),free)(multi1);
1027
0
  FN(MULTI(BASE),free)(multi2);
1028
9
  return NULL;
1029
9
}
Unexecuted instantiation: isl_multi_union_pw_aff_range_splice
1030
1031
#ifndef NO_SPLICE
1032
/* Given two multi expressions, "multi1"
1033
 *
1034
 *  [A1 A2] -> [B1 B2]
1035
 *
1036
 * where A2 starts at position "in_pos" and B2 starts at position "out_pos",
1037
 * and "multi2"
1038
 *
1039
 *  [C] -> [D]
1040
 *
1041
 * return the multi expression
1042
 *
1043
 *  [A1 C A2] -> [B1 D B2]
1044
 *
1045
 * We first insert input dimensions to obtain
1046
 *
1047
 *  [A1 C A2] -> [B1 B2]
1048
 *
1049
 * and
1050
 *
1051
 *  [A1 C A2] -> [D]
1052
 *
1053
 * and then apply range_splice.
1054
 */
1055
__isl_give MULTI(BASE) *FN(MULTI(BASE),splice)(
1056
  __isl_take MULTI(BASE) *multi1, unsigned in_pos, unsigned out_pos,
1057
  __isl_take MULTI(BASE) *multi2)
1058
6
{
1059
6
  unsigned n_in1;
1060
6
  unsigned n_in2;
1061
6
1062
6
  if (
!multi1 || 6
!multi26
)
1063
0
    goto error;
1064
6
1065
6
  
n_in1 = 6
FN6
(MULTI(BASE),dim)(multi1, isl_dim_in);
1066
6
  if (in_pos > n_in1)
1067
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1068
6
      "index out of bounds", goto error);
1069
6
1070
6
  
n_in2 = 6
FN6
(MULTI(BASE),dim)(multi2, isl_dim_in);
1071
6
1072
6
  multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
1073
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
1074
6
            n_in1 - in_pos);
1075
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos);
1076
6
1077
6
  return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2);
1078
6
error:
1079
0
  FN(MULTI(BASE),free)(multi1);
1080
0
  FN(MULTI(BASE),free)(multi2);
1081
6
  return NULL;
1082
6
}
isl_multi_aff_splice
Line
Count
Source
1058
6
{
1059
6
  unsigned n_in1;
1060
6
  unsigned n_in2;
1061
6
1062
6
  if (
!multi1 || 6
!multi26
)
1063
0
    goto error;
1064
6
1065
6
  
n_in1 = 6
FN6
(MULTI(BASE),dim)(multi1, isl_dim_in);
1066
6
  if (in_pos > n_in1)
1067
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1068
6
      "index out of bounds", goto error);
1069
6
1070
6
  
n_in2 = 6
FN6
(MULTI(BASE),dim)(multi2, isl_dim_in);
1071
6
1072
6
  multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
1073
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
1074
6
            n_in1 - in_pos);
1075
6
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos);
1076
6
1077
6
  return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2);
1078
6
error:
1079
0
  FN(MULTI(BASE),free)(multi1);
1080
0
  FN(MULTI(BASE),free)(multi2);
1081
6
  return NULL;
1082
6
}
Unexecuted instantiation: isl_multi_val_splice
Unexecuted instantiation: isl_multi_pw_aff_splice
1083
#endif
1084
1085
/* This function is currently only used from isl_aff.c
1086
 */
1087
static __isl_give MULTI(BASE) *FN(MULTI(BASE),bin_op)(
1088
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2,
1089
  __isl_give EL *(*fn)(__isl_take EL *, __isl_take EL *))
1090
  __attribute__ ((unused));
1091
1092
/* Pairwise perform "fn" to the elements of "multi1" and "multi2" and
1093
 * return the result.
1094
 */
1095
static __isl_give MULTI(BASE) *FN(MULTI(BASE),bin_op)(
1096
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2,
1097
  __isl_give EL *(*fn)(__isl_take EL *, __isl_take EL *))
1098
157
{
1099
157
  int i;
1100
157
  isl_ctx *ctx;
1101
157
1102
157
  multi1 = FN(MULTI(BASE),cow)(multi1);
1103
157
  if (
!multi1 || 157
!multi2157
)
1104
0
    goto error;
1105
157
1106
157
  
ctx = 157
FN157
(MULTI(BASE),get_ctx)(multi1);
1107
157
  if (!isl_space_is_equal(multi1->space, multi2->space))
1108
0
    isl_die(ctx, isl_error_invalid,
1109
157
      "spaces don't match", goto error);
1110
157
1111
433
  
for (i = 0; 157
i < multi1->n433
;
++i276
)
{276
1112
276
    multi1->p[i] = fn(multi1->p[i], FN(EL,copy)(multi2->p[i]));
1113
276
    if (!multi1->p[i])
1114
0
      goto error;
1115
276
  }
1116
157
1117
157
  
FN157
(MULTI(BASE),free)(multi2);157
1118
157
  return multi1;
1119
157
error:
1120
0
  FN(MULTI(BASE),free)(multi1);
1121
0
  FN(MULTI(BASE),free)(multi2);
1122
157
  return NULL;
1123
157
}
Unexecuted instantiation: isl_val.c:isl_multi_val_bin_op
isl_aff.c:isl_multi_aff_bin_op
Line
Count
Source
1098
3
{
1099
3
  int i;
1100
3
  isl_ctx *ctx;
1101
3
1102
3
  multi1 = FN(MULTI(BASE),cow)(multi1);
1103
3
  if (
!multi1 || 3
!multi23
)
1104
0
    goto error;
1105
3
1106
3
  
ctx = 3
FN3
(MULTI(BASE),get_ctx)(multi1);
1107
3
  if (!isl_space_is_equal(multi1->space, multi2->space))
1108
0
    isl_die(ctx, isl_error_invalid,
1109
3
      "spaces don't match", goto error);
1110
3
1111
6
  
for (i = 0; 3
i < multi1->n6
;
++i3
)
{3
1112
3
    multi1->p[i] = fn(multi1->p[i], FN(EL,copy)(multi2->p[i]));
1113
3
    if (!multi1->p[i])
1114
0
      goto error;
1115
3
  }
1116
3
1117
3
  
FN3
(MULTI(BASE),free)(multi2);3
1118
3
  return multi1;
1119
3
error:
1120
0
  FN(MULTI(BASE),free)(multi1);
1121
0
  FN(MULTI(BASE),free)(multi2);
1122
3
  return NULL;
1123
3
}
isl_aff.c:isl_multi_union_pw_aff_bin_op
Line
Count
Source
1098
154
{
1099
154
  int i;
1100
154
  isl_ctx *ctx;
1101
154
1102
154
  multi1 = FN(MULTI(BASE),cow)(multi1);
1103
154
  if (
!multi1 || 154
!multi2154
)
1104
0
    goto error;
1105
154
1106
154
  
ctx = 154
FN154
(MULTI(BASE),get_ctx)(multi1);
1107
154
  if (!isl_space_is_equal(multi1->space, multi2->space))
1108
0
    isl_die(ctx, isl_error_invalid,
1109
154
      "spaces don't match", goto error);
1110
154
1111
427
  
for (i = 0; 154
i < multi1->n427
;
++i273
)
{273
1112
273
    multi1->p[i] = fn(multi1->p[i], FN(EL,copy)(multi2->p[i]));
1113
273
    if (!multi1->p[i])
1114
0
      goto error;
1115
273
  }
1116
154
1117
154
  
FN154
(MULTI(BASE),free)(multi2);154
1118
154
  return multi1;
1119
154
error:
1120
0
  FN(MULTI(BASE),free)(multi1);
1121
0
  FN(MULTI(BASE),free)(multi2);
1122
154
  return NULL;
1123
154
}
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_bin_op
1124
1125
/* Add "multi2" from "multi1" and return the result.
1126
 *
1127
 * The parameters of "multi1" and "multi2" are assumed to have been aligned.
1128
 */
1129
static __isl_give MULTI(BASE) *FN(MULTI(BASE),add_aligned)(
1130
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
1131
3
{
1132
3
  return 
FN3
(MULTI(BASE),bin_op)(multi1, multi2, &
FN3
(EL,add));
1133
3
}
Unexecuted instantiation: isl_aff.c:isl_multi_union_pw_aff_add_aligned
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_add_aligned
Unexecuted instantiation: isl_val.c:isl_multi_val_add_aligned
isl_aff.c:isl_multi_aff_add_aligned
Line
Count
Source
1131
3
{
1132
3
  return 
FN3
(MULTI(BASE),bin_op)(multi1, multi2, &
FN3
(EL,add));
1133
3
}
1134
1135
/* Add "multi2" from "multi1" and return the result.
1136
 */
1137
__isl_give MULTI(BASE) *FN(MULTI(BASE),add)(__isl_take MULTI(BASE) *multi1,
1138
  __isl_take MULTI(BASE) *multi2)
1139
3
{
1140
3
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1141
3
            &FN(MULTI(BASE),add_aligned));
1142
3
}
isl_multi_aff_add
Line
Count
Source
1139
3
{
1140
3
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1141
3
            &FN(MULTI(BASE),add_aligned));
1142
3
}
Unexecuted instantiation: isl_multi_union_pw_aff_add
Unexecuted instantiation: isl_multi_val_add
Unexecuted instantiation: isl_multi_pw_aff_add
1143
1144
/* Subtract "multi2" from "multi1" and return the result.
1145
 *
1146
 * The parameters of "multi1" and "multi2" are assumed to have been aligned.
1147
 */
1148
static __isl_give MULTI(BASE) *FN(MULTI(BASE),sub_aligned)(
1149
  __isl_take MULTI(BASE) *multi1, __isl_take MULTI(BASE) *multi2)
1150
74
{
1151
74
  return 
FN74
(MULTI(BASE),bin_op)(multi1, multi2, &
FN74
(EL,sub));
1152
74
}
Unexecuted instantiation: isl_aff.c:isl_multi_aff_sub_aligned
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_sub_aligned
Unexecuted instantiation: isl_val.c:isl_multi_val_sub_aligned
isl_aff.c:isl_multi_union_pw_aff_sub_aligned
Line
Count
Source
1150
74
{
1151
74
  return 
FN74
(MULTI(BASE),bin_op)(multi1, multi2, &
FN74
(EL,sub));
1152
74
}
1153
1154
/* Subtract "multi2" from "multi1" and return the result.
1155
 */
1156
__isl_give MULTI(BASE) *FN(MULTI(BASE),sub)(__isl_take MULTI(BASE) *multi1,
1157
  __isl_take MULTI(BASE) *multi2)
1158
74
{
1159
74
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1160
74
            &FN(MULTI(BASE),sub_aligned));
1161
74
}
Unexecuted instantiation: isl_multi_val_sub
isl_multi_union_pw_aff_sub
Line
Count
Source
1158
74
{
1159
74
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1160
74
            &FN(MULTI(BASE),sub_aligned));
1161
74
}
Unexecuted instantiation: isl_multi_pw_aff_sub
Unexecuted instantiation: isl_multi_aff_sub
1162
1163
/* Multiply the elements of "multi" by "v" and return the result.
1164
 */
1165
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_val)(__isl_take MULTI(BASE) *multi,
1166
  __isl_take isl_val *v)
1167
0
{
1168
0
  int i;
1169
0
1170
0
  if (
!multi || 0
!v0
)
1171
0
    goto error;
1172
0
1173
0
  
if (0
isl_val_is_one(v)0
)
{0
1174
0
    isl_val_free(v);
1175
0
    return multi;
1176
0
  }
1177
0
1178
0
  
if (0
!isl_val_is_rat(v)0
)
1179
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
1180
0
      "expecting rational factor", goto error);
1181
0
1182
0
  
multi = 0
FN0
(MULTI(BASE),cow)(multi);
1183
0
  if (!multi)
1184
0
    return NULL;
1185
0
1186
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
1187
0
    multi->p[i] = FN(EL,scale_val)(multi->p[i], isl_val_copy(v));
1188
0
    if (!multi->p[i])
1189
0
      goto error;
1190
0
  }
1191
0
1192
0
  isl_val_free(v);
1193
0
  return multi;
1194
0
error:
1195
0
  isl_val_free(v);
1196
0
  return FN(MULTI(BASE),free)(multi);
1197
0
}
Unexecuted instantiation: isl_multi_aff_scale_val
Unexecuted instantiation: isl_multi_val_scale_val
Unexecuted instantiation: isl_multi_union_pw_aff_scale_val
Unexecuted instantiation: isl_multi_pw_aff_scale_val
1198
1199
/* Divide the elements of "multi" by "v" and return the result.
1200
 */
1201
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_down_val)(
1202
  __isl_take MULTI(BASE) *multi, __isl_take isl_val *v)
1203
0
{
1204
0
  int i;
1205
0
1206
0
  if (
!multi || 0
!v0
)
1207
0
    goto error;
1208
0
1209
0
  
if (0
isl_val_is_one(v)0
)
{0
1210
0
    isl_val_free(v);
1211
0
    return multi;
1212
0
  }
1213
0
1214
0
  
if (0
!isl_val_is_rat(v)0
)
1215
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
1216
0
      "expecting rational factor", goto error);
1217
0
  
if (0
isl_val_is_zero(v)0
)
1218
0
    isl_die(isl_val_get_ctx(v), isl_error_invalid,
1219
0
      "cannot scale down by zero", goto error);
1220
0
1221
0
  
multi = 0
FN0
(MULTI(BASE),cow)(multi);
1222
0
  if (!multi)
1223
0
    return NULL;
1224
0
1225
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
1226
0
    multi->p[i] = FN(EL,scale_down_val)(multi->p[i],
1227
0
                isl_val_copy(v));
1228
0
    if (!multi->p[i])
1229
0
      goto error;
1230
0
  }
1231
0
1232
0
  isl_val_free(v);
1233
0
  return multi;
1234
0
error:
1235
0
  isl_val_free(v);
1236
0
  return FN(MULTI(BASE),free)(multi);
1237
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_scale_down_val
Unexecuted instantiation: isl_multi_aff_scale_down_val
Unexecuted instantiation: isl_multi_val_scale_down_val
Unexecuted instantiation: isl_multi_pw_aff_scale_down_val
1238
1239
/* Multiply the elements of "multi" by the corresponding element of "mv"
1240
 * and return the result.
1241
 */
1242
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_multi_val)(
1243
  __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
1244
73
{
1245
73
  int i;
1246
73
1247
73
  if (
!multi || 73
!mv73
)
1248
0
    goto error;
1249
73
1250
73
  
if (73
!isl_space_tuple_is_equal(multi->space, isl_dim_out,73
1251
73
          mv->space, isl_dim_set))
1252
0
    isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid,
1253
73
      "spaces don't match", goto error);
1254
73
1255
73
  
multi = 73
FN73
(MULTI(BASE),cow)(multi);
1256
73
  if (!multi)
1257
0
    goto error;
1258
73
1259
236
  
for (i = 0; 73
i < multi->n236
;
++i163
)
{163
1260
163
    isl_val *v;
1261
163
1262
163
    v = isl_multi_val_get_val(mv, i);
1263
163
    multi->p[i] = FN(EL,scale_val)(multi->p[i], v);
1264
163
    if (!multi->p[i])
1265
0
      goto error;
1266
163
  }
1267
73
1268
73
  isl_multi_val_free(mv);
1269
73
  return multi;
1270
73
error:
1271
0
  isl_multi_val_free(mv);
1272
0
  return FN(MULTI(BASE),free)(multi);
1273
73
}
isl_multi_union_pw_aff_scale_multi_val
Line
Count
Source
1244
73
{
1245
73
  int i;
1246
73
1247
73
  if (
!multi || 73
!mv73
)
1248
0
    goto error;
1249
73
1250
73
  
if (73
!isl_space_tuple_is_equal(multi->space, isl_dim_out,73
1251
73
          mv->space, isl_dim_set))
1252
0
    isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid,
1253
73
      "spaces don't match", goto error);
1254
73
1255
73
  
multi = 73
FN73
(MULTI(BASE),cow)(multi);
1256
73
  if (!multi)
1257
0
    goto error;
1258
73
1259
236
  
for (i = 0; 73
i < multi->n236
;
++i163
)
{163
1260
163
    isl_val *v;
1261
163
1262
163
    v = isl_multi_val_get_val(mv, i);
1263
163
    multi->p[i] = FN(EL,scale_val)(multi->p[i], v);
1264
163
    if (!multi->p[i])
1265
0
      goto error;
1266
163
  }
1267
73
1268
73
  isl_multi_val_free(mv);
1269
73
  return multi;
1270
73
error:
1271
0
  isl_multi_val_free(mv);
1272
0
  return FN(MULTI(BASE),free)(multi);
1273
73
}
Unexecuted instantiation: isl_multi_aff_scale_multi_val
Unexecuted instantiation: isl_multi_pw_aff_scale_multi_val
Unexecuted instantiation: isl_multi_val_scale_multi_val
1274
1275
/* Divide the elements of "multi" by the corresponding element of "mv"
1276
 * and return the result.
1277
 */
1278
__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_down_multi_val)(
1279
  __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
1280
0
{
1281
0
  int i;
1282
0
1283
0
  if (
!multi || 0
!mv0
)
1284
0
    goto error;
1285
0
1286
0
  
if (0
!isl_space_tuple_is_equal(multi->space, isl_dim_out,0
1287
0
          mv->space, isl_dim_set))
1288
0
    isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid,
1289
0
      "spaces don't match", goto error);
1290
0
1291
0
  
multi = 0
FN0
(MULTI(BASE),cow)(multi);
1292
0
  if (!multi)
1293
0
    return NULL;
1294
0
1295
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
1296
0
    isl_val *v;
1297
0
1298
0
    v = isl_multi_val_get_val(mv, i);
1299
0
    multi->p[i] = FN(EL,scale_down_val)(multi->p[i], v);
1300
0
    if (!multi->p[i])
1301
0
      goto error;
1302
0
  }
1303
0
1304
0
  isl_multi_val_free(mv);
1305
0
  return multi;
1306
0
error:
1307
0
  isl_multi_val_free(mv);
1308
0
  return FN(MULTI(BASE),free)(multi);
1309
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_scale_down_multi_val
Unexecuted instantiation: isl_multi_aff_scale_down_multi_val
Unexecuted instantiation: isl_multi_val_scale_down_multi_val
Unexecuted instantiation: isl_multi_pw_aff_scale_down_multi_val
1310
1311
/* Compute the residues of the elements of "multi" modulo
1312
 * the corresponding element of "mv" and return the result.
1313
 */
1314
__isl_give MULTI(BASE) *FN(MULTI(BASE),mod_multi_val)(
1315
  __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv)
1316
0
{
1317
0
  int i;
1318
0
1319
0
  if (
!multi || 0
!mv0
)
1320
0
    goto error;
1321
0
1322
0
  
if (0
!isl_space_tuple_is_equal(multi->space, isl_dim_out,0
1323
0
          mv->space, isl_dim_set))
1324
0
    isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid,
1325
0
      "spaces don't match", goto error);
1326
0
1327
0
  
multi = 0
FN0
(MULTI(BASE),cow)(multi);
1328
0
  if (!multi)
1329
0
    return NULL;
1330
0
1331
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
1332
0
    isl_val *v;
1333
0
1334
0
    v = isl_multi_val_get_val(mv, i);
1335
0
    multi->p[i] = FN(EL,mod_val)(multi->p[i], v);
1336
0
    if (!multi->p[i])
1337
0
      goto error;
1338
0
  }
1339
0
1340
0
  isl_multi_val_free(mv);
1341
0
  return multi;
1342
0
error:
1343
0
  isl_multi_val_free(mv);
1344
0
  return FN(MULTI(BASE),free)(multi);
1345
0
}
Unexecuted instantiation: isl_multi_union_pw_aff_mod_multi_val
Unexecuted instantiation: isl_multi_val_mod_multi_val
Unexecuted instantiation: isl_multi_pw_aff_mod_multi_val
Unexecuted instantiation: isl_multi_aff_mod_multi_val
1346
1347
#ifndef NO_MOVE_DIMS
1348
/* Move the "n" dimensions of "src_type" starting at "src_pos" of "multi"
1349
 * to dimensions of "dst_type" at "dst_pos".
1350
 *
1351
 * We only support moving input dimensions to parameters and vice versa.
1352
 */
1353
__isl_give MULTI(BASE) *FN(MULTI(BASE),move_dims)(__isl_take MULTI(BASE) *multi,
1354
  enum isl_dim_type dst_type, unsigned dst_pos,
1355
  enum isl_dim_type src_type, unsigned src_pos, unsigned n)
1356
0
{
1357
0
  int i;
1358
0
1359
0
  if (!multi)
1360
0
    return NULL;
1361
0
1362
0
  
if (0
n == 0 &&0
1363
0
      !isl_space_is_named_or_nested(multi->space, src_type) &&
1364
0
      !isl_space_is_named_or_nested(multi->space, dst_type))
1365
0
    return multi;
1366
0
1367
0
  
if (0
dst_type == isl_dim_out || 0
src_type == isl_dim_out0
)
1368
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1369
0
      "cannot move output/set dimension",
1370
0
      return FN(MULTI(BASE),free)(multi));
1371
0
  
if (0
dst_type == isl_dim_div || 0
src_type == isl_dim_div0
)
1372
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1373
0
      "cannot move divs",
1374
0
      return FN(MULTI(BASE),free)(multi));
1375
0
  
if (0
src_pos + n > isl_space_dim(multi->space, src_type)0
)
1376
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1377
0
      "range out of bounds",
1378
0
      return FN(MULTI(BASE),free)(multi));
1379
0
  
if (0
dst_type == src_type0
)
1380
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_unsupported,
1381
0
      "moving dims within the same type not supported",
1382
0
      return FN(MULTI(BASE),free)(multi));
1383
0
1384
0
  
multi = 0
FN0
(MULTI(BASE),cow)(multi);
1385
0
  if (!multi)
1386
0
    return NULL;
1387
0
1388
0
  multi->space = isl_space_move_dims(multi->space, dst_type, dst_pos,
1389
0
            src_type, src_pos, n);
1390
0
  if (!multi->space)
1391
0
    
return 0
FN0
(MULTI(BASE),free)(multi);
1392
0
1393
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
1394
0
    multi->p[i] = FN(EL,move_dims)(multi->p[i], dst_type, dst_pos,
1395
0
            src_type, src_pos, n);
1396
0
    if (!multi->p[i])
1397
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
1398
0
  }
1399
0
1400
0
  return multi;
1401
0
}
Unexecuted instantiation: isl_multi_pw_aff_move_dims
Unexecuted instantiation: isl_multi_aff_move_dims
1402
#endif
1403
1404
/* Convert a multiple expression defined over a parameter domain
1405
 * into one that is defined over a zero-dimensional set.
1406
 */
1407
__isl_give MULTI(BASE) *FN(MULTI(BASE),from_range)(
1408
  __isl_take MULTI(BASE) *multi)
1409
0
{
1410
0
  isl_space *space;
1411
0
1412
0
  if (!multi)
1413
0
    return NULL;
1414
0
  
if (0
!isl_space_is_set(multi->space)0
)
1415
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
1416
0
      "not living in a set space",
1417
0
      return FN(MULTI(BASE),free)(multi));
1418
0
1419
0
  
space = 0
FN0
(MULTI(BASE),get_space)(multi);
1420
0
  space = isl_space_from_range(space);
1421
0
  multi = FN(MULTI(BASE),reset_space)(multi, space);
1422
0
1423
0
  return multi;
1424
0
}
Unexecuted instantiation: isl_multi_aff_from_range
Unexecuted instantiation: isl_multi_pw_aff_from_range
Unexecuted instantiation: isl_multi_val_from_range
Unexecuted instantiation: isl_multi_union_pw_aff_from_range
1425
1426
/* Are "multi1" and "multi2" obviously equal?
1427
 */
1428
isl_bool FN(MULTI(BASE),plain_is_equal)(__isl_keep MULTI(BASE) *multi1,
1429
  __isl_keep MULTI(BASE) *multi2)
1430
1.26k
{
1431
1.26k
  int i;
1432
1.26k
  isl_bool equal;
1433
1.26k
1434
1.26k
  if (
!multi1 || 1.26k
!multi21.26k
)
1435
0
    return isl_bool_error;
1436
1.26k
  
if (1.26k
multi1->n != multi2->n1.26k
)
1437
0
    return isl_bool_false;
1438
1.26k
  equal = isl_space_is_equal(multi1->space, multi2->space);
1439
1.26k
  if (
equal < 0 || 1.26k
!equal1.26k
)
1440
0
    return equal;
1441
1.26k
1442
1.54k
  
for (i = 0; 1.26k
i < multi1->n1.54k
;
++i284
)
{1.42k
1443
1.42k
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1444
1.42k
    if (
equal < 0 || 1.42k
!equal1.42k
)
1445
1.13k
      return equal;
1446
1.42k
  }
1447
1.26k
1448
126
  return isl_bool_true;
1449
1.26k
}
isl_multi_union_pw_aff_plain_is_equal
Line
Count
Source
1430
8
{
1431
8
  int i;
1432
8
  isl_bool equal;
1433
8
1434
8
  if (
!multi1 || 8
!multi28
)
1435
0
    return isl_bool_error;
1436
8
  
if (8
multi1->n != multi2->n8
)
1437
0
    return isl_bool_false;
1438
8
  equal = isl_space_is_equal(multi1->space, multi2->space);
1439
8
  if (
equal < 0 || 8
!equal8
)
1440
0
    return equal;
1441
8
1442
24
  
for (i = 0; 8
i < multi1->n24
;
++i16
)
{16
1443
16
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1444
16
    if (
equal < 0 || 16
!equal16
)
1445
0
      return equal;
1446
16
  }
1447
8
1448
8
  return isl_bool_true;
1449
8
}
isl_multi_aff_plain_is_equal
Line
Count
Source
1430
1.25k
{
1431
1.25k
  int i;
1432
1.25k
  isl_bool equal;
1433
1.25k
1434
1.25k
  if (
!multi1 || 1.25k
!multi21.25k
)
1435
0
    return isl_bool_error;
1436
1.25k
  
if (1.25k
multi1->n != multi2->n1.25k
)
1437
0
    return isl_bool_false;
1438
1.25k
  equal = isl_space_is_equal(multi1->space, multi2->space);
1439
1.25k
  if (
equal < 0 || 1.25k
!equal1.25k
)
1440
0
    return equal;
1441
1.25k
1442
1.51k
  
for (i = 0; 1.25k
i < multi1->n1.51k
;
++i266
)
{1.40k
1443
1.40k
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1444
1.40k
    if (
equal < 0 || 1.40k
!equal1.40k
)
1445
1.13k
      return equal;
1446
1.40k
  }
1447
1.25k
1448
117
  return isl_bool_true;
1449
1.25k
}
isl_multi_pw_aff_plain_is_equal
Line
Count
Source
1430
1
{
1431
1
  int i;
1432
1
  isl_bool equal;
1433
1
1434
1
  if (
!multi1 || 1
!multi21
)
1435
0
    return isl_bool_error;
1436
1
  
if (1
multi1->n != multi2->n1
)
1437
0
    return isl_bool_false;
1438
1
  equal = isl_space_is_equal(multi1->space, multi2->space);
1439
1
  if (
equal < 0 || 1
!equal1
)
1440
0
    return equal;
1441
1
1442
3
  
for (i = 0; 1
i < multi1->n3
;
++i2
)
{2
1443
2
    equal = FN(EL,plain_is_equal)(multi1->p[i], multi2->p[i]);
1444
2
    if (
equal < 0 || 2
!equal2
)
1445
0
      return equal;
1446
2
  }
1447
1
1448
1
  return isl_bool_true;
1449
1
}
Unexecuted instantiation: isl_multi_val_plain_is_equal
1450
1451
/* Does "multi" involve any NaNs?
1452
 */
1453
isl_bool FN(MULTI(BASE),involves_nan)(__isl_keep MULTI(BASE) *multi)
1454
980
{
1455
980
  int i;
1456
980
1457
980
  if (!multi)
1458
0
    return isl_bool_error;
1459
980
  
if (980
multi->n == 0980
)
1460
0
    return isl_bool_false;
1461
980
1462
2.85k
  
for (i = 0; 980
i < multi->n2.85k
;
++i1.87k
)
{1.88k
1463
1.88k
    isl_bool has_nan = FN(EL,involves_nan)(multi->p[i]);
1464
1.88k
    if (
has_nan < 0 || 1.88k
has_nan1.88k
)
1465
2
      return has_nan;
1466
1.88k
  }
1467
980
1468
978
  return isl_bool_false;
1469
980
}
Unexecuted instantiation: isl_multi_union_pw_aff_involves_nan
Unexecuted instantiation: isl_multi_val_involves_nan
Unexecuted instantiation: isl_multi_pw_aff_involves_nan
isl_multi_aff_involves_nan
Line
Count
Source
1454
980
{
1455
980
  int i;
1456
980
1457
980
  if (!multi)
1458
0
    return isl_bool_error;
1459
980
  
if (980
multi->n == 0980
)
1460
0
    return isl_bool_false;
1461
980
1462
2.85k
  
for (i = 0; 980
i < multi->n2.85k
;
++i1.87k
)
{1.88k
1463
1.88k
    isl_bool has_nan = FN(EL,involves_nan)(multi->p[i]);
1464
1.88k
    if (
has_nan < 0 || 1.88k
has_nan1.88k
)
1465
2
      return has_nan;
1466
1.88k
  }
1467
980
1468
978
  return isl_bool_false;
1469
980
}
1470
1471
#ifndef NO_DOMAIN
1472
/* Return the shared domain of the elements of "multi".
1473
 */
1474
__isl_give isl_set *FN(MULTI(BASE),domain)(__isl_take MULTI(BASE) *multi)
1475
0
{
1476
0
  int i;
1477
0
  isl_set *dom;
1478
0
1479
0
  if (!multi)
1480
0
    return NULL;
1481
0
1482
0
  
dom = isl_set_universe(0
FN0
(MULTI(BASE),get_domain_space)(multi));
1483
0
  for (i = 0; 
i < multi->n0
;
++i0
)
{0
1484
0
    isl_set *dom_i;
1485
0
1486
0
    dom_i = 
FN0
(EL,domain)(
FN0
(FN(MULTI(BASE),get),BASE)(multi, i));
1487
0
    dom = isl_set_intersect(dom, dom_i);
1488
0
  }
1489
0
1490
0
  FN(MULTI(BASE),free)(multi);
1491
0
  return dom;
1492
0
}
1493
#endif
1494
1495
#ifndef NO_NEG
1496
/* Return the opposite of "multi".
1497
 */
1498
__isl_give MULTI(BASE) *FN(MULTI(BASE),neg)(__isl_take MULTI(BASE) *multi)
1499
0
{
1500
0
  int i;
1501
0
1502
0
  multi = FN(MULTI(BASE),cow)(multi);
1503
0
  if (!multi)
1504
0
    return NULL;
1505
0
1506
0
  
for (i = 0; 0
i < multi->n0
;
++i0
)
{0
1507
0
    multi->p[i] = FN(EL,neg)(multi->p[i]);
1508
0
    if (!multi->p[i])
1509
0
      
return 0
FN0
(MULTI(BASE),free)(multi);
1510
0
  }
1511
0
1512
0
  return multi;
1513
0
}
Unexecuted instantiation: isl_multi_pw_aff_neg
Unexecuted instantiation: isl_multi_aff_neg
Unexecuted instantiation: isl_multi_union_pw_aff_neg
Unexecuted instantiation: isl_multi_val_neg
1514
#endif