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

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

parent 79cf43c4
......@@ -53,13 +53,13 @@ typedef struct {
static irn_height_t *maybe_get_height_data(const ir_heights_t *heights,
const ir_node *node)
{
irn_height_t *height = (irn_height_t*)ir_nodemap_get(&heights->data, node);
irn_height_t *height = ir_nodemap_get(irn_height_t, &heights->data, node);
return height;
}
static irn_height_t *get_height_data(ir_heights_t *heights, const ir_node *node)
{
irn_height_t *height = (irn_height_t*)ir_nodemap_get(&heights->data, node);
irn_height_t *height = ir_nodemap_get(irn_height_t, &heights->data, node);
if (height == NULL) {
height = OALLOCZ(&heights->obst, irn_height_t);
ir_nodemap_insert(&heights->data, node, height);
......
......@@ -85,7 +85,7 @@ struct lv_chk_t {
static bl_info_t *get_block_info(lv_chk_t *lv, const ir_node *block)
{
bl_info_t *info = (bl_info_t*)ir_nodemap_get(&lv->block_infos, block);
bl_info_t *info = ir_nodemap_get(bl_info_t, &lv->block_infos, block);
if (info == NULL) {
info = OALLOC(&lv->obst, bl_info_t);
info->id = get_Block_dom_tree_pre_num(block);
......
......@@ -51,7 +51,7 @@ typedef struct vrp_env_t {
static vrp_attr *vrp_get_or_set_info(ir_vrp_info *info, const ir_node *node)
{
vrp_attr *attr = (vrp_attr*)ir_nodemap_get(&info->infos, node);
vrp_attr *attr = ir_nodemap_get(vrp_attr, &info->infos, node);
if (attr == NULL) {
ir_mode *mode = get_irn_mode(node);
assert(mode_is_int(mode));
......@@ -73,7 +73,7 @@ vrp_attr *vrp_get_info(const ir_node *node)
ir_graph *irg = get_irn_irg(node);
if (irg->vrp.infos.data == NULL)
return NULL;
return (vrp_attr*) ir_nodemap_get(&irg->vrp.infos, node);
return ir_nodemap_get(vrp_attr, &irg->vrp.infos, node);
}
static int vrp_update_node(ir_vrp_info *info, ir_node *node)
......
......@@ -665,7 +665,7 @@ be_stackorder_t *be_collect_stacknodes(ir_graph *irg)
ir_node *be_get_stack_pred(const be_stackorder_t *env, const ir_node *node)
{
return (ir_node*)ir_nodemap_get(&env->stack_order, node);
return ir_nodemap_get(ir_node, &env->stack_order, node);
}
void be_free_stackorder(be_stackorder_t *env)
......
......@@ -178,7 +178,7 @@ typedef struct {
static co2_irn_t *get_co2_irn(co2_t *env, const ir_node *node)
{
co2_irn_t *ci = (co2_irn_t*)ir_nodemap_get(&env->map, node);
co2_irn_t *ci = ir_nodemap_get(co2_irn_t, &env->map, node);
if (ci == NULL) {
ci = OALLOCZ(&env->obst, co2_irn_t);
......@@ -196,7 +196,7 @@ static co2_irn_t *get_co2_irn(co2_t *env, const ir_node *node)
static co2_cloud_irn_t *get_co2_cloud_irn(co2_t *env, const ir_node *node)
{
co2_cloud_irn_t *ci = (co2_cloud_irn_t*)ir_nodemap_get(&env->map, node);
co2_cloud_irn_t *ci = ir_nodemap_get(co2_cloud_irn_t, &env->map, node);
if (ci == NULL) {
ci = OALLOCZ(&env->obst, co2_cloud_irn_t);
......
......@@ -201,7 +201,7 @@ static co_mst_irn_t *co_mst_irn_init(co_mst_env_t *env, const ir_node *irn)
static co_mst_irn_t *get_co_mst_irn(co_mst_env_t *env, const ir_node *node)
{
co_mst_irn_t *res = (co_mst_irn_t*)ir_nodemap_get(&env->map, node);
co_mst_irn_t *res = ir_nodemap_get(co_mst_irn_t, &env->map, node);
if (res == NULL) {
res = co_mst_irn_init(env, node);
ir_nodemap_insert(&env->map, node, res);
......
......@@ -101,7 +101,7 @@ static bool has_definition(const ir_node *block)
static constr_info *get_or_set_info(be_ssa_construction_env_t *env,
const ir_node *node)
{
constr_info *info = (constr_info*)ir_nodemap_get(&env->infos, node);
constr_info *info = ir_nodemap_get(constr_info, &env->infos, node);
if (info == NULL) {
info = OALLOCZ(&env->obst, constr_info);
ir_nodemap_insert(&env->infos, node, info);
......@@ -112,7 +112,7 @@ static constr_info *get_or_set_info(be_ssa_construction_env_t *env,
static constr_info *get_info(const be_ssa_construction_env_t *env,
const ir_node *node)
{
return (constr_info*)ir_nodemap_get(&env->infos, node);
return ir_nodemap_get(constr_info, &env->infos, node);
}
/**
......
......@@ -109,6 +109,8 @@ static inline void *ir_nodemap_get(const ir_nodemap *nodemap,
return nodemap->data[idx];
}
#define ir_nodemap_get(type, nodemap, node) ((type*)ir_nodemap_get(nodemap, node))
/**
* Get mapping for @p node (fast version). Returns NULL if nothing is mapped.
*
......
......@@ -494,7 +494,7 @@ static void set_unroll_copy(ir_node *n, int nr, ir_node *cp)
unrolling_node_info *info;
assert(nr != 0 && "0 reserved");
info = (unrolling_node_info*)ir_nodemap_get(&map, n);
info = ir_nodemap_get(unrolling_node_info, &map, n);
if (! info) {
ir_node **arr = NEW_ARR_D(ir_node*, &obst, unroll_nr);
memset(arr, 0, unroll_nr * sizeof(ir_node*));
......@@ -513,7 +513,7 @@ static void set_unroll_copy(ir_node *n, int nr, ir_node *cp)
static ir_node *get_unroll_copy(ir_node *n, int nr)
{
ir_node *cp;
unrolling_node_info *info = (unrolling_node_info *)ir_nodemap_get(&map, n);
unrolling_node_info *info = ir_nodemap_get(unrolling_node_info, &map, n);
if (! info)
return NULL;
......@@ -533,7 +533,7 @@ static void set_inversion_copy(ir_node *n, ir_node *cp)
/* Getter of copy of n for inversion */
static ir_node *get_inversion_copy(ir_node *n)
{
ir_node *cp = (ir_node *)ir_nodemap_get(&map, n);
ir_node *cp = ir_nodemap_get(ir_node, &map, n);
return cp;
}
......
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