Polly 23.0.0git
isl_copy_tuple_id_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2019 Cerebras Systems
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
8 */
9
10#define xCAT(A,B) A ## B
11#define CAT(A,B) xCAT(A,B)
12#undef TYPE
13#define TYPE CAT(isl_,BASE)
14#define xBFN(BASE,NAME) isl_ ## BASE ## _ ## NAME
15#define BFN(BASE,NAME) xBFN(BASE,NAME)
16
17/* Copy the identifier of tuple "src_type" in "src"
18 * to that of "dst_type" in "dst", if there is any such identifier.
19 */
20__isl_give TYPE *BFN(BASE,copy_tuple_id)(__isl_take TYPE *dst,
21 enum isl_dim_type dst_type, __isl_keep isl_space *src,
22 enum isl_dim_type src_type)
23{
24 isl_bool has_id;
25 isl_id *id;
26
27 has_id = isl_space_has_tuple_id(src, src_type);
28 if (has_id < 0)
29 return FN(TYPE,free)(dst);
30 if (!has_id)
31 return dst;
32
33 id = isl_space_get_tuple_id(src, src_type);
34 dst = FN(TYPE,set_tuple_id)(dst, dst_type, id);
35
36 return dst;
37}
#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
#define BASE
Definition flow_cmp.c:49
#define BFN(BASE, NAME)
const char * id
Definition isl_test.c:7131
isl_bool isl_space_has_tuple_id(__isl_keep isl_space *space, enum isl_dim_type type)
Definition isl_space.c:605
__isl_give isl_id * isl_space_get_tuple_id(__isl_keep isl_space *space, enum isl_dim_type type)
Definition isl_space.c:631
isl_dim_type
Definition space_type.h:13