Commit 292b89d3 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Add a wrapper macro for ir_nodehashmap_get(), which has the return type as additional parameter.

parent a5002eb2
......@@ -152,7 +152,7 @@ void be_dump_liveness_block(void *context, FILE *F, const ir_node *bl)
{
if (is_Block(bl)) {
be_lv_t *lv = (be_lv_t*)context;
be_lv_info_t *info = (be_lv_info_t*)ir_nodehashmap_get(&lv->map, bl);
be_lv_info_t *info = ir_nodehashmap_get(be_lv_info_t, &lv->map, bl);
fprintf(F, "liveness:\n");
if (info != NULL) {
......
......@@ -122,7 +122,7 @@ be_lv_info_node_t *be_lv_get(const be_lv_t *li, const ir_node *bl,
be_lv_info_node_t *res = NULL;
stat_ev_tim_push();
irn_live = (be_lv_info_t*)ir_nodehashmap_get(&li->map, bl);
irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
if (irn_live != NULL) {
unsigned idx = get_irn_idx(irn);
......@@ -144,7 +144,7 @@ be_lv_info_node_t *be_lv_get(const be_lv_t *li, const ir_node *bl,
static be_lv_info_node_t *be_lv_get_or_set(be_lv_t *li, ir_node *bl,
ir_node *irn)
{
be_lv_info_t *irn_live = (be_lv_info_t*)ir_nodehashmap_get(&li->map, bl);
be_lv_info_t *irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
if (irn_live == NULL) {
irn_live = OALLOCNZ(&li->obst, be_lv_info_t, LV_STD_SIZE);
irn_live[0].head.n_size = LV_STD_SIZE-1;
......@@ -203,7 +203,7 @@ static be_lv_info_node_t *be_lv_get_or_set(be_lv_t *li, ir_node *bl,
static int be_lv_remove(be_lv_t *li, const ir_node *bl,
const ir_node *irn)
{
be_lv_info_t *irn_live = (be_lv_info_t*)ir_nodehashmap_get(&li->map, bl);
be_lv_info_t *irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
if (irn_live != NULL) {
unsigned n = irn_live[0].head.n_members;
......
......@@ -67,7 +67,7 @@ union be_lv_info_t {
static inline int _be_lv_next_irn(const be_lv_t *lv, const ir_node *block,
unsigned flags, int i)
{
be_lv_info_t *arr = (be_lv_info_t*)ir_nodehashmap_get(&lv->map, block);
be_lv_info_t *arr = ir_nodehashmap_get(be_lv_info_t, &lv->map, block);
if (arr != NULL) {
int n_members = (int) arr[0].head.n_members;
while(i < n_members) {
......@@ -84,7 +84,7 @@ static inline int _be_lv_next_irn(const be_lv_t *lv, const ir_node *block,
static inline ir_node *_be_lv_get_irn(const be_lv_t *lv, const ir_node *block,
int i)
{
be_lv_info_t *arr = (be_lv_info_t*)ir_nodehashmap_get(&lv->map, block);
be_lv_info_t *arr = ir_nodehashmap_get(be_lv_info_t, &lv->map, block);
return get_idx_irn(lv->irg, arr[i + 1].node.idx);
}
......
......@@ -553,7 +553,7 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
sched_add_after(skip_Proj(irn), keep);
/* insert the other different and its copies into the map */
entry = (op_copy_assoc_t*)ir_nodehashmap_get(op_set, other_different);
entry = ir_nodehashmap_get(op_copy_assoc_t, op_set, other_different);
if (! entry) {
entry = OALLOC(&env->obst, op_copy_assoc_t);
entry->cls = cls;
......
......@@ -110,8 +110,7 @@ static inline spill_info_t *create_spill_info(minibelady_env_t *env, ir_node *st
static inline spill_info_t *get_spill_info(minibelady_env_t *env, const ir_node *node)
{
spill_info_t *spill_info
= (spill_info_t*) ir_nodehashmap_get(&env->spill_infos, node);
spill_info_t *spill_info = ir_nodehashmap_get(spill_info_t, &env->spill_infos, node);
//ir_fprintf(stderr, "Get %+F -> %p\n", node, spill_info);
return spill_info;
}
......
......@@ -951,8 +951,8 @@ static void lv_check_walker(ir_node *bl, void *data)
be_lv_t *lv = w->lv;
be_lv_t *fresh = (be_lv_t*)w->data;
be_lv_info_t *curr = (be_lv_info_t*)ir_nodehashmap_get(&fresh->map, bl);
be_lv_info_t *fr = (be_lv_info_t*)ir_nodehashmap_get(&fresh->map, bl);
be_lv_info_t *curr = ir_nodehashmap_get(be_lv_info_t, &fresh->map, bl);
be_lv_info_t *fr = ir_nodehashmap_get(be_lv_info_t, &fresh->map, bl);
if (!fr && curr && curr[0].head.n_members > 0) {
unsigned i;
......
......@@ -73,7 +73,7 @@ void ir_nodehashmap_init(ir_nodehashmap_t *nodehashmap)
ir_nodehashmap_init_size(nodehashmap, 16);
}
void *ir_nodehashmap_get(const ir_nodehashmap_t *self, const ir_node *node)
void *(ir_nodehashmap_get)(const ir_nodehashmap_t *self, const ir_node *node)
{
ir_nodehashmap_entry_t *entry = ir_nodehashmap_find_(self, node);
return entry->data;
......
......@@ -101,6 +101,8 @@ void ir_nodehashmap_remove(ir_nodehashmap_t *nodehashmap, const ir_node *node);
void *ir_nodehashmap_get(const ir_nodehashmap_t *nodehashmap,
const ir_node *node);
#define ir_nodehashmap_get(type, self, node) ((type*)ir_nodehashmap_get((self), (node)))
/**
* Returns the number of pointers contained in the nodehashmap
*
......
......@@ -572,13 +572,13 @@ typedef enum block_flags_t {
static bool get_block_flag(const ir_nodehashmap_t *infos, const ir_node *block,
int flag)
{
return PTR_TO_INT(ir_nodehashmap_get(infos, block)) & flag;
return PTR_TO_INT(ir_nodehashmap_get(void, infos, block)) & flag;
}
static void set_block_flag(ir_nodehashmap_t *infos, ir_node *block,
block_flags_t flag)
{
int data = PTR_TO_INT(ir_nodehashmap_get(infos, block));
int data = PTR_TO_INT(ir_nodehashmap_get(void, infos, block));
data |= flag;
ir_nodehashmap_insert(infos, block, INT_TO_PTR(data));
}
......
......@@ -282,7 +282,7 @@ static ir_node *get_translated(ir_node *node, ir_node *block)
return node;
bi = get_block_info(block);
trans = (ir_node *)ir_nodehashmap_get(bi->trans, node);
trans = ir_nodehashmap_get(ir_node, bi->trans, node);
return trans;
}
......
......@@ -1545,7 +1545,7 @@ typedef struct loop_env {
*/
static node_entry *get_irn_ne(ir_node *irn, loop_env *env)
{
node_entry *e = (node_entry*)ir_nodehashmap_get(&env->map, irn);
node_entry *e = ir_nodehashmap_get(node_entry, &env->map, irn);
if (e == NULL) {
e = OALLOC(&env->obst, node_entry);
......
......@@ -311,7 +311,7 @@ restart:
goto restart;
}
entry = (address_entry*)ir_nodehashmap_get(&env.adr_map, adr);
entry = ir_nodehashmap_get(address_entry, &env.adr_map, adr);
if (entry == NULL) {
/* new address */
......
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