*/
static ir_type *clone_type_and_cache(ir_type *tp)
{
- ir_type *res;
- pmap_entry *e = pmap_find(mtp_map, tp);
+ ir_type *res = (ir_type*)pmap_get(mtp_map, tp);
- if (e != NULL)
- return (ir_type*) e->value;
-
- res = clone_type_method(tp);
- pmap_insert(mtp_map, tp, res);
+ if (res == NULL) {
+ res = clone_type_method(tp);
+ pmap_insert(mtp_map, tp, res);
+ }
return res;
}
ir_type *get_irn_typeinfo_type(const ir_node *n)
{
- ir_type *res = initial_type;
- pmap_entry *entry;
-
+ ir_type *res;
assert(get_irg_typeinfo_state(get_irn_irg(n)) != ir_typeinfo_none);
- entry = pmap_find(type_node_map, n);
- if (entry != NULL)
- res = (ir_type*) entry->value;
+ res = pmap_get(type_node_map, n);
+ if (res == NULL) {
+ res = initial_type;
+ }
return res;
}
*/
static unsigned get_type_number(stabs_handle *h, ir_type *tp)
{
- pmap_entry *entry;
+ void *entry;
unsigned num;
if (tp == NULL) {
/* map to the void type */
return 0;
}
- entry = pmap_find(h->type_map, tp);
- if (! entry) {
+ entry = pmap_get(h->type_map, tp);
+ if (entry == NULL) {
num = h->next_type_nr++;
- pmap_insert(h->type_map, tp, INT_TO_PTR(num));
+ pmap_insert(h->type_map, tp, INT_TO_PTR(num+1));
} else {
- num = (unsigned)PTR_TO_INT(entry->value);
+ num = ((unsigned)PTR_TO_INT(entry))-1;
}
return num;
}
*/
static void map_to_void(stabs_handle *h, ir_type *tp)
{
- pmap_insert(h->type_map, tp, INT_TO_PTR(0));
+ pmap_insert(h->type_map, tp, INT_TO_PTR(1));
}
/**
x87_state *end; /**< state at the end or NULL if not assigned */
} blk_state;
-#define PTR_TO_BLKSTATE(p) ((blk_state *)(p))
-
/** liveness bitset for vfp registers. */
typedef unsigned char vfp_liveness;
*/
static blk_state *x87_get_bl_state(x87_simulator *sim, ir_node *block)
{
- pmap_entry *entry = pmap_find(sim->blk_states, block);
+ blk_state *res = pmap_get(sim->blk_states, block);
- if (! entry) {
- blk_state *bl_state = OALLOC(&sim->obst, blk_state);
- bl_state->begin = NULL;
- bl_state->end = NULL;
+ if (res == NULL) {
+ res = OALLOC(&sim->obst, blk_state);
+ res->begin = NULL;
+ res->end = NULL;
- pmap_insert(sim->blk_states, block, bl_state);
- return bl_state;
+ pmap_insert(sim->blk_states, block, res);
}
- return PTR_TO_BLKSTATE(entry->value);
+ return res;
}
/**
static ir_node *get_dummy_sel(ir_graph *irg, ir_node *block, ir_type *tp,
wlk_env *env)
{
- ir_entity *ent;
- pmap_entry *e;
-
/* use a map the check if we already create such an entity */
- e = pmap_find(env->dummy_map, tp);
- if (e) {
- ent = (ir_entity*)e->value;
- } else {
+ ir_entity *ent = pmap_get(env->dummy_map, tp);
+ if (ent == NULL) {
ir_type *ft = get_irg_frame_type(irg);
ident *dummy_id = id_unique("dummy.%u");
ent = new_entity(ft, dummy_id, tp);
if (op == op_Call) {
ir_node *symconst;
- pmap_entry *p;
const i_call_record *r;
ir_entity *ent;
return;
ent = get_SymConst_entity(symconst);
- p = pmap_find(wenv->c_map, ent);
+ r = (const i_call_record*)pmap_get(wenv->c_map, ent);
- if (p) {
- r = (const i_call_record*)p->value;
+ if (r != NULL) {
wenv->nr_of_intrinsics += r->i_mapper(node, r->ctx) ? 1 : 0;
}
} else {
list_for_each_entry_safe(call_entry, entry, next, &env->calls, list) {
irg_inline_property prop;
ir_graph *callee;
- pmap_entry *e;
+ ir_graph *calleee;
call = entry->call;
callee = entry->callee;
continue;
}
- e = pmap_find(copied_graphs, callee);
- if (e != NULL) {
+ calleee = (ir_graph*)pmap_get(copied_graphs, callee);
+ if (calleee != NULL) {
/*
* Remap callee if we have a copy.
* FIXME: Should we do this only for recursive Calls ?
*/
- callee = (ir_graph*)e->value;
+ callee = calleee;
}
if (prop >= irg_inline_forced ||
ir_node *call_node = curr_call->call;
inline_irg_env *callee_env = (inline_irg_env*)get_irg_link(callee);
irg_inline_property prop = get_irg_inline_property(callee);
+ ir_graph *calleee;
int loop_depth;
const call_entry *centry;
- pmap_entry *e;
if ((prop < irg_inline_forced) && env->n_nodes + callee_env->n_nodes > maxsize) {
DB((dbg, LEVEL_2, "%+F: too big (%d) + %+F (%d)\n", irg,
continue;
}
- e = pmap_find(copied_graphs, callee);
- if (e != NULL) {
+ calleee = (ir_graph*)pmap_get(copied_graphs, callee);
+ if (calleee != NULL) {
int benefice = curr_call->benefice;
/*
* Reduce the weight for recursive function IFF not all arguments are const.
/*
* Remap callee if we have a copy.
*/
- callee = (ir_graph*)e->value;
+ callee = calleee;
callee_env = (inline_irg_env*)get_irg_link(callee);
}