Commit 88b428f2 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Add wrapper macros for pset_first() and pset_next(), which have the return...

Add wrapper macros for pset_first() and pset_next(), which have the return type as additional parameter.
parent b451899b
......@@ -189,6 +189,8 @@ FIRM_API void *pset_remove(pset *pset, const void *key, unsigned hash);
*/
FIRM_API void *pset_first(pset *pset);
#define pset_first(type, pset) ((type*)pset_first((pset)))
/**
* Returns the next element of a pset.
*
......@@ -199,6 +201,8 @@ FIRM_API void *pset_first(pset *pset);
*/
FIRM_API void *pset_next(pset *pset);
#define pset_next(type, pset) ((type*)pset_next((pset)))
/**
* Breaks the iteration of a set. Must be called before
* the next pset_first() call if the iteration was NOT
......@@ -215,7 +219,7 @@ FIRM_API void pset_break(pset *pset);
* @param type type of iterator variable
* @param entry the iterator
*/
#define foreach_pset(pset, type, entry) for (type *entry = (type*)pset_first(pset); entry; entry = (type*)pset_next(pset))
#define foreach_pset(pset, type, entry) for (type *entry = pset_first(type, pset); entry; entry = pset_next(type, pset))
/**
* Inserts all elements of the pointer set src into
......
......@@ -261,7 +261,7 @@ static void simple_dump_opt_hash(dumper_t *dmp, pset *set, int index)
static void simple_dump_be_block_reg_pressure(dumper_t *dmp, graph_entry_t *entry)
{
/* return if no be statistic information available */
be_block_entry_t *const b_first = (be_block_entry_t*)pset_first(entry->be_block_hash);
be_block_entry_t *const b_first = pset_first(be_block_entry_t, entry->be_block_hash);
if (!b_first)
return;
......
......@@ -411,13 +411,13 @@ void free_inh_transitive_closure(void)
ir_type *get_class_trans_subtype_first(const ir_type *tp)
{
assert_valid_state();
return (ir_type*)pset_first(get_type_map(tp, d_down));
return pset_first(ir_type, get_type_map(tp, d_down));
}
ir_type *get_class_trans_subtype_next(const ir_type *tp)
{
assert_valid_state();
return (ir_type*)pset_next(get_type_map(tp, d_down));
return pset_next(ir_type, get_type_map(tp, d_down));
}
int is_class_trans_subtype(const ir_type *tp, const ir_type *subtp)
......@@ -431,13 +431,13 @@ int is_class_trans_subtype(const ir_type *tp, const ir_type *subtp)
ir_type *get_class_trans_supertype_first(const ir_type *tp)
{
assert_valid_state();
return (ir_type*)pset_first(get_type_map(tp, d_up));
return pset_first(ir_type, get_type_map(tp, d_up));
}
ir_type *get_class_trans_supertype_next(const ir_type *tp)
{
assert_valid_state();
return (ir_type*)pset_next(get_type_map(tp, d_up));
return pset_next(ir_type, get_type_map(tp, d_up));
}
/* - overwrittenby ------------------------------------------------------- */
......@@ -445,13 +445,13 @@ ir_type *get_class_trans_supertype_next(const ir_type *tp)
ir_entity *get_entity_trans_overwrittenby_first(const ir_entity *ent)
{
assert_valid_state();
return (ir_entity*)pset_first(get_entity_map(ent, d_down));
return pset_first(ir_entity, get_entity_map(ent, d_down));
}
ir_entity *get_entity_trans_overwrittenby_next(const ir_entity *ent)
{
assert_valid_state();
return (ir_entity*)pset_next(get_entity_map(ent, d_down));
return pset_next(ir_entity, get_entity_map(ent, d_down));
}
/* - overwrites ---------------------------------------------------------- */
......@@ -460,13 +460,13 @@ ir_entity *get_entity_trans_overwrittenby_next(const ir_entity *ent)
ir_entity *get_entity_trans_overwrites_first(const ir_entity *ent)
{
assert_valid_state();
return (ir_entity*)pset_first(get_entity_map(ent, d_up));
return pset_first(ir_entity, get_entity_map(ent, d_up));
}
ir_entity *get_entity_trans_overwrites_next(const ir_entity *ent)
{
assert_valid_state();
return (ir_entity*)pset_next(get_entity_map(ent, d_up));
return pset_next(ir_entity, get_entity_map(ent, d_up));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment