X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fopt_osr.c;h=6a3564aff256426d33980e52052652632708da5d;hb=e0a2eca7e1d13c2f1ccb8a70479039c01c0c69ef;hp=706cd454a7cb01c616f184ee98b7ba19395fc2aa;hpb=68c53912050388b1fdf6ad7ca468622e1d8829c3;p=libfirm diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index 706cd454a..6a3564aff 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -28,9 +28,7 @@ * by Keith D. Cooper, L. Taylor Simpson, Christopher A. Vick. * Extended version. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "adt/pdeq.h" #include "iroptimize.h" @@ -52,7 +50,7 @@ #include "irloop_t.h" #include "array.h" #include "firmstat.h" -#include "xmalloc.h" +#include "error.h" /** The debug handle. */ DEBUG_ONLY(static firm_dbg_module_t *dbg;) @@ -305,7 +303,7 @@ static ir_node *do_apply(ir_opcode code, dbg_info *db, ir_node *op1, ir_node *op result = new_rd_Sub(db, irg, block, op1, op2, mode); break; default: - assert(0); + panic("Unsupported opcode"); result = NULL; } return result; @@ -469,6 +467,7 @@ static int replace(ir_node *irn, ir_node *iv, ir_node *rc, iv_env *env) { return 0; } +#if 0 /** * check if a given node is a mul with 2, 4, 8 */ @@ -494,6 +493,7 @@ static int is_x86_shift_const(ir_node *mul) { } return 0; } +#endif /** * Check if an IV represents a counter with constant limits. @@ -662,11 +662,6 @@ static int check_replace(ir_node *irn, iv_env *env) { if (! check_users_for_reg_pressure(iv, env)) return 0; } - /* check for x86 constants */ - if (env->flags & osr_flag_ignore_x86_shift) - if (is_x86_shift_const(irn)) - return 0; - return replace(irn, iv, rc, env); } break; @@ -942,7 +937,7 @@ static void dfs(ir_node *irn, iv_env *env) for (i = 0; i < n; ++i) { ir_node *pred = get_irn_n(irn, i); - if (irn_not_visited(pred)) + if (!irn_visited(pred)) dfs(pred, env); } } @@ -954,7 +949,7 @@ static void dfs(ir_node *irn, iv_env *env) push(env, irn); /* handle the block */ - if (irn_not_visited(block)) + if (!irn_visited(block)) dfs(block, env); n = get_irn_arity(irn); @@ -962,7 +957,7 @@ static void dfs(ir_node *irn, iv_env *env) ir_node *pred = get_irn_n(irn, i); node_entry *o = get_irn_ne(pred, env); - if (irn_not_visited(pred)) { + if (!irn_visited(pred)) { dfs(pred, env); node->low = MIN(node->low, o->low); } @@ -1000,7 +995,7 @@ static void do_dfs(ir_graph *irg, iv_env *env) { ir_node *end = get_irg_end(irg); int i, n; - set_using_irn_visited(irg); + ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED); current_ir_graph = irg; inc_irg_visited(irg); @@ -1013,11 +1008,11 @@ static void do_dfs(ir_graph *irg, iv_env *env) { for (i = 0; i < n; ++i) { ir_node *ka = get_End_keepalive(end, i); - if (irn_not_visited(ka)) + if (!irn_visited(ka)) dfs(ka, env); } - clear_using_irn_visited(irg); + ir_free_resources(irg, IR_RESOURCE_IRN_VISITED); current_ir_graph = rem; } @@ -1115,12 +1110,12 @@ static ir_node *applyOneEdge(ir_node *iv, ir_node *rc, LFTR_edge *e, iv_env *env DB((dbg, LEVEL_4, " + %+F", tv_r)); break; case iro_Sub: - tv = tarval_sub(tv_l, tv_r); - tv_init = tarval_sub(tv_init, tv_r); + tv = tarval_sub(tv_l, tv_r, NULL); + tv_init = tarval_sub(tv_init, tv_r, NULL); DB((dbg, LEVEL_4, " - %+F", tv_r)); break; default: - assert(0); + panic("Unsupported opcode"); tv = tarval_bad; } @@ -1128,7 +1123,7 @@ static ir_node *applyOneEdge(ir_node *iv, ir_node *rc, LFTR_edge *e, iv_env *env tv = tarval_add(tv, tv_incr); } else { assert(pscc->code == iro_Sub); - tv = tarval_sub(tv, tv_incr); + tv = tarval_sub(tv, tv_incr, NULL); } tarval_set_integer_overflow_mode(ovmode); @@ -1137,7 +1132,7 @@ static ir_node *applyOneEdge(ir_node *iv, ir_node *rc, LFTR_edge *e, iv_env *env DB((dbg, LEVEL_4, " = OVERFLOW")); return NULL; } - return new_r_Const(current_ir_graph, get_irn_n(rc, -1), get_tarval_mode(tv), tv); + return new_Const(tv); } return do_apply(e->code, NULL, rc, e->rc, get_irn_mode(rc)); } @@ -1192,7 +1187,7 @@ static void do_lftr(ir_node *cmp, void *ctx) { ir_node *iv, *rc; ir_node *nleft = NULL, *nright = NULL; - if (get_irn_op(cmp) != op_Cmp) + if (!is_Cmp(cmp)) return; left = get_Cmp_left(cmp); @@ -1300,7 +1295,8 @@ void opt_osr(ir_graph *irg, unsigned flags) { if (env.replaced) { /* try linear function test replacements */ - lftr(irg, &env); + //lftr(irg, &env); // currently buggy :-( + (void) lftr; set_irg_outs_inconsistent(irg); DB((dbg, LEVEL_1, "Replacements: %u + %u (lftr)\n\n", env.replaced, env.lftr_replaced));