Coverage Report

Created: 2019-04-21 11:35

/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
35.3k
{
25
35.3k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
26
35.3k
}
isl_multi_aff_get_ctx
Line
Count
Source
24
10.4k
{
25
10.4k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
26
10.4k
}
isl_multi_pw_aff_get_ctx
Line
Count
Source
24
13.4k
{
25
13.4k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
26
13.4k
}
isl_multi_union_pw_aff_get_ctx
Line
Count
Source
24
8.19k
{
25
8.19k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
26
8.19k
}
isl_multi_val_get_ctx
Line
Count
Source
24
3.26k
{
25
3.26k
  return multi ? isl_space_get_ctx(multi->space) : NULL;
26
3.26k
}
27
28
/* Return the space of "multi".
29
 */
30
__isl_keep isl_space *FN(MULTI(BASE),peek_space)(__isl_keep MULTI(BASE) *multi)
31
605k
{
32
605k
  return multi ? multi->space : NULL;
33
605k
}
isl_multi_aff_peek_space
Line
Count
Source
31
558k
{
32
558k
  return multi ? multi->space : NULL;
33
558k
}
isl_multi_pw_aff_peek_space
Line
Count
Source
31
20.3k
{
32
20.3k
  return multi ? multi->space : NULL;
33
20.3k
}
isl_multi_union_pw_aff_peek_space
Line
Count
Source
31
13.5k
{
32
13.5k
  return multi ? multi->space : NULL;
33
13.5k
}
isl_multi_val_peek_space
Line
Count
Source
31
13.2k
{
32
13.2k
  return multi ? multi->space : NULL;
33
13.2k
}
34
35
__isl_give isl_space *FN(MULTI(BASE),get_space)(__isl_keep MULTI(BASE) *multi)
36
343k
{
37
343k
  return isl_space_copy(FN(MULTI(BASE),peek_space)(multi));
38
343k
}
isl_multi_aff_get_space
Line
Count
Source
36
314k
{
37
314k
  return isl_space_copy(FN(MULTI(BASE),peek_space)(multi));
38
314k
}
isl_multi_pw_aff_get_space
Line
Count
Source
36
11.1k
{
37
11.1k
  return isl_space_copy(FN(MULTI(BASE),peek_space)(multi));
38
11.1k
}
isl_multi_union_pw_aff_get_space
Line
Count
Source
36
9.99k
{
37
9.99k
  return isl_space_copy(FN(MULTI(BASE),peek_space)(multi));
38
9.99k
}
isl_multi_val_get_space
Line
Count
Source
36
7.85k
{
37
7.85k
  return isl_space_copy(FN(MULTI(BASE),peek_space)(multi));
38
7.85k
}
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
24.1k
{
55
24.1k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
56
24.1k
}
isl_multi_aff_get_domain_space
Line
Count
Source
54
21.9k
{
55
21.9k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
56
21.9k
}
isl_multi_pw_aff_get_domain_space
Line
Count
Source
54
892
{
55
892
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
56
892
}
isl_multi_union_pw_aff_get_domain_space
Line
Count
Source
54
84
{
55
84
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
56
84
}
isl_multi_val_get_domain_space
Line
Count
Source
54
1.13k
{
55
1.13k
  return multi ? isl_space_domain(isl_space_copy(multi->space)) : NULL;
56
1.13k
}
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
58.3k
{
66
58.3k
  isl_ctx *ctx;
67
58.3k
  int n;
68
58.3k
  MULTI(BASE) *multi;
69
58.3k
70
58.3k
  if (!space)
71
0
    return NULL;
72
58.3k
73
58.3k
  ctx = isl_space_get_ctx(space);
74
58.3k
  n = isl_space_dim(space, isl_dim_out);
75
58.3k
  if (n > 0)
76
55.0k
    multi = isl_calloc(ctx, MULTI(BASE),
77
58.3k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
78
58.3k
  else
79
58.3k
    
multi = 3.22k
isl_calloc3.22k
(ctx, MULTI(BASE), sizeof(MULTI(BASE)));
80
58.3k
  if (!multi)
81
0
    goto error;
82
58.3k
83
58.3k
  multi->space = space;
84
58.3k
  multi->n = n;
85
58.3k
  multi->ref = 1;
86
58.3k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
87
2.00k
    multi = FN(MULTI(BASE),init_explicit_domain)(multi);
88
58.3k
  return multi;
89
58.3k
error:
90
0
  isl_space_free(space);
91
0
  return NULL;
92
58.3k
}
isl_multi_aff_alloc
Line
Count
Source
65
45.6k
{
66
45.6k
  isl_ctx *ctx;
67
45.6k
  int n;
68
45.6k
  MULTI(BASE) *multi;
69
45.6k
70
45.6k
  if (!space)
71
0
    return NULL;
72
45.6k
73
45.6k
  ctx = isl_space_get_ctx(space);
74
45.6k
  n = isl_space_dim(space, isl_dim_out);
75
45.6k
  if (n > 0)
76
44.5k
    multi = isl_calloc(ctx, MULTI(BASE),
77
45.6k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
78
45.6k
  else
79
45.6k
    
multi = 1.17k
isl_calloc1.17k
(ctx, MULTI(BASE), sizeof(MULTI(BASE)));
80
45.6k
  if (!multi)
81
0
    goto error;
82
45.6k
83
45.6k
  multi->space = space;
84
45.6k
  multi->n = n;
85
45.6k
  multi->ref = 1;
86
45.6k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
87
0
    multi = FN(MULTI(BASE),init_explicit_domain)(multi);
88
45.6k
  return multi;
89
45.6k
error:
90
0
  isl_space_free(space);
91
0
  return NULL;
92
45.6k
}
isl_multi_pw_aff_alloc
Line
Count
Source
65
6.09k
{
66
6.09k
  isl_ctx *ctx;
67
6.09k
  int n;
68
6.09k
  MULTI(BASE) *multi;
69
6.09k
70
6.09k
  if (!space)
71
0
    return NULL;
72
6.09k
73
6.09k
  ctx = isl_space_get_ctx(space);
74
6.09k
  n = isl_space_dim(space, isl_dim_out);
75
6.09k
  if (n > 0)
76
5.45k
    multi = isl_calloc(ctx, MULTI(BASE),
77
6.09k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
78
6.09k
  else
79
6.09k
    
multi = 642
isl_calloc642
(ctx, MULTI(BASE), sizeof(MULTI(BASE)));
80
6.09k
  if (!multi)
81
0
    goto error;
82
6.09k
83
6.09k
  multi->space = space;
84
6.09k
  multi->n = n;
85
6.09k
  multi->ref = 1;
86
6.09k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
87
642
    multi = FN(MULTI(BASE),init_explicit_domain)(multi);
88
6.09k
  return multi;
89
6.09k
error:
90
0
  isl_space_free(space);
91
0
  return NULL;
92
6.09k
}
isl_multi_union_pw_aff_alloc
Line
Count
Source
65
3.94k
{
66
3.94k
  isl_ctx *ctx;
67
3.94k
  int n;
68
3.94k
  MULTI(BASE) *multi;
69
3.94k
70
3.94k
  if (!space)
71
0
    return NULL;
72
3.94k
73
3.94k
  ctx = isl_space_get_ctx(space);
74
3.94k
  n = isl_space_dim(space, isl_dim_out);
75
3.94k
  if (n > 0)
76
2.58k
    multi = isl_calloc(ctx, MULTI(BASE),
77
3.94k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
78
3.94k
  else
79
3.94k
    
multi = 1.35k
isl_calloc1.35k
(ctx, MULTI(BASE), sizeof(MULTI(BASE)));
80
3.94k
  if (!multi)
81
0
    goto error;
82
3.94k
83
3.94k
  multi->space = space;
84
3.94k
  multi->n = n;
85
3.94k
  multi->ref = 1;
86
3.94k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
87
1.35k
    multi = FN(MULTI(BASE),init_explicit_domain)(multi);
88
3.94k
  return multi;
89
3.94k
error:
90
0
  isl_space_free(space);
91
0
  return NULL;
92
3.94k
}
isl_multi_val_alloc
Line
Count
Source
65
2.57k
{
66
2.57k
  isl_ctx *ctx;
67
2.57k
  int n;
68
2.57k
  MULTI(BASE) *multi;
69
2.57k
70
2.57k
  if (!space)
71
0
    return NULL;
72
2.57k
73
2.57k
  ctx = isl_space_get_ctx(space);
74
2.57k
  n = isl_space_dim(space, isl_dim_out);
75
2.57k
  if (n > 0)
76
2.51k
    multi = isl_calloc(ctx, MULTI(BASE),
77
2.57k
       sizeof(MULTI(BASE)) + (n - 1) * sizeof(struct EL *));
78
2.57k
  else
79
2.57k
    
multi = 56
isl_calloc56
(ctx, MULTI(BASE), sizeof(MULTI(BASE)));
80
2.57k
  if (!multi)
81
0
    goto error;
82
2.57k
83
2.57k
  multi->space = space;
84
2.57k
  multi->n = n;
85
2.57k
  multi->ref = 1;
86
2.57k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
87
0
    multi = FN(MULTI(BASE),init_explicit_domain)(multi);
88
2.57k
  return multi;
89
2.57k
error:
90
0
  isl_space_free(space);
91
0
  return NULL;
92
2.57k
}
93
94
__isl_give MULTI(BASE) *FN(MULTI(BASE),dup)(__isl_keep MULTI(BASE) *multi)
95
35.8k
{
96
35.8k
  int i;
97
35.8k
  MULTI(BASE) *dup;
98
35.8k
99
35.8k
  if (!multi)
100
0
    return NULL;
101
35.8k
102
35.8k
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
103
35.8k
  if (!dup)
104
0
    return NULL;
105
35.8k
106
255k
  
for (i = 0; 35.8k
i < multi->n;
++i219k
)
107
219k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
108
219k
                FN(EL,copy)(multi->u.p[i]));
109
35.8k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
110
1
    dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi);
111
35.8k
112
35.8k
  return dup;
113
35.8k
}
isl_multi_aff_dup
Line
Count
Source
95
33.7k
{
96
33.7k
  int i;
97
33.7k
  MULTI(BASE) *dup;
98
33.7k
99
33.7k
  if (!multi)
100
0
    return NULL;
101
33.7k
102
33.7k
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
103
33.7k
  if (!dup)
104
0
    return NULL;
105
33.7k
106
251k
  
for (i = 0; 33.7k
i < multi->n;
++i217k
)
107
217k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
108
217k
                FN(EL,copy)(multi->u.p[i]));
109
33.7k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
110
0
    dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi);
111
33.7k
112
33.7k
  return dup;
113
33.7k
}
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
928
{
96
928
  int i;
97
928
  MULTI(BASE) *dup;
98
928
99
928
  if (!multi)
100
0
    return NULL;
101
928
102
928
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
103
928
  if (!dup)
104
0
    return NULL;
105
928
106
2.11k
  
for (i = 0; 928
i < multi->n;
++i1.18k
)
107
1.18k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
108
1.18k
                FN(EL,copy)(multi->u.p[i]));
109
928
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
110
0
    dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi);
111
928
112
928
  return dup;
113
928
}
isl_multi_val_dup
Line
Count
Source
95
1.17k
{
96
1.17k
  int i;
97
1.17k
  MULTI(BASE) *dup;
98
1.17k
99
1.17k
  if (!multi)
100
0
    return NULL;
101
1.17k
102
1.17k
  dup = FN(MULTI(BASE),alloc)(isl_space_copy(multi->space));
103
1.17k
  if (!dup)
104
0
    return NULL;
105
1.17k
106
2.41k
  
for (i = 0; 1.17k
i < multi->n;
++i1.24k
)
107
1.24k
    dup = FN(FN(MULTI(BASE),set),BASE)(dup, i,
108
1.24k
                FN(EL,copy)(multi->u.p[i]));
109
1.17k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
110
0
    dup = FN(MULTI(BASE),copy_explicit_domain)(dup, multi);
111
1.17k
112
1.17k
  return dup;
113
1.17k
}
114
115
__isl_give MULTI(BASE) *FN(MULTI(BASE),cow)(__isl_take MULTI(BASE) *multi)
116
310k
{
117
310k
  if (!multi)
118
0
    return NULL;
119
310k
120
310k
  if (multi->ref == 1)
121
275k
    return multi;
122
35.8k
123
35.8k
  multi->ref--;
124
35.8k
  return FN(MULTI(BASE),dup)(multi);
125
35.8k
}
isl_multi_aff_cow
Line
Count
Source
116
280k
{
117
280k
  if (!multi)
118
0
    return NULL;
119
280k
120
280k
  if (multi->ref == 1)
121
246k
    return multi;
122
33.7k
123
33.7k
  multi->ref--;
124
33.7k
  return FN(MULTI(BASE),dup)(multi);
125
33.7k
}
isl_multi_pw_aff_cow
Line
Count
Source
116
16.3k
{
117
16.3k
  if (!multi)
118
0
    return NULL;
119
16.3k
120
16.3k
  if (multi->ref == 1)
121
16.3k
    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
6.25k
{
117
6.25k
  if (!multi)
118
0
    return NULL;
119
6.25k
120
6.25k
  if (multi->ref == 1)
121
5.32k
    return multi;
122
928
123
928
  multi->ref--;
124
928
  return FN(MULTI(BASE),dup)(multi);
125
928
}
isl_multi_val_cow
Line
Count
Source
116
7.66k
{
117
7.66k
  if (!multi)
118
0
    return NULL;
119
7.66k
120
7.66k
  if (multi->ref == 1)
121
6.48k
    return multi;
122
1.17k
123
1.17k
  multi->ref--;
124
1.17k
  return FN(MULTI(BASE),dup)(multi);
125
1.17k
}
126
127
__isl_give MULTI(BASE) *FN(MULTI(BASE),copy)(__isl_keep MULTI(BASE) *multi)
128
79.6k
{
129
79.6k
  if (!multi)
130
410
    return NULL;
131
79.2k
132
79.2k
  multi->ref++;
133
79.2k
  return multi;
134
79.2k
}
isl_multi_aff_copy
Line
Count
Source
128
69.3k
{
129
69.3k
  if (!multi)
130
410
    return NULL;
131
68.8k
132
68.8k
  multi->ref++;
133
68.8k
  return multi;
134
68.8k
}
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
5.66k
{
129
5.66k
  if (!multi)
130
0
    return NULL;
131
5.66k
132
5.66k
  multi->ref++;
133
5.66k
  return multi;
134
5.66k
}
isl_multi_val_copy
Line
Count
Source
128
4.61k
{
129
4.61k
  if (!multi)
130
0
    return NULL;
131
4.61k
132
4.61k
  multi->ref++;
133
4.61k
  return multi;
134
4.61k
}
135
136
__isl_null MULTI(BASE) *FN(MULTI(BASE),free)(__isl_take MULTI(BASE) *multi)
137
114k
{
138
114k
  int i;
139
114k
140
114k
  if (!multi)
141
12.3k
    return NULL;
142
101k
143
101k
  if (--multi->ref > 0)
144
43.3k
    return NULL;
145
58.2k
146
58.2k
  isl_space_free(multi->space);
147
313k
  for (i = 0; i < multi->n; 
++i255k
)
148
255k
    FN(EL,free)(multi->u.p[i]);
149
58.2k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
150
58.2k
    
FN2.00k
(MULTI(BASE),free_explicit_domain)(multi)2.00k
;
151
58.2k
  free(multi);
152
58.2k
153
58.2k
  return NULL;
154
58.2k
}
isl_multi_aff_free
Line
Count
Source
137
93.2k
{
138
93.2k
  int i;
139
93.2k
140
93.2k
  if (!multi)
141
12.3k
    return NULL;
142
80.8k
143
80.8k
  if (--multi->ref > 0)
144
35.1k
    return NULL;
145
45.6k
146
45.6k
  isl_space_free(multi->space);
147
284k
  for (i = 0; i < multi->n; 
++i239k
)
148
239k
    FN(EL,free)(multi->u.p[i]);
149
45.6k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
150
45.6k
    
FN0
(MULTI(BASE),free_explicit_domain)(multi)0
;
151
45.6k
  free(multi);
152
45.6k
153
45.6k
  return NULL;
154
45.6k
}
isl_multi_pw_aff_free
Line
Count
Source
137
6.11k
{
138
6.11k
  int i;
139
6.11k
140
6.11k
  if (!multi)
141
0
    return NULL;
142
6.11k
143
6.11k
  if (--multi->ref > 0)
144
16
    return NULL;
145
6.09k
146
6.09k
  isl_space_free(multi->space);
147
15.2k
  for (i = 0; i < multi->n; 
++i9.16k
)
148
9.16k
    FN(EL,free)(multi->u.p[i]);
149
6.09k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
150
6.09k
    
FN644
(MULTI(BASE),free_explicit_domain)(multi)644
;
151
6.09k
  free(multi);
152
6.09k
153
6.09k
  return NULL;
154
6.09k
}
isl_multi_union_pw_aff_free
Line
Count
Source
137
8.67k
{
138
8.67k
  int i;
139
8.67k
140
8.67k
  if (!multi)
141
0
    return NULL;
142
8.67k
143
8.67k
  if (--multi->ref > 0)
144
4.74k
    return NULL;
145
3.93k
146
3.93k
  isl_space_free(multi->space);
147
7.31k
  for (i = 0; i < multi->n; 
++i3.38k
)
148
3.93k
    
FN3.38k
(EL,free)(multi->u.p[i])3.38k
;
149
3.93k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
150
3.93k
    
FN1.35k
(MULTI(BASE),free_explicit_domain)(multi)1.35k
;
151
3.93k
  free(multi);
152
3.93k
153
3.93k
  return NULL;
154
3.93k
}
isl_multi_val_free
Line
Count
Source
137
6.02k
{
138
6.02k
  int i;
139
6.02k
140
6.02k
  if (!multi)
141
4
    return NULL;
142
6.01k
143
6.01k
  if (--multi->ref > 0)
144
3.44k
    return NULL;
145
2.57k
146
2.57k
  isl_space_free(multi->space);
147
5.76k
  for (i = 0; i < multi->n; 
++i3.18k
)
148
3.18k
    FN(EL,free)(multi->u.p[i]);
149
2.57k
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
150
2.57k
    
FN0
(MULTI(BASE),free_explicit_domain)(multi)0
;
151
2.57k
  free(multi);
152
2.57k
153
2.57k
  return NULL;
154
2.57k
}
155
156
unsigned FN(MULTI(BASE),dim)(__isl_keep MULTI(BASE) *multi,
157
  enum isl_dim_type type)
158
350k
{
159
350k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
160
350k
}
isl_multi_aff_dim
Line
Count
Source
158
333k
{
159
333k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
160
333k
}
isl_multi_pw_aff_dim
Line
Count
Source
158
6.71k
{
159
6.71k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
160
6.71k
}
isl_multi_union_pw_aff_dim
Line
Count
Source
158
7.69k
{
159
7.69k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
160
7.69k
}
isl_multi_val_dim
Line
Count
Source
158
2.85k
{
159
2.85k
  return multi ? isl_space_dim(multi->space, type) : 
00
;
160
2.85k
}
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
1.47k
{
218
1.47k
  if (!multi)
219
0
    return isl_bool_error;
220
1.47k
  return isl_space_has_tuple_id(multi->space, type);
221
1.47k
}
Unexecuted instantiation: isl_multi_aff_has_tuple_id
isl_multi_pw_aff_has_tuple_id
Line
Count
Source
217
812
{
218
812
  if (!multi)
219
0
    return isl_bool_error;
220
812
  return isl_space_has_tuple_id(multi->space, type);
221
812
}
isl_multi_union_pw_aff_has_tuple_id
Line
Count
Source
217
660
{
218
660
  if (!multi)
219
0
    return isl_bool_error;
220
660
  return isl_space_has_tuple_id(multi->space, type);
221
660
}
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
812
{
228
812
  return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
229
812
}
Unexecuted instantiation: isl_multi_aff_get_tuple_id
isl_multi_pw_aff_get_tuple_id
Line
Count
Source
227
812
{
228
812
  return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
229
812
}
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
28.9k
{
234
28.9k
  isl_ctx *ctx;
235
28.9k
236
28.9k
  if (!multi)
237
0
    return NULL;
238
28.9k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
239
28.9k
  if (pos < 0 || pos >= multi->n)
240
28.9k
    
isl_die0
(ctx, isl_error_invalid,
241
28.9k
      "index out of bounds", return NULL);
242
28.9k
  return FN(EL,copy)(multi->u.p[pos]);
243
28.9k
}
isl_multi_aff_get_aff
Line
Count
Source
233
10.4k
{
234
10.4k
  isl_ctx *ctx;
235
10.4k
236
10.4k
  if (!multi)
237
0
    return NULL;
238
10.4k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
239
10.4k
  if (pos < 0 || pos >= multi->n)
240
10.4k
    
isl_die0
(ctx, isl_error_invalid,
241
10.4k
      "index out of bounds", return NULL);
242
10.4k
  return FN(EL,copy)(multi->u.p[pos]);
243
10.4k
}
isl_multi_pw_aff_get_pw_aff
Line
Count
Source
233
9.08k
{
234
9.08k
  isl_ctx *ctx;
235
9.08k
236
9.08k
  if (!multi)
237
0
    return NULL;
238
9.08k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
239
9.08k
  if (pos < 0 || pos >= multi->n)
240
9.08k
    
isl_die0
(ctx, isl_error_invalid,
241
9.08k
      "index out of bounds", return NULL);
242
9.08k
  return FN(EL,copy)(multi->u.p[pos]);
243
9.08k
}
isl_multi_union_pw_aff_get_union_pw_aff
Line
Count
Source
233
6.14k
{
234
6.14k
  isl_ctx *ctx;
235
6.14k
236
6.14k
  if (!multi)
237
0
    return NULL;
238
6.14k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
239
6.14k
  if (pos < 0 || pos >= multi->n)
240
6.14k
    
isl_die0
(ctx, isl_error_invalid,
241
6.14k
      "index out of bounds", return NULL);
242
6.14k
  return FN(EL,copy)(multi->u.p[pos]);
243
6.14k
}
isl_multi_val_get_val
Line
Count
Source
233
3.23k
{
234
3.23k
  isl_ctx *ctx;
235
3.23k
236
3.23k
  if (!multi)
237
0
    return NULL;
238
3.23k
  ctx = FN(MULTI(BASE),get_ctx)(multi);
239
3.23k
  if (pos < 0 || pos >= multi->n)
240
3.23k
    
isl_die0
(ctx, isl_error_invalid,
241
3.23k
      "index out of bounds", return NULL);
242
3.23k
  return FN(EL,copy)(multi->u.p[pos]);
243
3.23k
}
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
260k
{
251
260k
  multi = FN(MULTI(BASE),cow)(multi);
252
260k
  if (!multi || !el)
253
0
    goto error;
254
260k
255
260k
  if (pos < 0 || pos >= multi->n)
256
260k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
257
260k
      "index out of bounds", goto error);
258
260k
259
260k
  FN(EL,free)(multi->u.p[pos]);
260
260k
  multi->u.p[pos] = el;
261
260k
262
260k
  return multi;
263
260k
error:
264
0
  FN(MULTI(BASE),free)(multi);
265
0
  FN(EL,free)(el);
266
0
  return NULL;
267
260k
}
isl_aff.c:isl_multi_aff_restore
Line
Count
Source
250
242k
{
251
242k
  multi = FN(MULTI(BASE),cow)(multi);
252
242k
  if (!multi || !el)
253
0
    goto error;
254
242k
255
242k
  if (pos < 0 || pos >= multi->n)
256
242k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
257
242k
      "index out of bounds", goto error);
258
242k
259
242k
  FN(EL,free)(multi->u.p[pos]);
260
242k
  multi->u.p[pos] = el;
261
242k
262
242k
  return multi;
263
242k
error:
264
0
  FN(MULTI(BASE),free)(multi);
265
0
  FN(EL,free)(el);
266
0
  return NULL;
267
242k
}
isl_aff.c:isl_multi_pw_aff_restore
Line
Count
Source
250
9.17k
{
251
9.17k
  multi = FN(MULTI(BASE),cow)(multi);
252
9.17k
  if (!multi || !el)
253
0
    goto error;
254
9.17k
255
9.17k
  if (pos < 0 || pos >= multi->n)
256
9.17k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
257
9.17k
      "index out of bounds", goto error);
258
9.17k
259
9.17k
  FN(EL,free)(multi->u.p[pos]);
260
9.17k
  multi->u.p[pos] = el;
261
9.17k
262
9.17k
  return multi;
263
9.17k
error:
264
0
  FN(MULTI(BASE),free)(multi);
265
0
  FN(EL,free)(el);
266
0
  return NULL;
267
9.17k
}
isl_aff.c:isl_multi_union_pw_aff_restore
Line
Count
Source
250
3.59k
{
251
3.59k
  multi = FN(MULTI(BASE),cow)(multi);
252
3.59k
  if (!multi || !el)
253
0
    goto error;
254
3.59k
255
3.59k
  if (pos < 0 || pos >= multi->n)
256
3.59k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
257
3.59k
      "index out of bounds", goto error);
258
3.59k
259
3.59k
  FN(EL,free)(multi->u.p[pos]);
260
3.59k
  multi->u.p[pos] = el;
261
3.59k
262
3.59k
  return multi;
263
3.59k
error:
264
0
  FN(MULTI(BASE),free)(multi);
265
0
  FN(EL,free)(el);
266
0
  return NULL;
267
3.59k
}
isl_val.c:isl_multi_val_restore
Line
Count
Source
250
5.39k
{
251
5.39k
  multi = FN(MULTI(BASE),cow)(multi);
252
5.39k
  if (!multi || !el)
253
0
    goto error;
254
5.39k
255
5.39k
  if (pos < 0 || pos >= multi->n)
256
5.39k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
257
5.39k
      "index out of bounds", goto error);
258
5.39k
259
5.39k
  FN(EL,free)(multi->u.p[pos]);
260
5.39k
  multi->u.p[pos] = el;
261
5.39k
262
5.39k
  return multi;
263
5.39k
error:
264
0
  FN(MULTI(BASE),free)(multi);
265
0
  FN(EL,free)(el);
266
0
  return NULL;
267
5.39k
}
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
260k
{
277
260k
  isl_space *space;
278
260k
279
260k
  space = FN(MULTI(BASE),peek_space)(multi);
280
260k
  if (FN(EL,check_match_domain_space)(el, space) < 0)
281
0
    multi = FN(MULTI(BASE),free)(multi);
282
260k
  return FN(MULTI(BASE),restore)(multi, pos, el);
283
260k
}
isl_aff.c:isl_multi_aff_restore_check_space
Line
Count
Source
276
242k
{
277
242k
  isl_space *space;
278
242k
279
242k
  space = FN(MULTI(BASE),peek_space)(multi);
280
242k
  if (FN(EL,check_match_domain_space)(el, space) < 0)
281
0
    multi = FN(MULTI(BASE),free)(multi);
282
242k
  return FN(MULTI(BASE),restore)(multi, pos, el);
283
242k
}
isl_aff.c:isl_multi_pw_aff_restore_check_space
Line
Count
Source
276
9.17k
{
277
9.17k
  isl_space *space;
278
9.17k
279
9.17k
  space = FN(MULTI(BASE),peek_space)(multi);
280
9.17k
  if (FN(EL,check_match_domain_space)(el, space) < 0)
281
0
    multi = FN(MULTI(BASE),free)(multi);
282
9.17k
  return FN(MULTI(BASE),restore)(multi, pos, el);
283
9.17k
}
isl_aff.c:isl_multi_union_pw_aff_restore_check_space
Line
Count
Source
276
3.59k
{
277
3.59k
  isl_space *space;
278
3.59k
279
3.59k
  space = FN(MULTI(BASE),peek_space)(multi);
280
3.59k
  if (FN(EL,check_match_domain_space)(el, space) < 0)
281
0
    multi = FN(MULTI(BASE),free)(multi);
282
3.59k
  return FN(MULTI(BASE),restore)(multi, pos, el);
283
3.59k
}
isl_val.c:isl_multi_val_restore_check_space
Line
Count
Source
276
5.39k
{
277
5.39k
  isl_space *space;
278
5.39k
279
5.39k
  space = FN(MULTI(BASE),peek_space)(multi);
280
5.39k
  if (FN(EL,check_match_domain_space)(el, space) < 0)
281
0
    multi = FN(MULTI(BASE),free)(multi);
282
5.39k
  return FN(MULTI(BASE),restore)(multi, pos, el);
283
5.39k
}
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
253k
{
288
253k
  isl_space *multi_space = NULL;
289
253k
  isl_space *el_space = NULL;
290
253k
  isl_bool match;
291
253k
292
253k
  multi_space = FN(MULTI(BASE),get_space)(multi);
293
253k
  match = FN(EL,matching_params)(el, multi_space);
294
253k
  if (match < 0)
295
0
    goto error;
296
253k
  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
253k
304
253k
  multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el);
305
253k
306
253k
  isl_space_free(multi_space);
307
253k
  isl_space_free(el_space);
308
253k
309
253k
  return multi;
310
253k
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
253k
}
isl_multi_aff_set_aff
Line
Count
Source
287
242k
{
288
242k
  isl_space *multi_space = NULL;
289
242k
  isl_space *el_space = NULL;
290
242k
  isl_bool match;
291
242k
292
242k
  multi_space = FN(MULTI(BASE),get_space)(multi);
293
242k
  match = FN(EL,matching_params)(el, multi_space);
294
242k
  if (match < 0)
295
0
    goto error;
296
242k
  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
242k
304
242k
  multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el);
305
242k
306
242k
  isl_space_free(multi_space);
307
242k
  isl_space_free(el_space);
308
242k
309
242k
  return multi;
310
242k
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
242k
}
isl_multi_pw_aff_set_pw_aff
Line
Count
Source
287
2.13k
{
288
2.13k
  isl_space *multi_space = NULL;
289
2.13k
  isl_space *el_space = NULL;
290
2.13k
  isl_bool match;
291
2.13k
292
2.13k
  multi_space = FN(MULTI(BASE),get_space)(multi);
293
2.13k
  match = FN(EL,matching_params)(el, multi_space);
294
2.13k
  if (match < 0)
295
0
    goto error;
296
2.13k
  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
2.13k
304
2.13k
  multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el);
305
2.13k
306
2.13k
  isl_space_free(multi_space);
307
2.13k
  isl_space_free(el_space);
308
2.13k
309
2.13k
  return multi;
310
2.13k
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
2.13k
}
isl_multi_union_pw_aff_set_union_pw_aff
Line
Count
Source
287
3.44k
{
288
3.44k
  isl_space *multi_space = NULL;
289
3.44k
  isl_space *el_space = NULL;
290
3.44k
  isl_bool match;
291
3.44k
292
3.44k
  multi_space = FN(MULTI(BASE),get_space)(multi);
293
3.44k
  match = FN(EL,matching_params)(el, multi_space);
294
3.44k
  if (match < 0)
295
0
    goto error;
296
3.44k
  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
3.44k
304
3.44k
  multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el);
305
3.44k
306
3.44k
  isl_space_free(multi_space);
307
3.44k
  isl_space_free(el_space);
308
3.44k
309
3.44k
  return multi;
310
3.44k
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
3.44k
}
isl_multi_val_set_val
Line
Count
Source
287
5.38k
{
288
5.38k
  isl_space *multi_space = NULL;
289
5.38k
  isl_space *el_space = NULL;
290
5.38k
  isl_bool match;
291
5.38k
292
5.38k
  multi_space = FN(MULTI(BASE),get_space)(multi);
293
5.38k
  match = FN(EL,matching_params)(el, multi_space);
294
5.38k
  if (match < 0)
295
0
    goto error;
296
5.38k
  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
5.38k
304
5.38k
  multi = FN(MULTI(BASE),restore_check_space)(multi, pos, el);
305
5.38k
306
5.38k
  isl_space_free(multi_space);
307
5.38k
  isl_space_free(el_space);
308
5.38k
309
5.38k
  return multi;
310
5.38k
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
5.38k
}
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
6.40k
{
332
6.40k
  int i;
333
6.40k
334
6.40k
  multi = FN(MULTI(BASE),cow)(multi);
335
6.40k
  if (!multi || !space || !domain)
336
0
    goto error;
337
6.40k
338
20.7k
  
for (i = 0; 6.40k
i < multi->n;
++i14.3k
) {
339
14.3k
    multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i],
340
14.3k
         isl_space_copy(domain));
341
14.3k
    if (!multi->u.p[i])
342
0
      goto error;
343
14.3k
  }
344
6.40k
  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
6.40k
  }
350
6.40k
  isl_space_free(domain);
351
6.40k
  isl_space_free(multi->space);
352
6.40k
  multi->space = space;
353
6.40k
354
6.40k
  return multi;
355
6.40k
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
6.40k
}
isl_multi_aff_reset_space_and_domain
Line
Count
Source
331
1.72k
{
332
1.72k
  int i;
333
1.72k
334
1.72k
  multi = FN(MULTI(BASE),cow)(multi);
335
1.72k
  if (!multi || !space || !domain)
336
0
    goto error;
337
1.72k
338
5.29k
  
for (i = 0; 1.72k
i < multi->n;
++i3.56k
) {
339
3.56k
    multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i],
340
3.56k
         isl_space_copy(domain));
341
3.56k
    if (!multi->u.p[i])
342
0
      goto error;
343
3.56k
  }
344
1.72k
  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
1.72k
  }
350
1.72k
  isl_space_free(domain);
351
1.72k
  isl_space_free(multi->space);
352
1.72k
  multi->space = space;
353
1.72k
354
1.72k
  return multi;
355
1.72k
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
1.72k
}
isl_multi_pw_aff_reset_space_and_domain
Line
Count
Source
331
3.45k
{
332
3.45k
  int i;
333
3.45k
334
3.45k
  multi = FN(MULTI(BASE),cow)(multi);
335
3.45k
  if (!multi || !space || !domain)
336
0
    goto error;
337
3.45k
338
13.0k
  
for (i = 0; 3.45k
i < multi->n;
++i9.60k
) {
339
9.60k
    multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i],
340
9.60k
         isl_space_copy(domain));
341
9.60k
    if (!multi->u.p[i])
342
0
      goto error;
343
9.60k
  }
344
3.45k
  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
3.45k
  }
350
3.45k
  isl_space_free(domain);
351
3.45k
  isl_space_free(multi->space);
352
3.45k
  multi->space = space;
353
3.45k
354
3.45k
  return multi;
355
3.45k
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.45k
}
isl_multi_union_pw_aff_reset_space_and_domain
Line
Count
Source
331
98
{
332
98
  int i;
333
98
334
98
  multi = FN(MULTI(BASE),cow)(multi);
335
98
  if (!multi || !space || !domain)
336
0
    goto error;
337
98
338
163
  
for (i = 0; 98
i < multi->n;
++i65
) {
339
65
    multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i],
340
65
         isl_space_copy(domain));
341
65
    if (!multi->u.p[i])
342
0
      goto error;
343
65
  }
344
98
  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
98
  }
350
98
  isl_space_free(domain);
351
98
  isl_space_free(multi->space);
352
98
  multi->space = space;
353
98
354
98
  return multi;
355
98
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
98
}
isl_multi_val_reset_space_and_domain
Line
Count
Source
331
1.13k
{
332
1.13k
  int i;
333
1.13k
334
1.13k
  multi = FN(MULTI(BASE),cow)(multi);
335
1.13k
  if (!multi || !space || !domain)
336
0
    goto error;
337
1.13k
338
2.26k
  
for (i = 0; 1.13k
i < multi->n;
++i1.13k
) {
339
1.13k
    multi->u.p[i] = FN(EL,reset_domain_space)(multi->u.p[i],
340
1.13k
         isl_space_copy(domain));
341
1.13k
    if (!multi->u.p[i])
342
0
      goto error;
343
1.13k
  }
344
1.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
1.13k
  }
350
1.13k
  isl_space_free(domain);
351
1.13k
  isl_space_free(multi->space);
352
1.13k
  multi->space = space;
353
1.13k
354
1.13k
  return multi;
355
1.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
1.13k
}
361
362
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_domain_space)(
363
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *domain)
364
1.25k
{
365
1.25k
  isl_space *space;
366
1.25k
367
1.25k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
368
1.25k
            isl_space_copy(multi->space));
369
1.25k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
370
1.25k
}
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
84
{
365
84
  isl_space *space;
366
84
367
84
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
368
84
            isl_space_copy(multi->space));
369
84
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
370
84
}
isl_multi_val_reset_domain_space
Line
Count
Source
364
1.13k
{
365
1.13k
  isl_space *space;
366
1.13k
367
1.13k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
368
1.13k
            isl_space_copy(multi->space));
369
1.13k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
370
1.13k
}
371
372
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space)(
373
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
374
4.28k
{
375
4.28k
  isl_space *domain;
376
4.28k
377
4.28k
  domain = isl_space_domain(isl_space_copy(space));
378
4.28k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
379
4.28k
}
isl_multi_aff_reset_space
Line
Count
Source
374
832
{
375
832
  isl_space *domain;
376
832
377
832
  domain = isl_space_domain(isl_space_copy(space));
378
832
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
379
832
}
isl_multi_pw_aff_reset_space
Line
Count
Source
374
3.44k
{
375
3.44k
  isl_space *domain;
376
3.44k
377
3.44k
  domain = isl_space_domain(isl_space_copy(space));
378
3.44k
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
379
3.44k
}
isl_multi_union_pw_aff_reset_space
Line
Count
Source
374
14
{
375
14
  isl_space *domain;
376
14
377
14
  domain = isl_space_domain(isl_space_copy(space));
378
14
  return FN(MULTI(BASE),reset_space_and_domain)(multi, space, domain);
379
14
}
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
3.42k
{
387
3.42k
  isl_space *space;
388
3.42k
389
3.42k
  multi = FN(MULTI(BASE),cow)(multi);
390
3.42k
  if (!multi || !id)
391
0
    goto error;
392
3.42k
393
3.42k
  space = FN(MULTI(BASE),get_space)(multi);
394
3.42k
  space = isl_space_set_dim_id(space, type, pos, id);
395
3.42k
396
3.42k
  return FN(MULTI(BASE),reset_space)(multi, space);
397
3.42k
error:
398
0
  isl_id_free(id);
399
0
  FN(MULTI(BASE),free)(multi);
400
0
  return NULL;
401
3.42k
}
Unexecuted instantiation: isl_multi_aff_set_dim_id
isl_multi_pw_aff_set_dim_id
Line
Count
Source
386
3.42k
{
387
3.42k
  isl_space *space;
388
3.42k
389
3.42k
  multi = FN(MULTI(BASE),cow)(multi);
390
3.42k
  if (!multi || !id)
391
0
    goto error;
392
3.42k
393
3.42k
  space = FN(MULTI(BASE),get_space)(multi);
394
3.42k
  space = isl_space_set_dim_id(space, type, pos, id);
395
3.42k
396
3.42k
  return FN(MULTI(BASE),reset_space)(multi, space);
397
3.42k
error:
398
0
  isl_id_free(id);
399
0
  FN(MULTI(BASE),free)(multi);
400
0
  return NULL;
401
3.42k
}
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
658
{
443
658
  isl_space *space;
444
658
445
658
  if (!multi)
446
0
    return NULL;
447
658
  if (!FN(MULTI(BASE),has_tuple_id)(multi, type))
448
654
    return multi;
449
4
450
4
  multi = FN(MULTI(BASE),cow)(multi);
451
4
  if (!multi)
452
0
    return NULL;
453
4
454
4
  space = FN(MULTI(BASE),get_space)(multi);
455
4
  space = isl_space_reset_tuple_id(space, type);
456
4
457
4
  return FN(MULTI(BASE),reset_space)(multi, space);
458
4
}
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
658
{
443
658
  isl_space *space;
444
658
445
658
  if (!multi)
446
0
    return NULL;
447
658
  if (!FN(MULTI(BASE),has_tuple_id)(multi, type))
448
654
    return multi;
449
4
450
4
  multi = FN(MULTI(BASE),cow)(multi);
451
4
  if (!multi)
452
0
    return NULL;
453
4
454
4
  space = FN(MULTI(BASE),get_space)(multi);
455
4
  space = isl_space_reset_tuple_id(space, type);
456
4
457
4
  return FN(MULTI(BASE),reset_space)(multi, space);
458
4
}
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
1.24k
{
477
1.24k
  int i;
478
1.24k
  isl_space *space;
479
1.24k
480
1.24k
  multi = FN(MULTI(BASE),cow)(multi);
481
1.24k
  if (!multi || !exp)
482
0
    goto error;
483
1.24k
484
2.43k
  
for (i = 0; 1.24k
i < multi->n;
++i1.19k
) {
485
1.19k
    multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i],
486
1.19k
            isl_reordering_copy(exp));
487
1.19k
    if (!multi->u.p[i])
488
0
      goto error;
489
1.19k
  }
490
1.24k
491
1.24k
  space = isl_reordering_get_space(exp);
492
1.24k
  multi = FN(MULTI(BASE),reset_domain_space)(multi, space);
493
1.24k
494
1.24k
  isl_reordering_free(exp);
495
1.24k
  return multi;
496
1.24k
error:
497
0
  isl_reordering_free(exp);
498
0
  FN(MULTI(BASE),free)(multi);
499
0
  return NULL;
500
1.24k
}
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
84
{
477
84
  int i;
478
84
  isl_space *space;
479
84
480
84
  multi = FN(MULTI(BASE),cow)(multi);
481
84
  if (!multi || !exp)
482
0
    goto error;
483
84
484
132
  
for (i = 0; 84
i < multi->n;
++i48
) {
485
48
    multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i],
486
48
            isl_reordering_copy(exp));
487
48
    if (!multi->u.p[i])
488
0
      goto error;
489
48
  }
490
84
491
84
  space = isl_reordering_get_space(exp);
492
84
  multi = FN(MULTI(BASE),reset_domain_space)(multi, space);
493
84
494
84
  isl_reordering_free(exp);
495
84
  return multi;
496
84
error:
497
0
  isl_reordering_free(exp);
498
0
  FN(MULTI(BASE),free)(multi);
499
0
  return NULL;
500
84
}
isl_multi_val_realign_domain
Line
Count
Source
476
1.13k
{
477
1.13k
  int i;
478
1.13k
  isl_space *space;
479
1.13k
480
1.13k
  multi = FN(MULTI(BASE),cow)(multi);
481
1.13k
  if (!multi || !exp)
482
0
    goto error;
483
1.13k
484
2.26k
  
for (i = 0; 1.13k
i < multi->n;
++i1.13k
) {
485
1.13k
    multi->u.p[i] = FN(EL,realign_domain)(multi->u.p[i],
486
1.13k
            isl_reordering_copy(exp));
487
1.13k
    if (!multi->u.p[i])
488
0
      goto error;
489
1.13k
  }
490
1.13k
491
1.13k
  space = isl_reordering_get_space(exp);
492
1.13k
  multi = FN(MULTI(BASE),reset_domain_space)(multi, space);
493
1.13k
494
1.13k
  isl_reordering_free(exp);
495
1.13k
  return multi;
496
1.13k
error:
497
0
  isl_reordering_free(exp);
498
0
  FN(MULTI(BASE),free)(multi);
499
0
  return NULL;
500
1.13k
}
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
2.84k
{
510
2.84k
  isl_ctx *ctx;
511
2.84k
  isl_bool equal_params;
512
2.84k
  isl_reordering *exp;
513
2.84k
514
2.84k
  if (!multi || !model)
515
0
    goto error;
516
2.84k
517
2.84k
  equal_params = isl_space_has_equal_params(multi->space, model);
518
2.84k
  if (equal_params < 0)
519
0
    goto error;
520
2.84k
  if (equal_params) {
521
1.61k
    isl_space_free(model);
522
1.61k
    return multi;
523
1.61k
  }
524
1.23k
525
1.23k
  ctx = isl_space_get_ctx(model);
526
1.23k
  if (!isl_space_has_named_params(model))
527
1.23k
    
isl_die0
(ctx, isl_error_invalid,
528
1.23k
      "model has unnamed parameters", goto error);
529
1.23k
  if (!isl_space_has_named_params(multi->space))
530
1.23k
    
isl_die0
(ctx, isl_error_invalid,
531
1.23k
      "input has unnamed parameters", goto error);
532
1.23k
533
1.23k
  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
1.23k
  }
539
1.23k
  exp = isl_parameter_alignment_reordering(multi->space, model);
540
1.23k
  exp = isl_reordering_extend_space(exp,
541
1.23k
            FN(MULTI(BASE),get_domain_space)(multi));
542
1.23k
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
543
1.23k
544
1.23k
  isl_space_free(model);
545
1.23k
  return multi;
546
1.23k
error:
547
0
  isl_space_free(model);
548
0
  FN(MULTI(BASE),free)(multi);
549
0
  return NULL;
550
1.23k
}
isl_multi_aff_align_params
Line
Count
Source
509
530
{
510
530
  isl_ctx *ctx;
511
530
  isl_bool equal_params;
512
530
  isl_reordering *exp;
513
530
514
530
  if (!multi || !model)
515
0
    goto error;
516
530
517
530
  equal_params = isl_space_has_equal_params(multi->space, model);
518
530
  if (equal_params < 0)
519
0
    goto error;
520
530
  if (equal_params) {
521
518
    isl_space_free(model);
522
518
    return multi;
523
518
  }
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
375
{
510
375
  isl_ctx *ctx;
511
375
  isl_bool equal_params;
512
375
  isl_reordering *exp;
513
375
514
375
  if (!multi || !model)
515
0
    goto error;
516
375
517
375
  equal_params = isl_space_has_equal_params(multi->space, model);
518
375
  if (equal_params < 0)
519
0
    goto error;
520
375
  if (equal_params) {
521
291
    isl_space_free(model);
522
291
    return multi;
523
291
  }
524
84
525
84
  ctx = isl_space_get_ctx(model);
526
84
  if (!isl_space_has_named_params(model))
527
84
    
isl_die0
(ctx, isl_error_invalid,
528
84
      "model has unnamed parameters", goto error);
529
84
  if (!isl_space_has_named_params(multi->space))
530
84
    
isl_die0
(ctx, isl_error_invalid,
531
84
      "input has unnamed parameters", goto error);
532
84
533
84
  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
84
  }
539
84
  exp = isl_parameter_alignment_reordering(multi->space, model);
540
84
  exp = isl_reordering_extend_space(exp,
541
84
            FN(MULTI(BASE),get_domain_space)(multi));
542
84
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
543
84
544
84
  isl_space_free(model);
545
84
  return multi;
546
84
error:
547
0
  isl_space_free(model);
548
0
  FN(MULTI(BASE),free)(multi);
549
0
  return NULL;
550
84
}
isl_multi_val_align_params
Line
Count
Source
509
1.89k
{
510
1.89k
  isl_ctx *ctx;
511
1.89k
  isl_bool equal_params;
512
1.89k
  isl_reordering *exp;
513
1.89k
514
1.89k
  if (!multi || !model)
515
0
    goto error;
516
1.89k
517
1.89k
  equal_params = isl_space_has_equal_params(multi->space, model);
518
1.89k
  if (equal_params < 0)
519
0
    goto error;
520
1.89k
  if (equal_params) {
521
766
    isl_space_free(model);
522
766
    return multi;
523
766
  }
524
1.13k
525
1.13k
  ctx = isl_space_get_ctx(model);
526
1.13k
  if (!isl_space_has_named_params(model))
527
1.13k
    
isl_die0
(ctx, isl_error_invalid,
528
1.13k
      "model has unnamed parameters", goto error);
529
1.13k
  if (!isl_space_has_named_params(multi->space))
530
1.13k
    
isl_die0
(ctx, isl_error_invalid,
531
1.13k
      "input has unnamed parameters", goto error);
532
1.13k
533
1.13k
  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
1.13k
  }
539
1.13k
  exp = isl_parameter_alignment_reordering(multi->space, model);
540
1.13k
  exp = isl_reordering_extend_space(exp,
541
1.13k
            FN(MULTI(BASE),get_domain_space)(multi));
542
1.13k
  multi = FN(MULTI(BASE),realign_domain)(multi, exp);
543
1.13k
544
1.13k
  isl_space_free(model);
545
1.13k
  return multi;
546
1.13k
error:
547
0
  isl_space_free(model);
548
0
  FN(MULTI(BASE),free)(multi);
549
0
  return NULL;
550
1.13k
}
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
5.07k
{
562
5.07k
  int i;
563
5.07k
  int n;
564
5.07k
  isl_ctx *ctx;
565
5.07k
  MULTI(BASE) *multi;
566
5.07k
567
5.07k
  if (!space || !list)
568
0
    goto error;
569
5.07k
570
5.07k
  ctx = isl_space_get_ctx(space);
571
5.07k
  n = FN(FN(LIST(EL),n),BASE)(list);
572
5.07k
  if (n != isl_space_dim(space, isl_dim_out))
573
5.07k
    
isl_die0
(ctx, isl_error_invalid,
574
5.07k
      "invalid number of elements in list", goto error);
575
5.07k
576
12.2k
  
for (i = 0; 5.07k
i < n;
++i7.19k
) {
577
7.19k
    EL *el = FN(LIST(EL),peek)(list, i);
578
7.19k
    space = isl_space_align_params(space, FN(EL,get_space)(el));
579
7.19k
  }
580
5.07k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
581
12.2k
  for (i = 0; i < n; 
++i7.19k
) {
582
7.19k
    EL *el = FN(FN(LIST(EL),get),BASE)(list, i);
583
7.19k
    el = FN(EL,align_params)(el, isl_space_copy(space));
584
7.19k
    multi = FN(MULTI(BASE),restore_check_space)(multi, i, el);
585
7.19k
  }
586
5.07k
587
5.07k
  isl_space_free(space);
588
5.07k
  FN(LIST(EL),free)(list);
589
5.07k
  return multi;
590
5.07k
error:
591
0
  isl_space_free(space);
592
0
  FN(LIST(EL),free)(list);
593
0
  return NULL;
594
5.07k
}
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
4.80k
{
562
4.80k
  int i;
563
4.80k
  int n;
564
4.80k
  isl_ctx *ctx;
565
4.80k
  MULTI(BASE) *multi;
566
4.80k
567
4.80k
  if (!space || !list)
568
0
    goto error;
569
4.80k
570
4.80k
  ctx = isl_space_get_ctx(space);
571
4.80k
  n = FN(FN(LIST(EL),n),BASE)(list);
572
4.80k
  if (n != isl_space_dim(space, isl_dim_out))
573
4.80k
    
isl_die0
(ctx, isl_error_invalid,
574
4.80k
      "invalid number of elements in list", goto error);
575
4.80k
576
11.8k
  
for (i = 0; 4.80k
i < n;
++i7.03k
) {
577
7.03k
    EL *el = FN(LIST(EL),peek)(list, i);
578
7.03k
    space = isl_space_align_params(space, FN(EL,get_space)(el));
579
7.03k
  }
580
4.80k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
581
11.8k
  for (i = 0; i < n; 
++i7.03k
) {
582
7.03k
    EL *el = FN(FN(LIST(EL),get),BASE)(list, i);
583
7.03k
    el = FN(EL,align_params)(el, isl_space_copy(space));
584
7.03k
    multi = FN(MULTI(BASE),restore_check_space)(multi, i, el);
585
7.03k
  }
586
4.80k
587
4.80k
  isl_space_free(space);
588
4.80k
  FN(LIST(EL),free)(list);
589
4.80k
  return multi;
590
4.80k
error:
591
0
  isl_space_free(space);
592
0
  FN(LIST(EL),free)(list);
593
0
  return NULL;
594
4.80k
}
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
2.17k
{
602
2.17k
  int i, n;
603
2.17k
  isl_local_space *ls;
604
2.17k
  MULTI(BASE) *multi;
605
2.17k
606
2.17k
  if (!space)
607
0
    return NULL;
608
2.17k
609
2.17k
  if (isl_space_is_set(space))
610
2.17k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
611
2.17k
      "expecting map space", goto error);
612
2.17k
613
2.17k
  n = isl_space_dim(space, isl_dim_out);
614
2.17k
  if (n != isl_space_dim(space, isl_dim_in))
615
2.17k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
616
2.17k
      "number of input and output dimensions needs to be "
617
2.17k
      "the same", goto error);
618
2.17k
619
2.17k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
620
2.17k
621
2.17k
  if (!n) {
622
611
    isl_space_free(space);
623
611
    return multi;
624
611
  }
625
1.56k
626
1.56k
  space = isl_space_domain(space);
627
1.56k
  ls = isl_local_space_from_space(space);
628
1.56k
629
8.85k
  for (i = 0; i < n; 
++i7.28k
) {
630
7.28k
    EL *el;
631
7.28k
    el = FN(EL,var_on_domain)(isl_local_space_copy(ls),
632
7.28k
            isl_dim_set, i);
633
7.28k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el);
634
7.28k
  }
635
1.56k
636
1.56k
  isl_local_space_free(ls);
637
1.56k
638
1.56k
  return multi;
639
1.56k
error:
640
0
  isl_space_free(space);
641
0
  return NULL;
642
1.56k
}
isl_multi_aff_identity
Line
Count
Source
601
2.17k
{
602
2.17k
  int i, n;
603
2.17k
  isl_local_space *ls;
604
2.17k
  MULTI(BASE) *multi;
605
2.17k
606
2.17k
  if (!space)
607
0
    return NULL;
608
2.17k
609
2.17k
  if (isl_space_is_set(space))
610
2.17k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
611
2.17k
      "expecting map space", goto error);
612
2.17k
613
2.17k
  n = isl_space_dim(space, isl_dim_out);
614
2.17k
  if (n != isl_space_dim(space, isl_dim_in))
615
2.17k
    
isl_die0
(isl_space_get_ctx(space), isl_error_invalid,
616
2.17k
      "number of input and output dimensions needs to be "
617
2.17k
      "the same", goto error);
618
2.17k
619
2.17k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
620
2.17k
621
2.17k
  if (!n) {
622
611
    isl_space_free(space);
623
611
    return multi;
624
611
  }
625
1.56k
626
1.56k
  space = isl_space_domain(space);
627
1.56k
  ls = isl_local_space_from_space(space);
628
1.56k
629
8.85k
  for (i = 0; i < n; 
++i7.28k
) {
630
7.28k
    EL *el;
631
7.28k
    el = FN(EL,var_on_domain)(isl_local_space_copy(ls),
632
7.28k
            isl_dim_set, i);
633
7.28k
    multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, el);
634
7.28k
  }
635
1.56k
636
1.56k
  isl_local_space_free(ls);
637
1.56k
638
1.56k
  return multi;
639
1.56k
error:
640
0
  isl_space_free(space);
641
0
  return NULL;
642
1.56k
}
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
2.65k
{
651
2.65k
  int n;
652
2.65k
  MULTI(BASE) *multi;
653
2.65k
654
2.65k
  if (!space)
655
0
    return NULL;
656
2.65k
657
2.65k
  n = isl_space_dim(space , isl_dim_out);
658
2.65k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
659
2.65k
660
2.65k
  if (!n)
661
461
    isl_space_free(space);
662
2.19k
  else {
663
2.19k
    int i;
664
2.19k
    isl_local_space *ls;
665
2.19k
    EL *el;
666
2.19k
667
2.19k
    space = isl_space_domain(space);
668
2.19k
    ls = isl_local_space_from_space(space);
669
2.19k
    el = FN(EL,zero_on_domain)(ls);
670
2.19k
671
5.29k
    for (i = 0; i < n; 
++i3.10k
)
672
3.10k
      multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
673
3.10k
                  FN(EL,copy)(el));
674
2.19k
675
2.19k
    FN(EL,free)(el);
676
2.19k
  }
677
2.65k
678
2.65k
  return multi;
679
2.65k
}
isl_multi_aff_zero
Line
Count
Source
650
1.25k
{
651
1.25k
  int n;
652
1.25k
  MULTI(BASE) *multi;
653
1.25k
654
1.25k
  if (!space)
655
0
    return NULL;
656
1.25k
657
1.25k
  n = isl_space_dim(space , isl_dim_out);
658
1.25k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
659
1.25k
660
1.25k
  if (!n)
661
403
    isl_space_free(space);
662
855
  else {
663
855
    int i;
664
855
    isl_local_space *ls;
665
855
    EL *el;
666
855
667
855
    space = isl_space_domain(space);
668
855
    ls = isl_local_space_from_space(space);
669
855
    el = FN(EL,zero_on_domain)(ls);
670
855
671
2.02k
    for (i = 0; i < n; 
++i1.17k
)
672
1.17k
      multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
673
1.17k
                  FN(EL,copy)(el));
674
855
675
855
    FN(EL,free)(el);
676
855
  }
677
1.25k
678
1.25k
  return multi;
679
1.25k
}
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
1.39k
{
651
1.39k
  int n;
652
1.39k
  MULTI(BASE) *multi;
653
1.39k
654
1.39k
  if (!space)
655
0
    return NULL;
656
1.39k
657
1.39k
  n = isl_space_dim(space , isl_dim_out);
658
1.39k
  multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
659
1.39k
660
1.39k
  if (!n)
661
56
    isl_space_free(space);
662
1.33k
  else {
663
1.33k
    int i;
664
1.33k
    isl_local_space *ls;
665
1.33k
    EL *el;
666
1.33k
667
1.33k
    space = isl_space_domain(space);
668
1.33k
    ls = isl_local_space_from_space(space);
669
1.33k
    el = FN(EL,zero_on_domain)(ls);
670
1.33k
671
3.26k
    for (i = 0; i < n; 
++i1.93k
)
672
1.93k
      multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
673
1.93k
                  FN(EL,copy)(el));
674
1.33k
675
1.33k
    FN(EL,free)(el);
676
1.33k
  }
677
1.39k
678
1.39k
  return multi;
679
1.39k
}
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
346
{
694
346
  isl_space *space;
695
346
  MULTI(BASE) *multi;
696
346
697
346
  space = FN(EL,get_space(el));
698
346
  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
346
  multi = FN(MULTI(BASE),alloc)(space);
703
346
  multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
704
346
705
346
  return multi;
706
346
}
isl_multi_aff_from_aff
Line
Count
Source
693
346
{
694
346
  isl_space *space;
695
346
  MULTI(BASE) *multi;
696
346
697
346
  space = FN(EL,get_space(el));
698
346
  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
346
  multi = FN(MULTI(BASE),alloc)(space);
703
346
  multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
704
346
705
346
  return multi;
706
346
}
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
518
{
713
518
  int i;
714
518
  unsigned dim;
715
518
716
518
  multi = FN(MULTI(BASE),cow)(multi);
717
518
  if (!multi)
718
0
    return NULL;
719
518
720
518
  dim = FN(MULTI(BASE),dim)(multi, type);
721
518
  if (first + n > dim || first + n < first)
722
518
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
723
518
      "index out of bounds",
724
518
      return FN(MULTI(BASE),free)(multi));
725
518
726
518
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
727
518
  if (!multi->space)
728
0
    return FN(MULTI(BASE),free)(multi);
729
518
730
518
  if (type == isl_dim_out) {
731
762
    for (i = 0; i < n; 
++i384
)
732
384
      FN(EL,free)(multi->u.p[first + i]);
733
636
    for (i = first; i + n < multi->n; 
++i258
)
734
258
      multi->u.p[i] = multi->u.p[i + n];
735
378
    multi->n -= n;
736
378
    if (n > 0 && 
FN323
(MULTI(BASE),has_explicit_domain)(multi)323
)
737
3
      multi = FN(MULTI(BASE),init_explicit_domain)(multi);
738
378
739
378
    return multi;
740
378
  }
741
140
742
140
  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
140
  if (!multi)
746
0
    return NULL;
747
140
748
586
  
for (i = 0; 140
i < multi->n;
++i446
) {
749
446
    multi->u.p[i] = FN(EL,drop_dims)(multi->u.p[i], type, first, n);
750
446
    if (!multi->u.p[i])
751
0
      return FN(MULTI(BASE),free)(multi);
752
446
  }
753
140
754
140
  return multi;
755
140
}
isl_multi_aff_drop_dims
Line
Count
Source
712
482
{
713
482
  int i;
714
482
  unsigned dim;
715
482
716
482
  multi = FN(MULTI(BASE),cow)(multi);
717
482
  if (!multi)
718
0
    return NULL;
719
482
720
482
  dim = FN(MULTI(BASE),dim)(multi, type);
721
482
  if (first + n > dim || first + n < first)
722
482
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
723
482
      "index out of bounds",
724
482
      return FN(MULTI(BASE),free)(multi));
725
482
726
482
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
727
482
  if (!multi->space)
728
0
    return FN(MULTI(BASE),free)(multi);
729
482
730
482
  if (type == isl_dim_out) {
731
701
    for (i = 0; i < n; 
++i358
)
732
358
      FN(EL,free)(multi->u.p[first + i]);
733
588
    for (i = first; i + n < multi->n; 
++i245
)
734
245
      multi->u.p[i] = multi->u.p[i + n];
735
343
    multi->n -= n;
736
343
    if (n > 0 && 
FN301
(MULTI(BASE),has_explicit_domain)(multi)301
)
737
0
      multi = FN(MULTI(BASE),init_explicit_domain)(multi);
738
343
739
343
    return multi;
740
343
  }
741
139
742
139
  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
139
  if (!multi)
746
0
    return NULL;
747
139
748
585
  
for (i = 0; 139
i < multi->n;
++i446
) {
749
446
    multi->u.p[i] = FN(EL,drop_dims)(multi->u.p[i], type, first, n);
750
446
    if (!multi->u.p[i])
751
0
      return FN(MULTI(BASE),free)(multi);
752
446
  }
753
139
754
139
  return multi;
755
139
}
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
23
{
713
23
  int i;
714
23
  unsigned dim;
715
23
716
23
  multi = FN(MULTI(BASE),cow)(multi);
717
23
  if (!multi)
718
0
    return NULL;
719
23
720
23
  dim = FN(MULTI(BASE),dim)(multi, type);
721
23
  if (first + n > dim || first + n < first)
722
23
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
723
23
      "index out of bounds",
724
23
      return FN(MULTI(BASE),free)(multi));
725
23
726
23
  multi->space = isl_space_drop_dims(multi->space, type, first, n);
727
23
  if (!multi->space)
728
0
    return FN(MULTI(BASE),free)(multi);
729
23
730
23
  if (type == isl_dim_out) {
731
45
    for (i = 0; i < n; 
++i22
)
732
23
      
FN22
(EL,free)(multi->u.p[first + i])22
;
733
34
    for (i = first; i + n < multi->n; 
++i11
)
734
11
      multi->u.p[i] = multi->u.p[i + n];
735
23
    multi->n -= n;
736
23
    if (n > 0 && 
FN18
(MULTI(BASE),has_explicit_domain)(multi)18
)
737
1
      multi = FN(MULTI(BASE),init_explicit_domain)(multi);
738
23
739
23
    return multi;
740
23
  }
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
2.29k
{
764
2.29k
  isl_ctx *ctx;
765
2.29k
  isl_bool equal_params;
766
2.29k
767
2.29k
  if (!multi1 || !multi2)
768
0
    goto error;
769
2.29k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
770
2.29k
  if (equal_params < 0)
771
0
    goto error;
772
2.29k
  if (equal_params)
773
2.28k
    return fn(multi1, multi2);
774
12
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
775
12
  if (!isl_space_has_named_params(multi1->space) ||
776
12
      !isl_space_has_named_params(multi2->space))
777
12
    
isl_die0
(ctx, isl_error_invalid,
778
12
      "unaligned unnamed parameters", goto error);
779
12
  multi1 = FN(MULTI(BASE),align_params)(multi1,
780
12
              FN(MULTI(BASE),get_space)(multi2));
781
12
  multi2 = FN(MULTI(BASE),align_params)(multi2,
782
12
              FN(MULTI(BASE),get_space)(multi1));
783
12
  return fn(multi1, multi2);
784
12
error:
785
0
  FN(MULTI(BASE),free)(multi1);
786
0
  FN(MULTI(BASE),free)(multi2);
787
0
  return NULL;
788
12
}
isl_aff.c:isl_multi_aff_align_params_multi_multi_and
Line
Count
Source
763
1.45k
{
764
1.45k
  isl_ctx *ctx;
765
1.45k
  isl_bool equal_params;
766
1.45k
767
1.45k
  if (!multi1 || !multi2)
768
0
    goto error;
769
1.45k
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
770
1.45k
  if (equal_params < 0)
771
0
    goto error;
772
1.45k
  if (equal_params)
773
1.45k
    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
809
{
764
809
  isl_ctx *ctx;
765
809
  isl_bool equal_params;
766
809
767
809
  if (!multi1 || !multi2)
768
0
    goto error;
769
809
  equal_params = isl_space_has_equal_params(multi1->space, multi2->space);
770
809
  if (equal_params < 0)
771
0
    goto error;
772
809
  if (equal_params)
773
804
    return fn(multi1, multi2);
774
5
  ctx = FN(MULTI(BASE),get_ctx)(multi1);
775
5
  if (!isl_space_has_named_params(multi1->space) ||
776
5
      !isl_space_has_named_params(multi2->space))
777
5
    
isl_die0
(ctx, isl_error_invalid,
778
5
      "unaligned unnamed parameters", goto error);
779
5
  multi1 = FN(MULTI(BASE),align_params)(multi1,
780
5
              FN(MULTI(BASE),get_space)(multi2));
781
5
  multi2 = FN(MULTI(BASE),align_params)(multi2,
782
5
              FN(MULTI(BASE),get_space)(multi1));
783
5
  return fn(multi1, multi2);
784
5
error:
785
0
  FN(MULTI(BASE),free)(multi1);
786
0
  FN(MULTI(BASE),free)(multi2);
787
0
  return NULL;
788
5
}
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
860
{
801
860
  int i, n1, n2;
802
860
  EL *el;
803
860
  isl_space *space;
804
860
  MULTI(BASE) *res;
805
860
806
860
  if (!multi1 || !multi2)
807
0
    goto error;
808
860
809
860
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
810
860
          FN(MULTI(BASE),get_space)(multi2));
811
860
  res = FN(MULTI(BASE),alloc)(space);
812
860
813
860
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
814
860
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
815
860
816
1.89k
  for (i = 0; i < n1; 
++i1.03k
) {
817
1.03k
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
818
1.03k
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
819
1.03k
  }
820
860
821
1.42k
  for (i = 0; i < n2; 
++i567
) {
822
567
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
823
567
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
824
567
  }
825
860
826
860
  if (FN(MULTI(BASE),has_explicit_domain)(multi1))
827
7
    res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1);
828
860
  if (FN(MULTI(BASE),has_explicit_domain)(multi2))
829
411
    res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2);
830
860
831
860
  FN(MULTI(BASE),free)(multi1);
832
860
  FN(MULTI(BASE),free)(multi2);
833
860
  return res;
834
860
error:
835
0
  FN(MULTI(BASE),free)(multi1);
836
0
  FN(MULTI(BASE),free)(multi2);
837
0
  return NULL;
838
860
}
isl_aff.c:isl_multi_aff_range_product_aligned
Line
Count
Source
800
148
{
801
148
  int i, n1, n2;
802
148
  EL *el;
803
148
  isl_space *space;
804
148
  MULTI(BASE) *res;
805
148
806
148
  if (!multi1 || !multi2)
807
0
    goto error;
808
148
809
148
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
810
148
          FN(MULTI(BASE),get_space)(multi2));
811
148
  res = FN(MULTI(BASE),alloc)(space);
812
148
813
148
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
814
148
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
815
148
816
448
  for (i = 0; i < n1; 
++i300
) {
817
300
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
818
300
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
819
300
  }
820
148
821
304
  for (i = 0; i < n2; 
++i156
) {
822
156
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
823
156
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
824
156
  }
825
148
826
148
  if (FN(MULTI(BASE),has_explicit_domain)(multi1))
827
0
    res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1);
828
148
  if (FN(MULTI(BASE),has_explicit_domain)(multi2))
829
0
    res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2);
830
148
831
148
  FN(MULTI(BASE),free)(multi1);
832
148
  FN(MULTI(BASE),free)(multi2);
833
148
  return res;
834
148
error:
835
0
  FN(MULTI(BASE),free)(multi1);
836
0
  FN(MULTI(BASE),free)(multi2);
837
0
  return NULL;
838
148
}
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
697
{
801
697
  int i, n1, n2;
802
697
  EL *el;
803
697
  isl_space *space;
804
697
  MULTI(BASE) *res;
805
697
806
697
  if (!multi1 || !multi2)
807
0
    goto error;
808
697
809
697
  space = isl_space_range_product(FN(MULTI(BASE),get_space)(multi1),
810
697
          FN(MULTI(BASE),get_space)(multi2));
811
697
  res = FN(MULTI(BASE),alloc)(space);
812
697
813
697
  n1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
814
697
  n2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
815
697
816
1.41k
  for (i = 0; i < n1; 
++i720
) {
817
720
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
818
720
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
819
720
  }
820
697
821
1.08k
  for (i = 0; i < n2; 
++i392
) {
822
392
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
823
392
    res = FN(FN(MULTI(BASE),set),BASE)(res, n1 + i, el);
824
392
  }
825
697
826
697
  if (FN(MULTI(BASE),has_explicit_domain)(multi1))
827
5
    res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi1);
828
697
  if (FN(MULTI(BASE),has_explicit_domain)(multi2))
829
409
    res = FN(MULTI(BASE),intersect_explicit_domain)(res, multi2);
830
697
831
697
  FN(MULTI(BASE),free)(multi1);
832
697
  FN(MULTI(BASE),free)(multi2);
833
697
  return res;
834
697
error:
835
0
  FN(MULTI(BASE),free)(multi1);
836
0
  FN(MULTI(BASE),free)(multi2);
837
0
  return NULL;
838
697
}
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
860
{
846
860
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
847
860
          &FN(MULTI(BASE),range_product_aligned));
848
860
}
isl_multi_aff_range_product
Line
Count
Source
845
148
{
846
148
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
847
148
          &FN(MULTI(BASE),range_product_aligned));
848
148
}
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
697
{
846
697
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
847
697
          &FN(MULTI(BASE),range_product_aligned));
848
697
}
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
222
{
854
222
  if (!multi)
855
0
    return isl_bool_error;
856
222
  return isl_space_range_is_wrapping(multi->space);
857
222
}
Unexecuted instantiation: isl_multi_aff_range_is_wrapping
isl_multi_pw_aff_range_is_wrapping
Line
Count
Source
853
222
{
854
222
  if (!multi)
855
0
    return isl_bool_error;
856
222
  return isl_space_range_is_wrapping(multi->space);
857
222
}
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
592
{
946
592
  int i;
947
592
  EL *el;
948
592
  isl_space *space;
949
592
  MULTI(BASE) *res;
950
592
  int in1, in2, out1, out2;
951
592
952
592
  in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
953
592
  in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
954
592
  out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
955
592
  out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
956
592
  space = isl_space_product(FN(MULTI(BASE),get_space)(multi1),
957
592
          FN(MULTI(BASE),get_space)(multi2));
958
592
  res = FN(MULTI(BASE),alloc)(isl_space_copy(space));
959
592
  space = isl_space_domain(space);
960
592
961
1.08k
  for (i = 0; i < out1; 
++i489
) {
962
489
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
963
489
    el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2);
964
489
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
965
489
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
966
489
  }
967
592
968
1.37k
  for (i = 0; i < out2; 
++i778
) {
969
778
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
970
778
    el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1);
971
778
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
972
778
    res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el);
973
778
  }
974
592
975
592
  if (FN(MULTI(BASE),has_explicit_domain)(multi1) ||
976
592
      
FN588
(MULTI(BASE),has_explicit_domain)(multi2)588
)
977
6
    res = FN(MULTI(BASE),intersect_explicit_domain_product)(res,
978
6
                multi1, multi2);
979
592
980
592
  isl_space_free(space);
981
592
  FN(MULTI(BASE),free)(multi1);
982
592
  FN(MULTI(BASE),free)(multi2);
983
592
  return res;
984
592
}
isl_multi_aff_product_aligned
Line
Count
Source
945
584
{
946
584
  int i;
947
584
  EL *el;
948
584
  isl_space *space;
949
584
  MULTI(BASE) *res;
950
584
  int in1, in2, out1, out2;
951
584
952
584
  in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
953
584
  in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
954
584
  out1 = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
955
584
  out2 = FN(MULTI(BASE),dim)(multi2, isl_dim_out);
956
584
  space = isl_space_product(FN(MULTI(BASE),get_space)(multi1),
957
584
          FN(MULTI(BASE),get_space)(multi2));
958
584
  res = FN(MULTI(BASE),alloc)(isl_space_copy(space));
959
584
  space = isl_space_domain(space);
960
584
961
1.06k
  for (i = 0; i < out1; 
++i485
) {
962
485
    el = FN(FN(MULTI(BASE),get),BASE)(multi1, i);
963
485
    el = FN(EL,insert_dims)(el, isl_dim_in, in1, in2);
964
485
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
965
485
    res = FN(FN(MULTI(BASE),set),BASE)(res, i, el);
966
485
  }
967
584
968
1.35k
  for (i = 0; i < out2; 
++i774
) {
969
774
    el = FN(FN(MULTI(BASE),get),BASE)(multi2, i);
970
774
    el = FN(EL,insert_dims)(el, isl_dim_in, 0, in1);
971
774
    el = FN(EL,reset_domain_space)(el, isl_space_copy(space));
972
774
    res = FN(FN(MULTI(BASE),set),BASE)(res, out1 + i, el);
973
774
  }
974
584
975
584
  if (FN(MULTI(BASE),has_explicit_domain)(multi1) ||
976
584
      FN(MULTI(BASE),has_explicit_domain)(multi2))
977
0
    res = FN(MULTI(BASE),intersect_explicit_domain_product)(res,
978
0
                multi1, multi2);
979
584
980
584
  isl_space_free(space);
981
584
  FN(MULTI(BASE),free)(multi1);
982
584
  FN(MULTI(BASE),free)(multi2);
983
584
  return res;
984
584
}
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
592
{
992
592
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
993
592
          &FN(MULTI(BASE),product_aligned));
994
592
}
isl_multi_aff_product
Line
Count
Source
991
584
{
992
584
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
993
584
          &FN(MULTI(BASE),product_aligned));
994
584
}
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
937
{
1000
937
  if (!multi)
1001
0
    return NULL;
1002
937
1003
937
  if (!multi->space->nested[1])
1004
0
    return multi;
1005
937
1006
937
  multi = FN(MULTI(BASE),cow)(multi);
1007
937
  if (!multi)
1008
0
    return NULL;
1009
937
1010
937
  multi->space = isl_space_flatten_range(multi->space);
1011
937
  if (!multi->space)
1012
0
    return FN(MULTI(BASE),free)(multi);
1013
937
1014
937
  return multi;
1015
937
}
isl_multi_aff_flatten_range
Line
Count
Source
999
248
{
1000
248
  if (!multi)
1001
0
    return NULL;
1002
248
1003
248
  if (!multi->space->nested[1])
1004
0
    return multi;
1005
248
1006
248
  multi = FN(MULTI(BASE),cow)(multi);
1007
248
  if (!multi)
1008
0
    return NULL;
1009
248
1010
248
  multi->space = isl_space_flatten_range(multi->space);
1011
248
  if (!multi->space)
1012
0
    return FN(MULTI(BASE),free)(multi);
1013
248
1014
248
  return multi;
1015
248
}
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
688
{
1000
688
  if (!multi)
1001
0
    return NULL;
1002
688
1003
688
  if (!multi->space->nested[1])
1004
0
    return multi;
1005
688
1006
688
  multi = FN(MULTI(BASE),cow)(multi);
1007
688
  if (!multi)
1008
0
    return NULL;
1009
688
1010
688
  multi->space = isl_space_flatten_range(multi->space);
1011
688
  if (!multi->space)
1012
0
    return FN(MULTI(BASE),free)(multi);
1013
688
1014
688
  return multi;
1015
688
}
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
743
{
1023
743
  MULTI(BASE) *multi;
1024
743
1025
743
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
1026
743
  multi = FN(MULTI(BASE),flatten_range)(multi);
1027
743
  return multi;
1028
743
}
isl_multi_aff_flat_range_product
Line
Count
Source
1022
54
{
1023
54
  MULTI(BASE) *multi;
1024
54
1025
54
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
1026
54
  multi = FN(MULTI(BASE),flatten_range)(multi);
1027
54
  return multi;
1028
54
}
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
688
{
1023
688
  MULTI(BASE) *multi;
1024
688
1025
688
  multi = FN(MULTI(BASE),range_product)(multi1, multi2);
1026
688
  multi = FN(MULTI(BASE),flatten_range)(multi);
1027
688
  return multi;
1028
688
}
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
3
{
1046
3
  MULTI(BASE) *res;
1047
3
  unsigned dim;
1048
3
1049
3
  if (!multi1 || !multi2)
1050
0
    goto error;
1051
3
1052
3
  dim = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
1053
3
  if (pos > dim)
1054
3
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1055
3
      "index out of bounds", goto error);
1056
3
1057
3
  res = FN(MULTI(BASE),copy)(multi1);
1058
3
  res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos);
1059
3
  multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos);
1060
3
1061
3
  res = FN(MULTI(BASE),flat_range_product)(res, multi2);
1062
3
  res = FN(MULTI(BASE),flat_range_product)(res, multi1);
1063
3
1064
3
  return res;
1065
3
error:
1066
0
  FN(MULTI(BASE),free)(multi1);
1067
0
  FN(MULTI(BASE),free)(multi2);
1068
0
  return NULL;
1069
3
}
isl_multi_aff_range_splice
Line
Count
Source
1045
3
{
1046
3
  MULTI(BASE) *res;
1047
3
  unsigned dim;
1048
3
1049
3
  if (!multi1 || !multi2)
1050
0
    goto error;
1051
3
1052
3
  dim = FN(MULTI(BASE),dim)(multi1, isl_dim_out);
1053
3
  if (pos > dim)
1054
3
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1055
3
      "index out of bounds", goto error);
1056
3
1057
3
  res = FN(MULTI(BASE),copy)(multi1);
1058
3
  res = FN(MULTI(BASE),drop_dims)(res, isl_dim_out, pos, dim - pos);
1059
3
  multi1 = FN(MULTI(BASE),drop_dims)(multi1, isl_dim_out, 0, pos);
1060
3
1061
3
  res = FN(MULTI(BASE),flat_range_product)(res, multi2);
1062
3
  res = FN(MULTI(BASE),flat_range_product)(res, multi1);
1063
3
1064
3
  return res;
1065
3
error:
1066
0
  FN(MULTI(BASE),free)(multi1);
1067
0
  FN(MULTI(BASE),free)(multi2);
1068
0
  return NULL;
1069
3
}
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
2
{
1099
2
  unsigned n_in1;
1100
2
  unsigned n_in2;
1101
2
1102
2
  if (!multi1 || !multi2)
1103
0
    goto error;
1104
2
1105
2
  n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
1106
2
  if (in_pos > n_in1)
1107
2
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1108
2
      "index out of bounds", goto error);
1109
2
1110
2
  n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
1111
2
1112
2
  multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
1113
2
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
1114
2
            n_in1 - in_pos);
1115
2
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos);
1116
2
1117
2
  return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2);
1118
2
error:
1119
0
  FN(MULTI(BASE),free)(multi1);
1120
0
  FN(MULTI(BASE),free)(multi2);
1121
0
  return NULL;
1122
2
}
isl_multi_aff_splice
Line
Count
Source
1098
2
{
1099
2
  unsigned n_in1;
1100
2
  unsigned n_in2;
1101
2
1102
2
  if (!multi1 || !multi2)
1103
0
    goto error;
1104
2
1105
2
  n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
1106
2
  if (in_pos > n_in1)
1107
2
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1108
2
      "index out of bounds", goto error);
1109
2
1110
2
  n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
1111
2
1112
2
  multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
1113
2
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
1114
2
            n_in1 - in_pos);
1115
2
  multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, 0, in_pos);
1116
2
1117
2
  return FN(MULTI(BASE),range_splice)(multi1, out_pos, multi2);
1118
2
error:
1119
0
  FN(MULTI(BASE),free)(multi1);
1120
0
  FN(MULTI(BASE),free)(multi2);
1121
0
  return NULL;
1122
2
}
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
196
{
1131
196
  isl_bool equal;
1132
196
1133
196
  if (!multi1 || !multi2)
1134
0
    return isl_stat_error;
1135
196
1136
196
  equal = isl_space_is_equal(multi1->space, multi2->space);
1137
196
  if (equal < 0)
1138
0
    return isl_stat_error;
1139
196
  if (!equal)
1140
196
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1141
196
      "spaces don't match", return isl_stat_error);
1142
196
1143
196
  return isl_stat_ok;
1144
196
}
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
188
{
1131
188
  isl_bool equal;
1132
188
1133
188
  if (!multi1 || !multi2)
1134
0
    return isl_stat_error;
1135
188
1136
188
  equal = isl_space_is_equal(multi1->space, multi2->space);
1137
188
  if (equal < 0)
1138
0
    return isl_stat_error;
1139
188
  if (!equal)
1140
188
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi1), isl_error_invalid,
1141
188
      "spaces don't match", return isl_stat_error);
1142
188
1143
188
  return isl_stat_ok;
1144
188
}
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
114
{
1163
114
  int i;
1164
114
1165
114
  multi1 = FN(MULTI(BASE),cow)(multi1);
1166
114
  if (FN(MULTI(BASE),check_equal_space)(multi1, multi2) < 0)
1167
0
    goto error;
1168
114
1169
270
  
for (i = 0; 114
i < multi1->n;
++i156
) {
1170
156
    multi1->u.p[i] = fn(multi1->u.p[i],
1171
156
            FN(EL,copy)(multi2->u.p[i]));
1172
156
    if (!multi1->u.p[i])
1173
0
      goto error;
1174
156
  }
1175
114
1176
114
  if (FN(MULTI(BASE),has_explicit_domain)(multi2))
1177
6
    multi1 = FN(MULTI(BASE),intersect_explicit_domain)(multi1,
1178
6
                    multi2);
1179
114
1180
114
  FN(MULTI(BASE),free)(multi2);
1181
114
  return multi1;
1182
114
error:
1183
0
  FN(MULTI(BASE),free)(multi1);
1184
0
  FN(MULTI(BASE),free)(multi2);
1185
0
  return NULL;
1186
114
}
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
106
{
1163
106
  int i;
1164
106
1165
106
  multi1 = FN(MULTI(BASE),cow)(multi1);
1166
106
  if (FN(MULTI(BASE),check_equal_space)(multi1, multi2) < 0)
1167
0
    goto error;
1168
106
1169
257
  
for (i = 0; 106
i < multi1->n;
++i151
) {
1170
151
    multi1->u.p[i] = fn(multi1->u.p[i],
1171
151
            FN(EL,copy)(multi2->u.p[i]));
1172
151
    if (!multi1->u.p[i])
1173
0
      goto error;
1174
151
  }
1175
106
1176
106
  if (FN(MULTI(BASE),has_explicit_domain)(multi2))
1177
3
    multi1 = FN(MULTI(BASE),intersect_explicit_domain)(multi1,
1178
3
                    multi2);
1179
106
1180
106
  FN(MULTI(BASE),free)(multi2);
1181
106
  return multi1;
1182
106
error:
1183
0
  FN(MULTI(BASE),free)(multi1);
1184
0
  FN(MULTI(BASE),free)(multi2);
1185
0
  return NULL;
1186
106
}
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
24
{
1214
24
  return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,sub));
1215
24
}
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
24
{
1214
24
  return FN(MULTI(BASE),bin_op)(multi1, multi2, &FN(EL,sub));
1215
24
}
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
24
{
1222
24
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1223
24
            &FN(MULTI(BASE),sub_aligned));
1224
24
}
Unexecuted instantiation: isl_multi_aff_sub
Unexecuted instantiation: isl_multi_pw_aff_sub
isl_multi_union_pw_aff_sub
Line
Count
Source
1221
24
{
1222
24
  return FN(MULTI(BASE),align_params_multi_multi_and)(multi1, multi2,
1223
24
            &FN(MULTI(BASE),sub_aligned));
1224
24
}
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
22
{
1309
22
  int i;
1310
22
1311
22
  if (!multi || !mv)
1312
0
    goto error;
1313
22
1314
22
  if (!isl_space_tuple_is_equal(multi->space, isl_dim_out,
1315
22
          mv->space, isl_dim_set))
1316
22
    
isl_die0
(isl_multi_val_get_ctx(mv), isl_error_invalid,
1317
22
      "spaces don't match", goto error);
1318
22
1319
22
  multi = FN(MULTI(BASE),cow)(multi);
1320
22
  if (!multi)
1321
0
    goto error;
1322
22
1323
69
  
for (i = 0; 22
i < multi->n;
++i47
) {
1324
47
    isl_val *v;
1325
47
1326
47
    v = isl_multi_val_get_val(mv, i);
1327
47
    multi->u.p[i] = FN(EL,scale_val)(multi->u.p[i], v);
1328
47
    if (!multi->u.p[i])
1329
0
      goto error;
1330
47
  }
1331
22
1332
22
  isl_multi_val_free(mv);
1333
22
  return multi;
1334
22
error:
1335
0
  isl_multi_val_free(mv);
1336
0
  return FN(MULTI(BASE),free)(multi);
1337
22
}
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
22
{
1309
22
  int i;
1310
22
1311
22
  if (!multi || !mv)
1312
0
    goto error;
1313
22
1314
22
  if (!isl_space_tuple_is_equal(multi->space, isl_dim_out,
1315
22
          mv->space, isl_dim_set))
1316
22
    
isl_die0
(isl_multi_val_get_ctx(mv), isl_error_invalid,
1317
22
      "spaces don't match", goto error);
1318
22
1319
22
  multi = FN(MULTI(BASE),cow)(multi);
1320
22
  if (!multi)
1321
0
    goto error;
1322
22
1323
69
  
for (i = 0; 22
i < multi->n;
++i47
) {
1324
47
    isl_val *v;
1325
47
1326
47
    v = isl_multi_val_get_val(mv, i);
1327
47
    multi->u.p[i] = FN(EL,scale_val)(multi->u.p[i], v);
1328
47
    if (!multi->u.p[i])
1329
0
      goto error;
1330
47
  }
1331
22
1332
22
  isl_multi_val_free(mv);
1333
22
  return multi;
1334
22
error:
1335
0
  isl_multi_val_free(mv);
1336
0
  return FN(MULTI(BASE),free)(multi);
1337
22
}
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
734
{
1501
734
  int i;
1502
734
  isl_bool equal;
1503
734
1504
734
  if (!multi1 || !multi2)
1505
0
    return isl_bool_error;
1506
734
  if (multi1->n != multi2->n)
1507
0
    return isl_bool_false;
1508
734
  equal = isl_space_is_equal(multi1->space, multi2->space);
1509
734
  if (equal < 0 || !equal)
1510
0
    return equal;
1511
734
1512
1.06k
  
for (i = 0; 734
i < multi1->n;
++i331
) {
1513
837
    equal = FN(EL,plain_is_equal)(multi1->u.p[i], multi2->u.p[i]);
1514
837
    if (equal < 0 || !equal)
1515
506
      return equal;
1516
837
  }
1517
734
1518
734
  
if (228
FN228
(MULTI(BASE),has_explicit_domain)(multi1)228
||
1519
228
      
FN140
(MULTI(BASE),has_explicit_domain)(multi2)140
) {
1520
88
    equal = FN(MULTI(BASE),equal_explicit_domain)(multi1, multi2);
1521
88
    if (equal < 0 || !equal)
1522
0
      return equal;
1523
228
  }
1524
228
1525
228
  return isl_bool_true;
1526
228
}
isl_multi_aff_plain_is_equal
Line
Count
Source
1500
562
{
1501
562
  int i;
1502
562
  isl_bool equal;
1503
562
1504
562
  if (!multi1 || !multi2)
1505
0
    return isl_bool_error;
1506
562
  if (multi1->n != multi2->n)
1507
0
    return isl_bool_false;
1508
562
  equal = isl_space_is_equal(multi1->space, multi2->space);
1509
562
  if (equal < 0 || !equal)
1510
0
    return equal;
1511
562
1512
782
  
for (i = 0; 562
i < multi1->n;
++i220
) {
1513
726
    equal = FN(EL,plain_is_equal)(multi1->u.p[i], multi2->u.p[i]);
1514
726
    if (equal < 0 || !equal)
1515
506
      return equal;
1516
726
  }
1517
562
1518
562
  
if (56
FN56
(MULTI(BASE),has_explicit_domain)(multi1)56
||
1519
56
      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
56
  }
1524
56
1525
56
  return isl_bool_true;
1526
56
}
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
346
{
1532
346
  int i;
1533
346
1534
346
  if (!multi)
1535
0
    return isl_bool_error;
1536
346
  if (multi->n == 0)
1537
4
    return isl_bool_false;
1538
342
1539
1.00k
  
for (i = 0; 342
i < multi->n;
++i662
) {
1540
664
    isl_bool has_nan = FN(EL,involves_nan)(multi->u.p[i]);
1541
664
    if (has_nan < 0 || has_nan)
1542
2
      return has_nan;
1543
664
  }
1544
342
1545
342
  
return isl_bool_false340
;
1546
342
}
isl_multi_aff_involves_nan
Line
Count
Source
1531
346
{
1532
346
  int i;
1533
346
1534
346
  if (!multi)
1535
0
    return isl_bool_error;
1536
346
  if (multi->n == 0)
1537
4
    return isl_bool_false;
1538
342
1539
1.00k
  
for (i = 0; 342
i < multi->n;
++i662
) {
1540
664
    isl_bool has_nan = FN(EL,involves_nan)(multi->u.p[i]);
1541
664
    if (has_nan < 0 || has_nan)
1542
2
      return has_nan;
1543
664
  }
1544
342
1545
342
  
return isl_bool_false340
;
1546
342
}
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