2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
11 #include <isl_pw_macro.h>
13 /* Data structure that specifies how isl_pw_*_un_op should
16 * If "fn_space" is set, then it is applied to the space.
18 * If "fn_domain" is set, then it is applied to the cells.
20 * "fn_base" is applied to each base expression.
21 * This function is assumed to have no effect on the default value
22 * (i.e., zero for those objects with a default value).
25 __isl_give isl_space
*(*fn_space
)(__isl_take isl_space
*space
);
26 __isl_give isl_set
*(*fn_domain
)(__isl_take isl_set
*domain
);
27 __isl_give EL
*(*fn_base
)(__isl_take EL
*el
);
30 /* Modify "pw" based on "control".
32 * If the cells are modified, then the corresponding base expressions
33 * may need to be adjusted to the possibly modified equality constraints.
35 static __isl_give PW
*FN(PW
,un_op
)(__isl_take PW
*pw
,
36 S(PW
,un_op_control
) *control
)
42 n
= FN(PW
,n_piece
)(pw
);
44 return FN(PW
,free
)(pw
);
46 for (i
= n
- 1; i
>= 0; --i
) {
50 el
= FN(PW
,take_base_at
)(pw
, i
);
51 el
= control
->fn_base(el
);
52 pw
= FN(PW
,restore_base_at
)(pw
, i
, el
);
54 if (!control
->fn_domain
)
57 domain
= FN(PW
,take_domain_at
)(pw
, i
);
58 domain
= control
->fn_domain(domain
);
59 pw
= FN(PW
,restore_domain_at
)(pw
, i
, domain
);
61 pw
= FN(PW
,exploit_equalities_and_remove_if_empty
)(pw
, i
);
64 if (!control
->fn_space
)
67 space
= FN(PW
,take_space
)(pw
);
68 space
= control
->fn_space(space
);
69 pw
= FN(PW
,restore_space
)(pw
, space
);