X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Firlivechk.c;h=39090bc031bd3540c2843f579388f0590004cab8;hb=c25b0f5781313f72027722783ce6286978bdd757;hp=4aa00d86c999c29fe75901b0999cde4071604dec;hpb=edc739b393d7982e78a573d854113f47293c96b1;p=libfirm diff --git a/ir/ana/irlivechk.c b/ir/ana/irlivechk.c index 4aa00d86c..39090bc03 100644 --- a/ir/ana/irlivechk.c +++ b/ir/ana/irlivechk.c @@ -61,7 +61,7 @@ #include "statev.h" typedef struct _bl_info_t { - ir_node *block; /**< The block. */ + const ir_node *block; /**< The block. */ int be_tgt_calc : 1; int id : 31; /**< a tight number for the block. @@ -87,7 +87,7 @@ struct _lv_chk_t { bl_info_t **map; }; -static void *init_block_data(ir_phase *ph, ir_node *irn, void *old) +static void *init_block_data(ir_phase *ph, const ir_node *irn, void *old) { lv_chk_t *lv = container_of(ph, lv_chk_t, ph); bl_info_t *bi = phase_alloc(ph, sizeof(bi[0])); @@ -164,7 +164,7 @@ static void red_trans_closure(lv_chk_t *lv) } -static void compute_back_edge_chain(lv_chk_t *lv, ir_node *bl) +static void compute_back_edge_chain(lv_chk_t *lv, const ir_node *bl) { bitset_t *tmp = bitset_alloca(lv->n_blocks); bl_info_t *bi = get_block_info(lv, bl); @@ -247,6 +247,10 @@ lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs) struct obstack *obst; int i; + edges_deactivate(irg); + edges_activate(irg); + compute_doms(irg); + stat_ev_tim_push(); phase_init(&res->ph, "liveness check", irg, PHASE_DEFAULT_GROWTH, init_block_data, NULL); obst = phase_obst(&res->ph); @@ -258,6 +262,7 @@ lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs) res->back_edge_src = bitset_obstack_alloc(obst, res->n_blocks); res->back_edge_tgt = bitset_obstack_alloc(obst, res->n_blocks); res->map = obstack_alloc(obst, res->n_blocks * sizeof(res->map[0])); + memset(res->map, 0, res->n_blocks * sizeof(res->map[0])); #if 0 { @@ -276,6 +281,8 @@ lv_chk_t *lv_chk_new(ir_graph *irg, const dfs_t *dfs) for (i = res->n_blocks - 1; i >= 0; --i) { ir_node *irn = (ir_node *) dfs_get_pre_num_node(res->dfs, i); bl_info_t *bi = phase_get_or_set_irn_data(&res->ph, irn); + assert(bi->id < res->n_blocks); + assert(res->map[bi->id] == NULL); res->map[bi->id] = bi; }