@@ -61,10 +61,10 @@ int isl_hash_table_init(struct isl_ctx *ctx, struct isl_hash_table *table,
void isl_hash_table_clear(struct isl_hash_table *table);
extern struct isl_hash_table_entry *isl_hash_table_entry_none;
struct isl_hash_table_entry *isl_hash_table_find(struct isl_ctx *ctx,
- struct isl_hash_table *table,
- uint32_t key_hash,
- int (*eq)(const void *entry, const void *val),
- const void *val, int reserve);
+ struct isl_hash_table *table,
+ uint32_t key_hash,
+ isl_bool (*eq)(const void *entry, const void *val),
+ const void *val, int reserve);
isl_stat isl_hash_table_foreach(isl_ctx *ctx, struct isl_hash_table *table,
isl_stat (*fn)(void **entry, void *user), void *user);
void isl_hash_table_remove(struct isl_ctx *ctx,
@@ -128,7 +128,7 @@ __isl_give ISL_HMAP *ISL_FN(ISL_HMAP,copy)(__isl_keep ISL_HMAP *hmap)
return hmap;
}
-static int has_key(const void *entry, const void *c_key)
+static isl_bool has_key(const void *entry, const void *c_key)
{
const ISL_S(pair) *pair = entry;
ISL_KEY *key = (ISL_KEY *) c_key;
@@ -1519,12 +1519,12 @@ struct max_constraint {
int ineq;
};
-static int max_constraint_equal(const void *entry, const void *val)
+static isl_bool max_constraint_equal(const void *entry, const void *val)
{
struct max_constraint *a = (struct max_constraint *)entry;
isl_int *b = (isl_int *)val;
- return isl_seq_eq(a->c->row[0] + 1, b, a->c->n_col - 1);
+ return isl_bool_ok(isl_seq_eq(a->c->row[0] + 1, b, a->c->n_col - 1));
}
static isl_stat update_constraint(struct isl_ctx *ctx,
@@ -2031,13 +2031,13 @@ struct ineq_cmp_data {
isl_int *p;
};
-static int has_ineq(const void *entry, const void *val)
+static isl_bool has_ineq(const void *entry, const void *val)
{
isl_int *row = (isl_int *)entry;
struct ineq_cmp_data *v = (struct ineq_cmp_data *)val;
- return isl_seq_eq(row + 1, v->p + 1, v->len) ||
- isl_seq_is_neg(row + 1, v->p + 1, v->len);
+ return isl_bool_ok(isl_seq_eq(row + 1, v->p + 1, v->len) ||
+ isl_seq_is_neg(row + 1, v->p + 1, v->len));
}
static int hash_ineq(struct isl_ctx *ctx, struct isl_hash_table *table,
@@ -63,9 +63,9 @@ int isl_hash_table_init(struct isl_ctx *ctx, struct isl_hash_table *table,
/* Dummy comparison function that always returns false.
*/
-static int no(const void *entry, const void *val)
+static isl_bool no(const void *entry, const void *val)
{
- return 0;
+ return isl_bool_false;
}
/* Extend "table" to twice its size.
@@ -155,20 +155,27 @@ static struct isl_hash_table_entry none = { 0, NULL };
struct isl_hash_table_entry *isl_hash_table_entry_none = &none;
struct isl_hash_table_entry *isl_hash_table_find(struct isl_ctx *ctx,
- struct isl_hash_table *table,
- uint32_t key_hash,
- int (*eq)(const void *entry, const void *val),
- const void *val, int reserve)
+ struct isl_hash_table *table,
+ uint32_t key_hash,
+ isl_bool (*eq)(const void *entry, const void *val),
+ const void *val, int reserve)
{
size_t size;
uint32_t h, key_bits;
key_bits = isl_hash_bits(key_hash, table->bits);
size = 1 << table->bits;
- for (h = key_bits; table->entries[h].data; h = (h+1) % size)
- if (table->entries[h].hash == key_hash &&
- eq(table->entries[h].data, val))
+ for (h = key_bits; table->entries[h].data; h = (h+1) % size) {
+ isl_bool equal;
+
+ if (table->entries[h].hash != key_hash)
+ continue;
+ equal = eq(table->entries[h].data, val);
+ if (equal < 0)
+ return NULL;
+ if (equal)
return &table->entries[h];
+ }
if (!reserve)
return isl_hash_table_entry_none;
@@ -81,19 +81,19 @@ struct isl_name_and_user {
void *user;
};
-static int isl_id_has_name_and_user(const void *entry, const void *val)
+static isl_bool isl_id_has_name_and_user(const void *entry, const void *val)
{
isl_id *id = (isl_id *)entry;
struct isl_name_and_user *nu = (struct isl_name_and_user *) val;
if (id->user != nu->user)
- return 0;
+ return isl_bool_false;
if (id->name == nu->name)
- return 1;
+ return isl_bool_true;
if (!id->name || !nu->name)
- return 0;
+ return isl_bool_false;
- return !strcmp(id->name, nu->name);
+ return isl_bool_ok(!strcmp(id->name, nu->name));
}
__isl_give isl_id *isl_id_alloc(isl_ctx *ctx, const char *name, void *user)
@@ -164,9 +164,9 @@ int isl_id_cmp(__isl_keep isl_id *id1, __isl_keep isl_id *id2)
return 1;
}
-static int isl_id_eq(const void *entry, const void *name)
+static isl_bool isl_id_eq(const void *entry, const void *name)
{
- return entry == name;
+ return isl_bool_ok(entry == name);
}
uint32_t isl_hash_id(uint32_t hash, __isl_keep isl_id *id)
#include <isl/id.h>
#include <isl/ast.h>
-#define isl_id_is_equal(id1,id2) id1 == id2
+#define isl_id_is_equal(id1,id2) isl_bool_ok(id1 == id2)
#define ISL_KEY isl_id
#define ISL_VAL isl_ast_expr
#include <isl/id.h>
#include <isl/aff.h>
-#define isl_id_is_equal(id1,id2) id1 == id2
+#define isl_id_is_equal(id1,id2) isl_bool_ok(id1 == id2)
#define ISL_KEY isl_id
#define ISL_VAL isl_pw_aff
@@ -126,7 +126,7 @@ struct isl_sched_node {
isl_vec *max;
};
-static int node_has_tuples(const void *entry, const void *val)
+static isl_bool node_has_tuples(const void *entry, const void *val)
{
struct isl_sched_node *node = (struct isl_sched_node *)entry;
isl_space *space = (isl_space *) val;
@@ -452,12 +452,12 @@ static int is_node(struct isl_sched_graph *graph,
return node && node >= &graph->node[0] && node < &graph->node[graph->n];
}
-static int edge_has_src_and_dst(const void *entry, const void *val)
+static isl_bool edge_has_src_and_dst(const void *entry, const void *val)
{
const struct isl_sched_edge *edge = entry;
const struct isl_sched_edge *temp = val;
- return edge->src == temp->src && edge->dst == temp->dst;
+ return isl_bool_ok(edge->src == temp->src && edge->dst == temp->dst);
}
/* Add the given edge to graph->edge_table[type].
@@ -20,11 +20,11 @@ struct isl_keyword {
enum isl_token_type type;
};
-static int same_name(const void *entry, const void *val)
+static isl_bool same_name(const void *entry, const void *val)
{
const struct isl_keyword *keyword = (const struct isl_keyword *)entry;
- return !strcmp(keyword->name, val);
+ return isl_bool_ok(!strcmp(keyword->name, val));
}
enum isl_token_type isl_stream_register_keyword(__isl_keep isl_stream *s,
@@ -4566,12 +4566,14 @@ struct isl_constraint_equal_info {
/* Check whether the coefficients of the output variables
* of the constraint in "entry" are equal to info->val.
*/
-static int constraint_equal(const void *entry, const void *val)
+static isl_bool constraint_equal(const void *entry, const void *val)
{
isl_int **row = (isl_int **)entry;
const struct isl_constraint_equal_info *info = val;
+ int eq;
- return isl_seq_eq((*row) + 1 + info->n_in, info->val, info->n_out);
+ eq = isl_seq_eq((*row) + 1 + info->n_in, info->val, info->n_out);
+ return isl_bool_ok(eq);
}
/* Check whether "bmap" has a pair of constraints that have
@@ -26,7 +26,7 @@ static __isl_give isl_val *FN(UNION,eval_void)(__isl_take UNION *u,
/* Is the domain space of "entry" equal to "space"?
*/
-static int FN(UNION,has_domain_space)(const void *entry, const void *val)
+static isl_bool FN(UNION,has_domain_space)(const void *entry, const void *val)
{
PART *part = (PART *)entry;
isl_space *space = (isl_space *) val;
@@ -395,7 +395,7 @@ isl_bool isl_union_set_space_has_equal_params(__isl_keep isl_union_set *uset,
return isl_union_map_space_has_equal_params(uset_to_umap(uset), space);
}
-static int has_space(const void *entry, const void *val)
+static isl_bool has_space(const void *entry, const void *val)
{
isl_map *map = (isl_map *)entry;
isl_space *space = (isl_space *) val;
@@ -160,7 +160,7 @@ error:
/* Is the space of "entry" equal to "space"?
*/
-static int FN(UNION,has_space)(const void *entry, const void *val)
+static isl_bool FN(UNION,has_space)(const void *entry, const void *val)
{
PART *part = (PART *) entry;
isl_space *space = (isl_space *) val;
@@ -223,7 +223,7 @@ isl_stat FN(FN(UNION,foreach),BASE)(__isl_keep UNION *u,
/* Is the domain space of the group of expressions at "entry"
* equal to that of "space"?
*/
-static int FN(UNION,group_has_same_domain_space)(const void *entry,
+static isl_bool FN(UNION,group_has_same_domain_space)(const void *entry,
const void *val)
{
S(UNION,group) *group = (S(UNION,group) *) entry;
@@ -65,7 +65,8 @@ isl_stat FN(FN(UNION,foreach),BASE)(__isl_keep UNION *u,
/* Is the domain space of "entry" equal to the domain of "space"?
*/
-static int FN(UNION,has_same_domain_space)(const void *entry, const void *val)
+static isl_bool FN(UNION,has_same_domain_space)(const void *entry,
+ const void *val)
{
PART *part = (PART *)entry;
isl_space *space = (isl_space *) val;
@@ -712,7 +712,7 @@ S(UNION,match_domain_data) {
__isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
};
-static int FN(UNION,set_has_space)(const void *entry, const void *val)
+static isl_bool FN(UNION,set_has_space)(const void *entry, const void *val)
{
isl_set *set = (isl_set *)entry;
isl_space *space = (isl_space *)val;