2 * Copyright 2018 Cerebras Systems
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
10 /* Bind the expressions of "multi" to parameters with identifiers
11 * specified by "tuple", living in the same space as
12 * (the target space of) "multi",
13 * returning the elements in the domain where the expressions
14 * are equal to the parameters.
16 __isl_give DOM
*FN(MULTI(BASE
),bind
)(__isl_take
MULTI(BASE
) *multi
,
17 __isl_take isl_multi_id
*tuple
)
23 isl_space
*multi_space
, *tuple_space
;
27 multi_space
= isl_space_range(FN(MULTI(BASE
),get_space
)(multi
));
28 tuple_space
= isl_multi_id_peek_space(tuple
);
29 r
= isl_space_check_equal_tuples(multi_space
, tuple_space
);
30 isl_space_free(multi_space
);
33 n
= FN(MULTI(BASE
),dim
)(multi
, isl_dim_set
);
38 isl_multi_id_free(tuple
);
39 return FN(MULTI(BASE
),domain
)(multi
);
42 el
= FN(MULTI(BASE
),get_at
)(multi
, 0);
43 id
= isl_multi_id_get_at(tuple
, 0);
44 bnd
= FN(EL
,bind_id
)(el
, id
);
46 for (i
= 1; i
< n
; ++i
) {
49 el
= FN(MULTI(BASE
),get_at
)(multi
, i
);
50 id
= isl_multi_id_get_at(tuple
, i
);
51 bnd_i
= FN(EL
,bind_id
)(el
, id
);
53 bnd_i
= FN(DOM
,align_params
)(bnd_i
, FN(DOM
,get_space
)(bnd
));
54 bnd
= FN(DOM
,align_params
)(bnd
, FN(DOM
,get_space
)(bnd_i
));
55 bnd
= FN(DOM
,intersect
)(bnd
, bnd_i
);
58 FN(MULTI(BASE
),free
)(multi
);
59 isl_multi_id_free(tuple
);
62 FN(MULTI(BASE
),free
)(multi
);
63 isl_multi_id_free(tuple
);