X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_space.c;h=6a6b5f506b08323e05b6669950c05dcfce584216;hb=5101b7ae9da080449ec4680703f376da6a5d8d22;hp=88b9626858e98a40bc042cd8fcc258e405cb3bc4;hpb=556d287f982d8cc1a6f1fd6a318e926c95dbebf4;p=platform%2Fupstream%2Fisl.git diff --git a/isl_space.c b/isl_space.c index 88b9626..6a6b5f5 100644 --- a/isl_space.c +++ b/isl_space.c @@ -434,17 +434,37 @@ error: return NULL; } -__isl_give isl_space *isl_space_set_dim_id(__isl_take isl_space *dim, +/* Set the id of the given dimension of "space" to "id". + * If the dimension already has an id, then it is replaced. + * If the dimension is a parameter, then we need to change it + * in the nested spaces (if any) as well. + */ +__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) { - dim = isl_space_cow(dim); - if (!dim || !id) + space = isl_space_cow(space); + if (!space || !id) goto error; - isl_id_free(get_id(dim, type, pos)); - return set_id(dim, type, pos, id); + + if (type == isl_dim_param) { + int i; + + for (i = 0; i < 2; ++i) { + if (!space->nested[i]) + continue; + space->nested[i] = + isl_space_set_dim_id(space->nested[i], + type, pos, isl_id_copy(id)); + if (!space->nested[i]) + goto error; + } + } + + isl_id_free(get_id(space, type, pos)); + return set_id(space, type, pos, id); error: isl_id_free(id); - isl_space_free(dim); + isl_space_free(space); return NULL; } @@ -517,6 +537,19 @@ error: return NULL; } +/* Does the given dimension have a name? + */ +int isl_space_has_dim_name(__isl_keep isl_space *space, + enum isl_dim_type type, unsigned pos) +{ + isl_id *id; + + if (!space) + return -1; + id = get_id(space, type, pos); + return id && id->name; +} + __isl_keep const char *isl_space_get_dim_name(__isl_keep isl_space *dim, enum isl_dim_type type, unsigned pos) {