Polly 20.0.0git
isl_multi_dim_id_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2011 Sven Verdoolaege
3 * Copyright 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/space.h>
12
13#include <isl_multi_macro.h>
14
15/* Return the position of the dimension of the given type and name
16 * in "multi".
17 * Return -1 if no such dimension can be found.
18 */
19int FN(MULTI(BASE),find_dim_by_name)(__isl_keep MULTI(BASE) *multi,
20 enum isl_dim_type type, const char *name)
21{
22 if (!multi)
23 return -1;
24 return isl_space_find_dim_by_name(multi->space, type, name);
25}
26
27/* Return the position of the first dimension of "type" with id "id".
28 * Return -1 if there is no such dimension.
29 */
30int FN(MULTI(BASE),find_dim_by_id)(__isl_keep MULTI(BASE) *multi,
32{
33 if (!multi)
34 return -1;
35 return isl_space_find_dim_by_id(multi->space, type, id);
36}
37
38/* Return the id of the given dimension.
39 */
41 enum isl_dim_type type, unsigned pos)
42{
43 return multi ? isl_space_get_dim_id(multi->space, type, pos) : NULL;
44}
45
47 __isl_take MULTI(BASE) *multi,
48 enum isl_dim_type type, unsigned pos, const char *s)
49{
50 isl_space *space;
51
52 space = FN(MULTI(BASE),get_space)(multi);
53 space = isl_space_set_dim_name(space, type, pos, s);
54
55 return FN(MULTI(BASE),reset_space)(multi, space);
56}
57
58/* Set the id of the given dimension of "multi" to "id".
59 */
60__isl_give MULTI(BASE) *FN(MULTI(BASE),set_dim_id)(
61 __isl_take MULTI(BASE) *multi,
62 enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
63{
64 isl_space *space;
65
66 space = FN(MULTI(BASE),get_space)(multi);
67 space = isl_space_set_dim_id(space, type, pos, id);
68
69 return FN(MULTI(BASE),reset_space)(multi, space);
70}
#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
#define BASE
Definition: flow_cmp.c:49
static __isl_give isl_qpolynomial * set_dim_name(__isl_take isl_qpolynomial *qp, void *user)
Definition: isl_fold.c:330
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_map.c:70
#define MULTI(BASE)
enum isl_fold type
Definition: isl_test.c:4017
const char * name
Definition: isl_test.c:10938
const char * id
Definition: isl_test.c:7279
__isl_give isl_space * isl_space_set_dim_id(__isl_take isl_space *space, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
Definition: isl_space.c:704
int isl_space_find_dim_by_id(__isl_keep isl_space *space, enum isl_dim_type type, __isl_keep isl_id *id)
Definition: isl_space.c:870
__isl_give isl_space * isl_space_set_dim_name(__isl_take isl_space *space, enum isl_dim_type type, unsigned pos, __isl_keep const char *name)
__isl_give isl_id * isl_space_get_dim_id(__isl_keep isl_space *space, enum isl_dim_type type, unsigned pos)
Definition: isl_space.c:774
int isl_space_find_dim_by_name(__isl_keep isl_space *space, enum isl_dim_type type, const char *name)
Definition: isl_space.c:889
isl_dim_type
Definition: space_type.h:13