2 * Copyright 2013 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
10 #include <isl/space.h>
11 #include <isl/local_space.h>
12 #include <isl_reordering.h>
14 #include <isl_multi_macro.h>
16 /* The functions in this file are meant for base object types
17 * that do not have any associated space. They are only meant to be used
18 * in the generic isl_multi_* functions which have to deal with base objects
19 * that do have an associated space.
23 /* Drop the "n" first dimensions of type "type" at position "first".
25 * For a base expression without an associated space, this function
26 * does not do anything.
28 static __isl_give EL
*FN(EL
,drop_dims
)(__isl_take EL
*el
,
29 enum isl_dim_type type
, unsigned first
, unsigned n
)
34 /* Return the space of "el".
36 * For a base expression without an associated space,
37 * the conditions surrounding the call to this function make sure
38 * that this function will never actually get called. We return a valid
39 * space anyway, just in case.
41 static __isl_give isl_space
*FN(EL
,get_space
)(__isl_keep EL
*el
)
46 return isl_space_params_alloc(FN(EL
,get_ctx
)(el
), 0);
49 /* Reset the domain space of "el" to "space".
51 * For a base expression without an associated space, this function
52 * does not do anything, apart from error handling and cleaning up memory.
54 static __isl_give EL
*FN(EL
,reset_domain_space
)(__isl_take EL
*el
,
55 __isl_take isl_space
*space
)
58 return FN(EL
,free
)(el
);
59 isl_space_free(space
);
63 /* Align the parameters of "el" to those of "space".
65 * For a base expression without an associated space, this function
66 * does not do anything, apart from error handling and cleaning up memory.
67 * Note that the conditions surrounding the call to this function make sure
68 * that this function will never actually get called.
70 static __isl_give EL
*FN(EL
,align_params
)(__isl_take EL
*el
,
71 __isl_take isl_space
*space
)
74 return FN(EL
,free
)(el
);
75 isl_space_free(space
);
79 /* Reorder the dimensions of the domain of "el" according
80 * to the given reordering.
82 * For a base expression without an associated space, this function
83 * does not do anything, apart from error handling and cleaning up memory.
85 static __isl_give EL
*FN(EL
,realign_domain
)(__isl_take EL
*el
,
86 __isl_take isl_reordering
*r
)
89 return FN(EL
,free
)(el
);
90 isl_reordering_free(r
);
94 /* Do the parameters of "el" match those of "space"?
96 * For a base expression without an associated space, this function
97 * simply returns true, except if "el" or "space" are NULL.
99 static isl_bool
FN(EL
,matching_params
)(__isl_keep EL
*el
,
100 __isl_keep isl_space
*space
)
103 return isl_bool_error
;
104 return isl_bool_true
;
107 /* Check that the domain space of "el" matches "space".
109 * For a base expression without an associated space, this function
110 * simply returns isl_stat_ok, except if "el" or "space" are NULL.
112 static isl_stat
FN(EL
,check_match_domain_space
)(__isl_keep EL
*el
,
113 __isl_keep isl_space
*space
)
116 return isl_stat_error
;