Coverage Report

Created: 2018-06-19 22:08

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