X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fstrength_red.c;h=565a9f4649ad9b4b40d3b1300cde2b1ddcc082fd;hb=f1a1a6092d9e4ebd9e22dd1c57d76ef8aeda74fc;hp=fbe47c7319bbb53e9545eeb7e5a4f2940d6cf22f;hpb=e1cdd79388b3cb305458548303221a210b8355c9;p=libfirm diff --git a/ir/opt/strength_red.c b/ir/opt/strength_red.c index fbe47c731..565a9f464 100644 --- a/ir/opt/strength_red.c +++ b/ir/opt/strength_red.c @@ -45,29 +45,6 @@ reduce_itervar(induct_var_info *iv) # include "firmstat.h" -/* The information needed for an induction variable */ -typedef struct _induct_var_info { - ir_op *operation_code; /**< the opcode of the induction variable, either op_Add or op_Sub */ - ir_node *increment; /**< the increment/decrement expression of the induction vriable */ - ir_node *init; /**< the init expression */ - ir_node *op; /**< the modify expression of the induction variable, ie the Add/Sub */ - ir_node *itervar_phi; /**< the Phi operation of the induction variable */ - ir_node *c, *new_phi, *new_increment, *new_init; - ir_node *new_op, *new_add, *reducible_node; - ir_node *old_ind, *symconst, *new_cmp; - ir_node *cmp_const; /**< the (loop invariant) expression that compared with the induction variable */ - ir_node *cmp_init_block; - ir_node *cmp; /**< if set, the cmp at the end of the loop using the induction variable */ - ir_loop *l_itervar_phi; /**< the loop of the induction variable */ - int strong_reduced; - int init_pred_pos; /**< the position of the init expression in the inductions Phi */ - int op_pred_pos; /**< the position of the induction operation in the inductions Phi */ - int out_loop_res; - int phi_pred; /**< number of users of the induction variable's phi */ - int reducible; /**< set if reducible */ -} induct_var_info; - - /** Counter for verbose information about optimization. */ static int n_reduced_expressions; static int n_made_new_phis; @@ -90,9 +67,10 @@ static int n_made_new_phis; * op or loop invariant. * * @param n A phi node. - * @param info After call contains the induction variable information + * @param info After call contains the induction variable information. */ -static induct_var_info *is_induction_variable (induct_var_info *info) { + +induct_var_info *is_induction_variable (induct_var_info *info) { int i; int op_pred, Store_in_op, Store_in_phi, cmp_in_phi; @@ -132,7 +110,7 @@ static induct_var_info *is_induction_variable (induct_var_info *info) { ir_node *pred = get_Phi_pred(info->itervar_phi, i); ir_op *op = get_irn_op(pred); - /* Compute if the induction variable is added or substracted wiht a constant . */ + /* Compute if the induction variable is added or substracted with a constant . */ if (op == op_Add || op == op_Sub) { ir_node *n_l = get_binop_left(pred); ir_node *n_r = get_binop_right(pred); @@ -187,7 +165,7 @@ static induct_var_info *is_induction_variable (induct_var_info *info) { /* Information about loop of itervar_phi. */ info->l_itervar_phi = get_irn_loop(get_nodes_block(info->itervar_phi)); - /* This "for" searchs for the Cmp successor of the + /* This "for" searches for the Cmp successor of the iter_var to reduce and marks if the iter_var have a Store successor or a successor out of loop.*/ info->phi_pred = get_irn_n_outs(info->itervar_phi); @@ -595,7 +573,7 @@ void reduce_strength(ir_graph *irg) { /* Call algorithm that computes the dominator trees. */ compute_doms(irg); /* Call algorithm that computes the out edges */ - compute_outs(irg); + compute_irg_outs(irg); /* -- Search expressions that can be optimized -- */ irg_walk_graph(irg, NULL, reduce_itervar, NULL);