X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbessaconstr.c;h=a5c1a35c28e242873008935aabeb6674bceb2e8f;hb=9276447aec4972df060349e162f583c4898dfec8;hp=ae2d19495a90fe1f99fe5518c656c527cebc58b5;hpb=39f3a8dbd0f00f90b7b12a849d1bf7b9c1329479;p=libfirm diff --git a/ir/be/bessaconstr.c b/ir/be/bessaconstr.c index ae2d19495..a5c1a35c2 100644 --- a/ir/be/bessaconstr.c +++ b/ir/be/bessaconstr.c @@ -53,7 +53,7 @@ #include "bessaconstr.h" #include "bemodule.h" #include "besched_t.h" -#include "bera.h" +#include "beintlive_t.h" #include "beirg_t.h" #include "debug.h" @@ -394,124 +394,6 @@ void be_ssa_construction_update_liveness_phis(be_ssa_construction_env_t *env, } } -#if 0 -ir_node **be_ssa_construction(const be_dom_front_info_t *domfronts, be_lv_t *lv, - ir_node *value, int copies_len, ir_node **copies, - const ir_nodeset_t *ignore_uses, int need_new_phis) -{ - ir_graph *irg = get_irn_irg(value); - const ir_edge_t *edge, *next; - int i; - ir_node *block; - waitq *worklist; - be_ssa_construction_env_t env; - - /* We need to collect the phi functions to compute their liveness. */ - if(lv != NULL || need_new_phis) { - env.new_phis = NEW_ARR_F(ir_node*, 0); - } else { - env.new_phis = NULL; - } - env.mode = get_irn_mode(value); - - set_using_visited(irg); - set_using_block_visited(irg); - set_using_irn_link(irg); - - /* we use the visited flag to indicate blocks in the dominance frontier - * and blocks that already have the relevant value at the end calculated */ - inc_irg_visited(irg); - /* We use the block visited flag to indicate blocks in the dominance - * froniter of some values (and this potentially needing phis) */ - inc_irg_block_visited(irg); - - DBG((dbg, LEVEL_1, "Introducing following copies for: %+F\n", value)); - /* compute iterated dominance frontiers and create lists in the block link - * fields that sort usages by dominance. Blocks in the dominance frontier - * are marked by links back to the block. */ - worklist = new_waitq(); - - block = get_nodes_block(value); - /* we sometimes replace virtual values by real ones, in this case we do - not want to insert them into the def list (they're not scheduled - and can't be used anyway) */ - if(sched_is_scheduled(value)) { - introduce_def_at_block(block, value); - } - waitq_put(worklist, block); - - for(i = 0; i < copies_len; ++i) { - ir_node *copy = copies[i]; - block = get_nodes_block(copy); - - if(!irn_visited(block)) { - waitq_put(worklist, block); - } - introduce_def_at_block(block, copy); - DBG((dbg, LEVEL_1, "\t%+F in %+F\n", copy, block)); - } - - mark_iterated_dominance_frontiers(domfronts, worklist); - del_waitq(worklist); - - DBG((dbg, LEVEL_2, "New Definitions:\n")); - /* - * Search the valid def for each use and set it. - */ - foreach_out_edge_safe(value, edge, next) { - ir_node *use = get_edge_src_irn(edge); - ir_node *at = use; - int pos = get_edge_src_pos(edge); - - if(ignore_uses != NULL && ir_nodeset_contains(ignore_uses, use)) - continue; - - if(is_Phi(use)) { - ir_node *block = get_nodes_block(use); - ir_node *predblock = get_Block_cfgpred_block(block, pos); - at = sched_last(predblock); - } - - ir_node *def = search_def(&env, at); - - if(def == NULL) { - panic("no definition found for %+F at position %d\n", use, pos); - } - - DBG((dbg, LEVEL_2, "\t%+F(%d) -> %+F\n", use, pos, def)); - set_irn_n(use, pos, def); - } - - /* Recompute the liveness of the original nodes, the copies and the - * inserted phis. */ - if(lv != NULL) { - int n; - - be_liveness_update(lv, value); - for(i = 0; i < copies_len; ++i) { - ir_node *copy = copies[i]; - be_liveness_update(lv, copy); - } - - n = ARR_LEN(env.new_phis); - for(i = 0; i < n; ++i) { - ir_node *phi = env.new_phis[i]; - be_liveness_introduce(lv, phi); - } - } - - clear_using_visited(irg); - clear_using_block_visited(irg); - clear_using_irn_link(irg); - - if(!need_new_phis && env.new_phis != NULL) { - DEL_ARR_F(env.new_phis); - return NULL; - } - return env.new_phis; -} -#endif - void be_init_ssaconstr(void) { FIRM_DBG_REGISTER(dbg, "firm.be.ssaconstr");