Polly 20.0.0git
isl_multi_pw_aff_explicit_domain.c
Go to the documentation of this file.
1/*
2 * Copyright 2017 Sven Verdoolaege
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege.
7 */
8
9/* Initialize the explicit domain of "mpa".
10 *
11 * The explicit domain is initialized to a universe set
12 * in the domain space.
13 */
16{
17 if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
18 return isl_multi_pw_aff_free(mpa);
19 mpa->u.dom = isl_set_universe(isl_multi_pw_aff_get_domain_space(mpa));
20 if (!mpa->u.dom)
21 return isl_multi_pw_aff_free(mpa);
22 return mpa;
23}
24
25/* Intersect the domain of "dst" with the domain product
26 * of the explicit domains of "src1" and "src2".
27 * This function is only called if at least one of "src1" or "src2"
28 * has an explicit domain.
29 */
34{
35 isl_space *space;
36 isl_set *dom;
37 isl_map *map;
38
39 if (!src1 || !src2)
40 return FN(isl_multi_pw_aff,free)(dst);
41 space = isl_multi_pw_aff_get_domain_space(dst);
42 dom = isl_set_universe(space);
43 map = isl_set_unwrap(dom);
44 if (isl_multi_pw_aff_has_explicit_domain(src1)) {
45 dom = isl_set_copy(src1->u.dom);
47 }
48 if (isl_multi_pw_aff_has_explicit_domain(src2)) {
49 dom = isl_set_copy(src2->u.dom);
51 }
52 dom = isl_map_wrap(map);
54 return dst;
55}
56
57/* Check whether the explicit domain of "mpa" has non-zero coefficients
58 * for any dimension in the given range or if any of these dimensions appear
59 * with non-zero coefficients in any of the integer divisions involved.
60 */
63 enum isl_dim_type type, unsigned pos, unsigned n)
64{
65 if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
66 return isl_bool_error;
67 if (type == isl_dim_in)
69 return isl_set_involves_dims(mpa->u.dom, type, pos, n);
70}
71
72/* Insert "n" dimensions of type "type" at position "pos"
73 * of the explicit domain of "mpa".
74 */
77 enum isl_dim_type type, unsigned pos, unsigned n)
78{
79 if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
80 return isl_multi_pw_aff_free(mpa);
81 mpa = isl_multi_pw_aff_cow(mpa);
82 if (!mpa)
83 return NULL;
84 if (type == isl_dim_in)
86 mpa->u.dom = isl_set_insert_dims(mpa->u.dom, type, pos, n);
87 if (!mpa->u.dom)
88 return isl_multi_pw_aff_free(mpa);
89 return mpa;
90}
91
92/* Drop the "n" dimensions of type "type" starting at position "pos"
93 * of the explicit domain of "mpa".
94 */
97 enum isl_dim_type type, unsigned pos, unsigned n)
98{
99 if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
100 return isl_multi_pw_aff_free(mpa);
101 mpa = isl_multi_pw_aff_cow(mpa);
102 if (!mpa)
103 return NULL;
104 if (type == isl_dim_in)
106 mpa->u.dom = isl_set_drop(mpa->u.dom, type, pos, n);
107 if (!mpa->u.dom)
108 return isl_multi_pw_aff_free(mpa);
109 return mpa;
110}
111
112/* Move the "n" dimensions of "src_type" starting at "src_pos" of
113 * of the explicit domain of "mpa" to dimensions of "dst_type" at "dst_pos".
114 */
117 enum isl_dim_type dst_type, unsigned dst_pos,
118 enum isl_dim_type src_type, unsigned src_pos, unsigned n)
119{
120 if (isl_multi_pw_aff_check_has_explicit_domain(mpa) < 0)
121 return isl_multi_pw_aff_free(mpa);
122 mpa = isl_multi_pw_aff_cow(mpa);
123 if (!mpa)
124 return NULL;
125 if (dst_type == isl_dim_in)
126 dst_type = isl_dim_set;
127 if (src_type == isl_dim_in)
128 src_type = isl_dim_set;
129 mpa->u.dom = isl_set_move_dims(mpa->u.dom, dst_type, dst_pos,
130 src_type, src_pos, n);
131 if (!mpa->u.dom)
132 return isl_multi_pw_aff_free(mpa);
133 return mpa;
134}
__isl_export __isl_give isl_multi_pw_aff * isl_multi_pw_aff_intersect_domain(__isl_take isl_multi_pw_aff *mpa, __isl_take isl_set *domain)
struct isl_multi_pw_aff isl_multi_pw_aff
Definition: aff_type.h:43
#define FN(TYPE, NAME)
#define __isl_take
Definition: ctx.h:22
#define __isl_give
Definition: ctx.h:19
#define __isl_keep
Definition: ctx.h:25
isl_bool
Definition: ctx.h:89
@ isl_bool_error
Definition: ctx.h:90
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_map.c:70
__isl_give isl_set * isl_set_drop(__isl_take isl_set *set, enum isl_dim_type type, unsigned first, unsigned n)
Definition: isl_map.c:2504
static __isl_give isl_multi_pw_aff * isl_multi_pw_aff_init_explicit_domain(__isl_take isl_multi_pw_aff *mpa)
static __isl_give isl_multi_pw_aff * isl_multi_pw_aff_insert_explicit_domain_dims(__isl_take isl_multi_pw_aff *mpa, enum isl_dim_type type, unsigned pos, unsigned n)
static __isl_give isl_multi_pw_aff * isl_multi_pw_aff_intersect_explicit_domain_product(__isl_take isl_multi_pw_aff *dst, __isl_keep isl_multi_pw_aff *src1, __isl_keep isl_multi_pw_aff *src2)
isl_bool isl_multi_pw_aff_involves_explicit_domain_dims(__isl_keep isl_multi_pw_aff *mpa, enum isl_dim_type type, unsigned pos, unsigned n)
static __isl_give isl_multi_pw_aff * isl_multi_pw_aff_drop_explicit_domain_dims(__isl_take isl_multi_pw_aff *mpa, enum isl_dim_type type, unsigned pos, unsigned n)
static __isl_give isl_multi_pw_aff * isl_multi_pw_aff_move_explicit_domain_dims(__isl_take isl_multi_pw_aff *mpa, enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n)
enum isl_fold type
Definition: isl_test.c:4017
const char * map
Definition: isl_test.c:1783
__isl_export __isl_give isl_map * isl_map_intersect_range(__isl_take isl_map *map, __isl_take isl_set *set)
Definition: isl_map.c:8325
__isl_export __isl_give isl_map * isl_map_intersect_domain(__isl_take isl_map *map, __isl_take isl_set *set)
Definition: isl_map.c:8353
__isl_export __isl_give isl_map * isl_set_unwrap(__isl_take isl_set *set)
Definition: isl_map.c:12239
__isl_export __isl_give isl_set * isl_map_wrap(__isl_take isl_map *map)
Definition: isl_map.c:12213
struct isl_set isl_set
Definition: map_type.h:26
__isl_export __isl_give isl_set * isl_set_universe(__isl_take isl_space *space)
Definition: isl_map.c:6366
__isl_give isl_set * isl_set_copy(__isl_keep isl_set *set)
Definition: isl_map.c:1470
isl_bool isl_set_involves_dims(__isl_keep isl_set *set, enum isl_dim_type type, unsigned first, unsigned n)
Definition: isl_map.c:2986
__isl_give isl_set * isl_set_move_dims(__isl_take isl_set *set, enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n)
Definition: isl_map.c:4321
__isl_give isl_set * isl_set_insert_dims(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, unsigned n)
Definition: isl_map.c:4187
isl_dim_type
Definition: space_type.h:13
@ isl_dim_in
Definition: space_type.h:16
@ isl_dim_set
Definition: space_type.h:18
n
Definition: youcefn.c:8