X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeblocksched.c;h=11fb8c0a1211ca8a95097d8342e5acf5a38e2581;hb=4afdd22d55e88960e79760b6193253534ce298f1;hp=cf3d57e8bf3cfd1c0f21604cdd495d915a482c51;hpb=0161c9599a7082e078193440aec516576b3764a8;p=libfirm diff --git a/ir/be/beblocksched.c b/ir/be/beblocksched.c index cf3d57e8b..11fb8c0a1 100644 --- a/ir/be/beblocksched.c +++ b/ir/be/beblocksched.c @@ -34,9 +34,7 @@ * a next and prev pointers on blocks. The greedy algorithm sorts the edges by * execution frequencies and tries to transform them to fallthroughs in this order */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "beblocksched.h" @@ -58,9 +56,10 @@ #include "beirgmod.h" #include "bemodule.h" #include "be.h" +#include "error.h" -#include -#include +#include "lc_opts.h" +#include "lc_opts_enum.h" #ifdef WITH_ILP #include @@ -114,7 +113,7 @@ typedef struct _edge_t { int pos; /**< number of cfg predecessor (target) */ double execfreq; /**< the frequency */ int highest_execfreq; /**< flag that indicates whether this edge is the edge with the highest - execfreq pointing away from this block */ + execfreq pointing away from this block */ } edge_t; typedef struct _blocksched_env_t { @@ -272,11 +271,10 @@ static void pick_block_successor(blocksched_entry_t *entry, blocksched_env_t *en const ir_edge_t *edge; double best_succ_execfreq; - if (irn_visited(block)) + if (irn_visited_else_mark(block)) return; env->blockcount++; - mark_irn_visited(block); DBG((dbg, LEVEL_1, "Pick succ of %+F\n", block)); @@ -361,7 +359,7 @@ static blocksched_entry_t *finish_block_schedule(blocksched_env_t *env) ir_node *startblock = get_irg_start_block(irg); blocksched_entry_t *entry = get_irn_link(startblock); - set_using_irn_visited(irg); + ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED); inc_irg_visited(irg); env->worklist = new_pdeq(); @@ -369,7 +367,7 @@ static blocksched_entry_t *finish_block_schedule(blocksched_env_t *env) assert(pdeq_empty(env->worklist)); del_pdeq(env->worklist); - clear_using_irn_visited(irg); + ir_free_resources(irg, IR_RESOURCE_IRN_VISITED); return entry; } @@ -508,7 +506,6 @@ static void collect_egde_frequency_ilp(ir_node *block, void *data) } else { int i; - int *edgenums = alloca(sizeof(edgenums[0]) * arity); snprintf(name, sizeof(name), "block_in_constr_%ld", get_irn_node_nr(block)); cst = lpp_add_cst_uniq(env->lpp, name, lpp_greater, arity - 1); @@ -712,8 +709,7 @@ static ir_node **create_extbb_block_schedule(ir_graph *irg, ir_exec_freq *execfr list.end = NULL; list.n_blks = 0; - set_using_irn_link(irg); - set_using_irn_visited(irg); + ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED | IR_RESOURCE_IRN_LINK); inc_irg_block_visited(irg); create_block_list(get_irg_start_block(irg), &list); @@ -726,8 +722,7 @@ static ir_node **create_extbb_block_schedule(ir_graph *irg, ir_exec_freq *execfr blk_list[i] = b; } - clear_using_irn_link(irg); - clear_using_irn_visited(irg); + ir_free_resources(irg, IR_RESOURCE_IRN_VISITED | IR_RESOURCE_IRN_LINK); return blk_list; } @@ -766,6 +761,6 @@ ir_node **be_create_block_schedule(ir_graph *irg, ir_exec_freq *execfreqs) #endif /* WITH_ILP */ } - assert(0 && "unknown blocksched algo"); + panic("unknown blocksched algo"); return NULL; }