Commit cdcd17c4 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

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

parent c719c20b
...@@ -73,6 +73,8 @@ FIRM_API pmap_entry *pmap_find(pmap *map, const void * key); ...@@ -73,6 +73,8 @@ FIRM_API pmap_entry *pmap_find(pmap *map, const void * key);
/** Returns the value of "key". */ /** Returns the value of "key". */
FIRM_API void * pmap_get(pmap *map, const void * key); FIRM_API void * pmap_get(pmap *map, const void * key);
#define pmap_get(type, map, key) ((type*)pmap_get(map, key))
/** Return number of elements in the map */ /** Return number of elements in the map */
FIRM_API size_t pmap_count(pmap *map); FIRM_API size_t pmap_count(pmap *map);
......
...@@ -90,7 +90,7 @@ pmap_entry * pmap_find(pmap *map, const void *key) ...@@ -90,7 +90,7 @@ pmap_entry * pmap_find(pmap *map, const void *key)
} }
void * pmap_get(pmap *map, const void *key) void * (pmap_get)(pmap *map, const void *key)
{ {
pmap_entry * entry = pmap_find(map, key); pmap_entry * entry = pmap_find(map, key);
return entry == NULL ? NULL : entry->value; return entry == NULL ? NULL : entry->value;
......
...@@ -55,7 +55,7 @@ ir_cdep *(get_cdep_next)(const ir_cdep *cdep) ...@@ -55,7 +55,7 @@ ir_cdep *(get_cdep_next)(const ir_cdep *cdep)
ir_cdep *find_cdep(const ir_node *block) ir_cdep *find_cdep(const ir_node *block)
{ {
assert(is_Block(block)); assert(is_Block(block));
return (ir_cdep*) pmap_get(cdep_data->cdep_map, block); return pmap_get(ir_cdep, cdep_data->cdep_map, block);
} }
void exchange_cdep(ir_node *old, const ir_node *nw) void exchange_cdep(ir_node *old, const ir_node *nw)
......
...@@ -129,5 +129,5 @@ ir_node **ir_get_dominance_frontier(const ir_node *block) ...@@ -129,5 +129,5 @@ ir_node **ir_get_dominance_frontier(const ir_node *block)
{ {
ir_graph *irg = get_irn_irg(block); ir_graph *irg = get_irn_irg(block);
ir_dom_front_info_t *info = &irg->domfront; ir_dom_front_info_t *info = &irg->domfront;
return (ir_node**)pmap_get(info->df_map, block); return pmap_get(ir_node*, info->df_map, block);
} }
...@@ -1244,7 +1244,7 @@ static pmap *mtp_map; ...@@ -1244,7 +1244,7 @@ static pmap *mtp_map;
*/ */
static ir_type *clone_type_and_cache(ir_type *tp) static ir_type *clone_type_and_cache(ir_type *tp)
{ {
ir_type *res = (ir_type*)pmap_get(mtp_map, tp); ir_type *res = pmap_get(ir_type, mtp_map, tp);
if (res == NULL) { if (res == NULL) {
res = clone_type_method(tp); res = clone_type_method(tp);
......
...@@ -122,7 +122,7 @@ ir_type *get_irn_typeinfo_type(const ir_node *n) ...@@ -122,7 +122,7 @@ ir_type *get_irn_typeinfo_type(const ir_node *n)
ir_type *res; ir_type *res;
assert(get_irg_typeinfo_state(get_irn_irg(n)) != ir_typeinfo_none); assert(get_irg_typeinfo_state(get_irn_irg(n)) != ir_typeinfo_none);
res = (ir_type*)pmap_get(type_node_map, n); res = pmap_get(ir_type, type_node_map, n);
if (res == NULL) { if (res == NULL) {
res = initial_type; res = initial_type;
} }
......
...@@ -57,7 +57,7 @@ static ir_node **get_entity_access_array(const ir_entity *ent) ...@@ -57,7 +57,7 @@ static ir_node **get_entity_access_array(const ir_entity *ent)
if (!entity_access_map) entity_access_map = pmap_create(); if (!entity_access_map) entity_access_map = pmap_create();
if (pmap_contains(entity_access_map, ent)) { if (pmap_contains(entity_access_map, ent)) {
res = (ir_node **) pmap_get(entity_access_map, ent); res = pmap_get(ir_node*, entity_access_map, ent);
} else { } else {
res = NEW_ARR_F(ir_node *, 0); res = NEW_ARR_F(ir_node *, 0);
pmap_insert(entity_access_map, ent, (void *)res); pmap_insert(entity_access_map, ent, (void *)res);
...@@ -81,7 +81,7 @@ static ir_node **get_entity_reference_array(const ir_entity *ent) ...@@ -81,7 +81,7 @@ static ir_node **get_entity_reference_array(const ir_entity *ent)
if (!entity_reference_map) entity_reference_map = pmap_create(); if (!entity_reference_map) entity_reference_map = pmap_create();
if (pmap_contains(entity_reference_map, ent)) { if (pmap_contains(entity_reference_map, ent)) {
res = (ir_node **) pmap_get(entity_reference_map, ent); res = pmap_get(ir_node*, entity_reference_map, ent);
} else { } else {
res = NEW_ARR_F(ir_node *, 0); res = NEW_ARR_F(ir_node *, 0);
pmap_insert(entity_reference_map, ent, (void *)res); pmap_insert(entity_reference_map, ent, (void *)res);
...@@ -105,7 +105,7 @@ static ir_node **get_type_alloc_array(const ir_type *tp) ...@@ -105,7 +105,7 @@ static ir_node **get_type_alloc_array(const ir_type *tp)
if (!type_alloc_map) type_alloc_map = pmap_create(); if (!type_alloc_map) type_alloc_map = pmap_create();
if (pmap_contains(type_alloc_map, tp)) { if (pmap_contains(type_alloc_map, tp)) {
res = (ir_node **) pmap_get(type_alloc_map, tp); res = pmap_get(ir_node*, type_alloc_map, tp);
} else { } else {
res = NEW_ARR_F(ir_node *, 0); res = NEW_ARR_F(ir_node *, 0);
pmap_insert(type_alloc_map, tp, (void *)res); pmap_insert(type_alloc_map, tp, (void *)res);
...@@ -129,7 +129,7 @@ static ir_node **get_type_cast_array(const ir_type *tp) ...@@ -129,7 +129,7 @@ static ir_node **get_type_cast_array(const ir_type *tp)
if (!type_cast_map) type_cast_map = pmap_create(); if (!type_cast_map) type_cast_map = pmap_create();
if (pmap_contains(type_cast_map, tp)) { if (pmap_contains(type_cast_map, tp)) {
res = (ir_node **) pmap_get(type_cast_map, tp); res = pmap_get(ir_node*, type_cast_map, tp);
} else { } else {
res = NEW_ARR_F(ir_node *, 0); res = NEW_ARR_F(ir_node *, 0);
pmap_insert(type_cast_map, tp, (void *)res); pmap_insert(type_cast_map, tp, (void *)res);
...@@ -152,7 +152,7 @@ static ir_type **get_type_pointertype_array(const ir_type *tp) ...@@ -152,7 +152,7 @@ static ir_type **get_type_pointertype_array(const ir_type *tp)
if (!type_pointertype_map) type_pointertype_map = pmap_create(); if (!type_pointertype_map) type_pointertype_map = pmap_create();
if (pmap_contains(type_pointertype_map, tp)) { if (pmap_contains(type_pointertype_map, tp)) {
res = (ir_type **) pmap_get(type_pointertype_map, tp); res = pmap_get(ir_type*, type_pointertype_map, tp);
} else { } else {
res = NEW_ARR_F(ir_type *, 0); res = NEW_ARR_F(ir_type *, 0);
pmap_insert(type_pointertype_map, tp, (void *)res); pmap_insert(type_pointertype_map, tp, (void *)res);
...@@ -176,7 +176,7 @@ static ir_type **get_type_arraytype_array(const ir_type *tp) ...@@ -176,7 +176,7 @@ static ir_type **get_type_arraytype_array(const ir_type *tp)
if (!type_arraytype_map) type_arraytype_map = pmap_create(); if (!type_arraytype_map) type_arraytype_map = pmap_create();
if (pmap_contains(type_arraytype_map, tp)) { if (pmap_contains(type_arraytype_map, tp)) {
res = (ir_type **) pmap_get(type_arraytype_map, tp); res = pmap_get(ir_type*, type_arraytype_map, tp);
} else { } else {
res = NEW_ARR_F(ir_type *, 0); res = NEW_ARR_F(ir_type *, 0);
pmap_insert(type_arraytype_map, tp, (void *)res); pmap_insert(type_arraytype_map, tp, (void *)res);
......
...@@ -1753,7 +1753,7 @@ static ir_node *get_stack_pointer_for(ir_node *node) ...@@ -1753,7 +1753,7 @@ static ir_node *get_stack_pointer_for(ir_node *node)
} }
be_transform_node(stack_pred); be_transform_node(stack_pred);
stack = (ir_node*)pmap_get(node_to_stack, stack_pred); stack = pmap_get(ir_node, node_to_stack, stack_pred);
if (stack == NULL) { if (stack == NULL) {
return get_stack_pointer_for(stack_pred); return get_stack_pointer_for(stack_pred);
} }
......
...@@ -108,7 +108,7 @@ static int be_omit_fp = 1; ...@@ -108,7 +108,7 @@ static int be_omit_fp = 1;
static ir_node *be_abi_reg_map_get(pmap *map, const arch_register_t *reg) static ir_node *be_abi_reg_map_get(pmap *map, const arch_register_t *reg)
{ {
return (ir_node*)pmap_get(map, reg); return pmap_get(ir_node, map, reg);
} }
static void be_abi_reg_map_set(pmap *map, const arch_register_t* reg, static void be_abi_reg_map_set(pmap *map, const arch_register_t* reg,
...@@ -1229,7 +1229,7 @@ static ir_node *create_be_return(be_abi_irg_t *env, ir_node *irn, ir_node *bl, ...@@ -1229,7 +1229,7 @@ static ir_node *create_be_return(be_abi_irg_t *env, ir_node *irn, ir_node *bl,
const arch_env_t *arch_env = be_get_irg_arch_env(irg); const arch_env_t *arch_env = be_get_irg_arch_env(irg);
dbg_info *dbgi; dbg_info *dbgi;
pmap *reg_map = pmap_create(); pmap *reg_map = pmap_create();
ir_node *keep = (ir_node*)pmap_get(env->keep_map, bl); ir_node *keep = pmap_get(ir_node, env->keep_map, bl);
size_t in_max; size_t in_max;
ir_node *ret; ir_node *ret;
int i, n; int i, n;
...@@ -1580,7 +1580,7 @@ static void modify_irg(ir_graph *irg) ...@@ -1580,7 +1580,7 @@ static void modify_irg(ir_graph *irg)
param_type = get_method_param_type(method_type, nr); param_type = get_method_param_type(method_type, nr);
if (arg->in_reg) { if (arg->in_reg) {
repl = (ir_node*)pmap_get(env->regs, arg->reg); repl = pmap_get(ir_node, env->regs, arg->reg);
} else if (arg->on_stack) { } else if (arg->on_stack) {
ir_node *addr = be_new_FrameAddr(sp->reg_class, start_bl, frame_pointer, arg->stack_ent); ir_node *addr = be_new_FrameAddr(sp->reg_class, start_bl, frame_pointer, arg->stack_ent);
...@@ -1701,7 +1701,7 @@ static ir_entity *create_trampoline(be_main_env_t *be, ir_entity *method) ...@@ -1701,7 +1701,7 @@ static ir_entity *create_trampoline(be_main_env_t *be, ir_entity *method)
*/ */
static ir_entity *get_trampoline(be_main_env_t *env, ir_entity *method) static ir_entity *get_trampoline(be_main_env_t *env, ir_entity *method)
{ {
ir_entity *result = (ir_entity*)pmap_get(env->ent_trampoline_map, method); ir_entity *result = pmap_get(ir_entity, env->ent_trampoline_map, method);
if (result == NULL) { if (result == NULL) {
result = create_trampoline(env, method); result = create_trampoline(env, method);
pmap_insert(env->ent_trampoline_map, method, result); pmap_insert(env->ent_trampoline_map, method, result);
...@@ -1726,7 +1726,7 @@ static ir_entity *create_pic_symbol(be_main_env_t *be, ir_entity *entity) ...@@ -1726,7 +1726,7 @@ static ir_entity *create_pic_symbol(be_main_env_t *be, ir_entity *entity)
static ir_entity *get_pic_symbol(be_main_env_t *env, ir_entity *entity) static ir_entity *get_pic_symbol(be_main_env_t *env, ir_entity *entity)
{ {
ir_entity *result = (ir_entity*)pmap_get(env->ent_pic_symbol_map, entity); ir_entity *result = pmap_get(ir_entity, env->ent_pic_symbol_map, entity);
if (result == NULL) { if (result == NULL) {
result = create_pic_symbol(env, entity); result = create_pic_symbol(env, entity);
pmap_insert(env->ent_pic_symbol_map, entity, result); pmap_insert(env->ent_pic_symbol_map, entity, result);
......
...@@ -332,7 +332,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env, ...@@ -332,7 +332,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name)); DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name));
} }
irn = (ir_node*)pmap_get(partners, alloc_nodes[i]); irn = pmap_get(ir_node, partners, alloc_nodes[i]);
if (irn != NULL) { if (irn != NULL) {
arch_set_irn_register(irn, reg); arch_set_irn_register(irn, reg);
(void) pset_hinsert_ptr(alloc_env->pre_colored, irn); (void) pset_hinsert_ptr(alloc_env->pre_colored, irn);
......
...@@ -128,7 +128,7 @@ void create_borders(ir_node *block, void *env_ptr) ...@@ -128,7 +128,7 @@ void create_borders(ir_node *block, void *env_ptr)
/* Set up the border list in the block info */ /* Set up the border list in the block info */
head = OALLOC(env->obst, struct list_head); head = OALLOC(env->obst, struct list_head);
INIT_LIST_HEAD(head); INIT_LIST_HEAD(head);
assert(pmap_get(env->border_heads, block) == NULL); assert(pmap_get(struct list_head, env->border_heads, block) == NULL);
pmap_insert(env->border_heads, block, head); pmap_insert(env->border_heads, block, head);
/* /*
......
...@@ -238,7 +238,7 @@ static void block_dims_walker(ir_node *block, void *data) ...@@ -238,7 +238,7 @@ static void block_dims_walker(ir_node *block, void *data)
static void layout(const draw_chordal_env_t *env, ir_node *bl, int x) static void layout(const draw_chordal_env_t *env, ir_node *bl, int x)
{ {
const draw_chordal_opts_t *opts = env->opts; const draw_chordal_opts_t *opts = env->opts;
struct block_dims *dims = (struct block_dims*)pmap_get(env->block_dims, bl); struct block_dims *dims = pmap_get(struct block_dims, env->block_dims, bl);
rect_t *rect = &dims->subtree_box; rect_t *rect = &dims->subtree_box;
int h_space = 0; int h_space = 0;
int v_space = 0; int v_space = 0;
...@@ -248,7 +248,7 @@ static void layout(const draw_chordal_env_t *env, ir_node *bl, int x) ...@@ -248,7 +248,7 @@ static void layout(const draw_chordal_env_t *env, ir_node *bl, int x)
rect->x = x; rect->x = x;
dominates_for_each(bl, sub) { dominates_for_each(bl, sub) {
struct block_dims *bl_dim = (struct block_dims*)pmap_get(env->block_dims, sub); struct block_dims *bl_dim = pmap_get(struct block_dims, env->block_dims, sub);
layout(env, sub, rect->x + rect->w); layout(env, sub, rect->x + rect->w);
...@@ -270,12 +270,12 @@ static void layout(const draw_chordal_env_t *env, ir_node *bl, int x) ...@@ -270,12 +270,12 @@ static void layout(const draw_chordal_env_t *env, ir_node *bl, int x)
static void set_y(const draw_chordal_env_t *env, ir_node *bl, int up) static void set_y(const draw_chordal_env_t *env, ir_node *bl, int up)
{ {
const draw_chordal_opts_t *opts = env->opts; const draw_chordal_opts_t *opts = env->opts;
struct block_dims *dims = (struct block_dims*)pmap_get(env->block_dims, bl); struct block_dims *dims = pmap_get(struct block_dims, env->block_dims, bl);
int max_height = dims->subtree_box.h - dims->box.h - opts->v_gap; int max_height = dims->subtree_box.h - dims->box.h - opts->v_gap;
ir_node *sub; ir_node *sub;
dominates_for_each(bl, sub) { dominates_for_each(bl, sub) {
struct block_dims *bl_dim = (struct block_dims*)pmap_get(env->block_dims, sub); struct block_dims *bl_dim = pmap_get(struct block_dims, env->block_dims, sub);
int height_diff = max_height - bl_dim->subtree_box.h; int height_diff = max_height - bl_dim->subtree_box.h;
set_y(env, sub, up + height_diff); set_y(env, sub, up + height_diff);
...@@ -322,7 +322,7 @@ static void draw_block(ir_node *bl, void *data) ...@@ -322,7 +322,7 @@ static void draw_block(ir_node *bl, void *data)
struct list_head *head = get_block_border_head(env->chordal_env, bl); struct list_head *head = get_block_border_head(env->chordal_env, bl);
ir_node *dom = get_Block_idom(bl); ir_node *dom = get_Block_idom(bl);
const draw_chordal_opts_t *opts = env->opts; const draw_chordal_opts_t *opts = env->opts;
struct block_dims *dims = (struct block_dims*)pmap_get(env->block_dims, bl); struct block_dims *dims = pmap_get(struct block_dims, env->block_dims, bl);
char buf[64]; char buf[64];
border_t *b; border_t *b;
int idx; int idx;
...@@ -361,7 +361,7 @@ static void draw_block(ir_node *bl, void *data) ...@@ -361,7 +361,7 @@ static void draw_block(ir_node *bl, void *data)
} }
if (dom) { if (dom) {
struct block_dims *dom_dims = (struct block_dims*)pmap_get(env->block_dims, dom); struct block_dims *dom_dims = pmap_get(struct block_dims, env->block_dims, dom);
be_lv_foreach(lv, bl, be_lv_state_in, idx) { be_lv_foreach(lv, bl, be_lv_state_in, idx) {
ir_node *irn = be_lv_get_irn(lv, bl, idx); ir_node *irn = be_lv_get_irn(lv, bl, idx);
...@@ -420,7 +420,7 @@ void draw_interval_tree(const draw_chordal_opts_t *opts, ...@@ -420,7 +420,7 @@ void draw_interval_tree(const draw_chordal_opts_t *opts,
irg_block_walk_graph(chordal_env->irg, block_dims_walker, NULL, &env); irg_block_walk_graph(chordal_env->irg, block_dims_walker, NULL, &env);
layout(&env, start_block, opts->x_margin); layout(&env, start_block, opts->x_margin);
set_y(&env, start_block, opts->y_margin); set_y(&env, start_block, opts->y_margin);
start_dims = (struct block_dims*)pmap_get(env.block_dims, start_block); start_dims = pmap_get(struct block_dims, env.block_dims, start_block);
draw(&env, &start_dims->subtree_box); draw(&env, &start_dims->subtree_box);
pmap_destroy(env.block_dims); pmap_destroy(env.block_dims);
......
...@@ -68,7 +68,7 @@ struct be_chordal_env_t { ...@@ -68,7 +68,7 @@ struct be_chordal_env_t {
}; };
static inline struct list_head *_get_block_border_head(const be_chordal_env_t *inf, ir_node *bl) { static inline struct list_head *_get_block_border_head(const be_chordal_env_t *inf, ir_node *bl) {
return (list_head*)pmap_get(inf->border_heads, bl); return pmap_get(list_head, inf->border_heads, bl);
} }
#define get_block_border_head(info, bl) _get_block_border_head(info, bl) #define get_block_border_head(info, bl) _get_block_border_head(info, bl)
......
...@@ -108,7 +108,7 @@ static char *comp_dir; ...@@ -108,7 +108,7 @@ static char *comp_dir;
static unsigned insert_file(const char *filename) static unsigned insert_file(const char *filename)
{ {
unsigned num; unsigned num;
void *entry = pmap_get(env.file_map, filename); void *entry = pmap_get(void, env.file_map, filename);
if (entry != NULL) { if (entry != NULL) {
return PTR_TO_INT(entry); return PTR_TO_INT(entry);
} }
......
...@@ -1332,7 +1332,7 @@ void be_gas_emit_block_name(const ir_node *block) ...@@ -1332,7 +1332,7 @@ void be_gas_emit_block_name(const ir_node *block)
if (entity != NULL) { if (entity != NULL) {
be_gas_emit_entity(entity); be_gas_emit_entity(entity);
} else { } else {
void *nr_val = pmap_get(block_numbers, block); void *nr_val = pmap_get(void, block_numbers, block);
int nr; int nr;
if (nr_val == NULL) { if (nr_val == NULL) {
nr = next_block_nr++; nr = next_block_nr++;
......
...@@ -75,7 +75,7 @@ ir_type *ia32_get_prim_type(const ir_mode *mode) ...@@ -75,7 +75,7 @@ ir_type *ia32_get_prim_type(const ir_mode *mode)
ir_entity *ia32_create_float_const_entity(ia32_isa_t *isa, ir_tarval *tv, ir_entity *ia32_create_float_const_entity(ia32_isa_t *isa, ir_tarval *tv,
ident *name) ident *name)
{ {
ir_entity *res = (ir_entity*)pmap_get(isa->tv_ent, tv); ir_entity *res = pmap_get(ir_entity, isa->tv_ent, tv);
ir_initializer_t *initializer; ir_initializer_t *initializer;
ir_mode *mode; ir_mode *mode;
ir_type *tp; ir_type *tp;
......
...@@ -337,7 +337,7 @@ static void x87_emms(x87_state *state) ...@@ -337,7 +337,7 @@ static void x87_emms(x87_state *state)
*/ */
static blk_state *x87_get_bl_state(x87_simulator *sim, ir_node *block) static blk_state *x87_get_bl_state(x87_simulator *sim, ir_node *block)
{ {
blk_state *res = (blk_state*)pmap_get(sim->blk_states, block); blk_state *res = pmap_get(blk_state, sim->blk_states, block);
if (res == NULL) { if (res == NULL) {
res = OALLOC(&sim->obst, blk_state); res = OALLOC(&sim->obst, blk_state);
......
...@@ -1105,7 +1105,7 @@ static ir_entity *create_float_const_entity(ir_tarval *tv) ...@@ -1105,7 +1105,7 @@ static ir_entity *create_float_const_entity(ir_tarval *tv)
{ {
const arch_env_t *arch_env = be_get_irg_arch_env(current_ir_graph); const arch_env_t *arch_env = be_get_irg_arch_env(current_ir_graph);
sparc_isa_t *isa = (sparc_isa_t*) arch_env; sparc_isa_t *isa = (sparc_isa_t*) arch_env;
ir_entity *entity = (ir_entity*) pmap_get(isa->constants, tv); ir_entity *entity = pmap_get(ir_entity, isa->constants, tv);
ir_initializer_t *initializer; ir_initializer_t *initializer;
ir_mode *mode; ir_mode *mode;
ir_type *type; ir_type *type;
...@@ -1642,7 +1642,7 @@ static ir_node *get_stack_pointer_for(ir_node *node) ...@@ -1642,7 +1642,7 @@ static ir_node *get_stack_pointer_for(ir_node *node)
} }
be_transform_node(stack_pred); be_transform_node(stack_pred);
stack = (ir_node*)pmap_get(node_to_stack, stack_pred); stack = pmap_get(ir_node, node_to_stack, stack_pred);
if (stack == NULL) { if (stack == NULL) {
return get_stack_pointer_for(stack_pred); return get_stack_pointer_for(stack_pred);
} }
......
...@@ -474,7 +474,7 @@ static void *ird_get_irn_link(const ir_node *n) ...@@ -474,7 +474,7 @@ static void *ird_get_irn_link(const ir_node *n)
return NULL; return NULL;
if (pmap_contains(irdump_link_map, n)) if (pmap_contains(irdump_link_map, n))
res = pmap_get(irdump_link_map, n); res = pmap_get(void, irdump_link_map, n);
return res; return res;
} }
...@@ -498,7 +498,7 @@ static void *ird_get_irg_link(const ir_graph *irg) ...@@ -498,7 +498,7 @@ static void *ird_get_irg_link(const ir_graph *irg)
return NULL; return NULL;
if (pmap_contains(irdump_link_map, irg)) if (pmap_contains(irdump_link_map, irg))
res = pmap_get(irdump_link_map, irg); res = pmap_get(void, irdump_link_map, irg);
return res; return res;
} }
......
...@@ -2187,20 +2187,20 @@ static ir_node *read_Anchor(read_env_t *env) ...@@ -2187,20 +2187,20 @@ static ir_node *read_Anchor(read_env_t *env)
return res; return res;
} }
typedef ir_node* (*read_node_func)(read_env_t *env); typedef ir_node* read_node_func(read_env_t *env);
static pmap *node_readers; static pmap *node_readers;
static void register_node_reader(ident *ident, read_node_func func) static void register_node_reader(ident *ident, read_node_func* func)
{ {
pmap_insert(node_readers, ident, (void*)func); pmap_insert(node_readers, ident, (void*)func);
} }
static ir_node *read_node(read_env_t *env) static ir_node *read_node(read_env_t *env)
{ {
ident *id = read_symbol(env); ident *id = read_symbol(env);
read_node_func func = (read_node_func)pmap_get(node_readers, id); read_node_func *func = pmap_get(read_node_func, node_readers, id);
long nr = read_long(env); long nr = read_long(env);
ir_node *res; ir_node *res;
if (func == NULL) { if (func == NULL) {
parse_error(env, "Unknown nodetype '%s'", get_id_str(id)); parse_error(env, "Unknown nodetype '%s'", get_id_str(id));
skip_to(env, '\n'); skip_to(env, '\n');
......
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