interface: update to move of llvm/Support/Host.h to llvm/TargetParser/Host.h
[isl.git] / isl_copy_tuple_id_templ.c
blob5345ab3624a13dbcb0155fe6c40625eb8709a1b1
1 /*
2 * Copyright 2019 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
8 */
10 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
11 #define FN(TYPE,NAME) xFN(TYPE,NAME)
13 /* Copy the identifier of tuple "src_type" in "src"
14 * to that of "dst_type" in "dst", if there is any such identifier.
16 __isl_give TYPE *FN(TYPE,copy_tuple_id)(__isl_take TYPE *dst,
17 enum isl_dim_type dst_type, __isl_keep isl_space *src,
18 enum isl_dim_type src_type)
20 isl_bool has_id;
21 isl_id *id;
23 has_id = isl_space_has_tuple_id(src, src_type);
24 if (has_id < 0)
25 return FN(TYPE,free)(dst);
26 if (!has_id)
27 return dst;
29 id = isl_space_get_tuple_id(src, src_type);
30 dst = FN(TYPE,set_tuple_id)(dst, dst_type, id);
32 return dst;