1 #ifndef PET_SCOP_PLUS_H
2 #define PET_SCOP_PLUS_H
11 /* Compare two sequences of identifiers based on their names.
13 struct array_desc_less
{
14 bool operator()(isl_id_list
*x
, isl_id_list
*y
) {
15 int x_n
= isl_id_list_n_id(x
);
16 int y_n
= isl_id_list_n_id(y
);
18 for (int i
= 0; i
< x_n
&& i
< y_n
; ++i
) {
19 isl_id
*x_i
= isl_id_list_get_id(x
, i
);
20 isl_id
*y_i
= isl_id_list_get_id(y
, i
);
21 const char *x_name
= isl_id_get_name(x_i
);
22 const char *y_name
= isl_id_get_name(y_i
);
23 int cmp
= strcmp(x_name
, y_name
);
34 /* array_desc_set is a wrapper around a sorted set of identifier sequences,
35 * with each identifier representing a (possibly renamed) ValueDecl.
36 * The actual order is not important, only that it is consistent
38 * The wrapper takes care of the memory management of the isl_id_list objects.
39 * In particular, the set keeps hold of its own reference to these objects.
41 struct array_desc_set
: public std::set
<isl_id_list
*, array_desc_less
>
43 void insert(__isl_take isl_id_list
*list
) {
44 if (find(list
) == end())
47 isl_id_list_free(list
);
49 void erase(__isl_keep isl_id_list
*list
) {
56 isl_id_list_free(*it
);
62 for (it
= begin(); it
!= end(); ++it
)
63 isl_id_list_free(*it
);
67 void pet_scop_collect_arrays(struct pet_scop
*scop
, array_desc_set
&arrays
);