Coverage Report

Created: 2018-10-23 03:11

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