Coverage Report

Created: 2018-04-24 22:41

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