X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeuses.c;h=85c4b975120688401754608796c26622058a579b;hb=a1e9069afa4fa1e16e2d176bcd7905d6a1ed4677;hp=4e26f6a3923b03de424f7dcd8926aacdb808b676;hpb=1a26f4853c07d1ecd68a097409dd602edfe29eff;p=libfirm diff --git a/ir/be/beuses.c b/ir/be/beuses.c index 4e26f6a39..85c4b9751 100644 --- a/ir/be/beuses.c +++ b/ir/be/beuses.c @@ -50,9 +50,7 @@ #include "bearch.h" #include "beuses.h" -#define SCAN_INTERBLOCK_USES - -typedef struct _be_use_t { +typedef struct be_use_t { const ir_node *block; const ir_node *node; int outermost_loop; @@ -60,8 +58,8 @@ typedef struct _be_use_t { unsigned visited; } be_use_t; -struct _be_uses_t { - set *uses; +struct be_uses_t { + set *uses; ir_graph *irg; const be_lv_t *lv; unsigned visited_counter; @@ -121,7 +119,6 @@ static int be_is_phi_argument(const ir_node *block, const ir_node *def) { ir_node *node; ir_node *succ_block = NULL; - const ir_edge_t *edge; int arity, i; #if 1 @@ -131,10 +128,7 @@ static int be_is_phi_argument(const ir_node *block, const ir_node *def) #endif return 0; - foreach_block_succ(block, edge) { - succ_block = get_edge_src_irn(edge); - break; - } + succ_block = get_first_block_succ(block); arity = get_Block_n_cfgpreds(succ_block); if (arity <= 1) @@ -160,8 +154,7 @@ static int be_is_phi_argument(const ir_node *block, const ir_node *def) return 0; } -static inline -unsigned get_step(const ir_node *node) +static inline unsigned get_step(const ir_node *node) { return PTR_TO_INT(get_irn_link(node)); } @@ -178,7 +171,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, unsigned next_use_step; const ir_edge_t *edge; -#if 1 assert(skip_from_uses == 0 || skip_from_uses == 1); if (skip_from_uses) { from = sched_next(from); @@ -218,48 +210,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, node = sched_last(block); step = get_step(node) + 1 + timestep + skip_from_uses; -#else - if (skip_from_uses) { - from = sched_next(from); - ++step; - } - - sched_foreach_from(from, node) { - int i, arity; - - if (is_Phi(node)) { - step++; - continue; - } - - arity = get_irn_arity(node); - for (i = 0; i < arity; ++i) { - const ir_node *operand = get_irn_n(node, i); - - if (operand == def) { - be_next_use_t result; - - DBG((env->dbg, LEVEL_3, "found use of %+F at %+F\n", operand, node)); - - /** - * Spills/Reloads are a special case, they're not really a - * usage of a value, continue searching - */ - if (be_is_Spill(node) || be_is_Reload(node)) { - return be_get_next_use(env, node, step, node, 1); - } - - result.time = step; - result.outermost_loop = get_loop_depth(get_irn_loop(block)); - result.before = node; - return result; - } - } - - step++; - } -#endif - if (be_is_phi_argument(block, def)) { // TODO we really should continue searching the uses of the phi, // as a phi isn't a real use that implies a reload (because we could @@ -272,7 +222,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, return result; } -#ifdef SCAN_INTERBLOCK_USES { unsigned next_use = USES_INFINITY; int outermost_loop; @@ -344,9 +293,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, DBG((env->dbg, LEVEL_5, "Result: %d (outerloop: %d)\n", result.time, result.outermost_loop)); return result; } -#else - return USES_INFINITY; -#endif } be_next_use_t be_get_next_use(be_uses_t *env, ir_node *from, @@ -357,8 +303,7 @@ be_next_use_t be_get_next_use(be_uses_t *env, ir_node *from, return get_next_use(env, from, from_step, def, skip_from_uses); } -static -void set_sched_step_walker(ir_node *block, void *data) +static void set_sched_step_walker(ir_node *block, void *data) { ir_node *node; unsigned step = 0;