Mercurial > hg > CbC > CbC_gcc
diff gcc/loop-invariant.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
line wrap: on
line diff
--- a/gcc/loop-invariant.c Tue May 25 18:58:51 2010 +0900 +++ b/gcc/loop-invariant.c Tue Mar 22 17:18:12 2011 +0900 @@ -536,7 +536,7 @@ htab_t eq = htab_create (VEC_length (invariant_p, invariants), hash_invariant_expr, eq_invariant_expr, free); - for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++) + FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv) find_identical_invariants (eq, inv); htab_delete (eq); @@ -1173,11 +1173,13 @@ /* Calculates gain for eliminating invariant INV. REGS_USED is the number of registers used in the loop, NEW_REGS is the number of new variables already added due to the invariant motion. The number of registers needed - for it is stored in *REGS_NEEDED. */ + for it is stored in *REGS_NEEDED. SPEED and CALL_P are flags passed + through to estimate_reg_pressure_cost. */ static int gain_for_invariant (struct invariant *inv, unsigned *regs_needed, - unsigned *new_regs, unsigned regs_used, bool speed) + unsigned *new_regs, unsigned regs_used, + bool speed, bool call_p) { int comp_cost, size_cost; @@ -1188,9 +1190,9 @@ if (! flag_ira_loop_pressure) { size_cost = (estimate_reg_pressure_cost (new_regs[0] + regs_needed[0], - regs_used, speed) + regs_used, speed, call_p) - estimate_reg_pressure_cost (new_regs[0], - regs_used, speed)); + regs_used, speed, call_p)); } else { @@ -1245,13 +1247,14 @@ static int best_gain_for_invariant (struct invariant **best, unsigned *regs_needed, - unsigned *new_regs, unsigned regs_used, bool speed) + unsigned *new_regs, unsigned regs_used, + bool speed, bool call_p) { struct invariant *inv; int i, gain = 0, again; unsigned aregs_needed[N_REG_CLASSES], invno; - for (invno = 0; VEC_iterate (invariant_p, invariants, invno, inv); invno++) + FOR_EACH_VEC_ELT (invariant_p, invariants, invno, inv) { if (inv->move) continue; @@ -1261,7 +1264,7 @@ continue; again = gain_for_invariant (inv, aregs_needed, new_regs, regs_used, - speed); + speed, call_p); if (again > gain) { gain = again; @@ -1314,7 +1317,7 @@ /* Determines which invariants to move. */ static void -find_invariants_to_move (bool speed) +find_invariants_to_move (bool speed, bool call_p) { int gain; unsigned i, regs_used, regs_needed[N_REG_CLASSES], new_regs[N_REG_CLASSES]; @@ -1353,7 +1356,8 @@ new_regs[ira_reg_class_cover[i]] = 0; } while ((gain = best_gain_for_invariant (&inv, regs_needed, - new_regs, regs_used, speed)) > 0) + new_regs, regs_used, + speed, call_p)) > 0) { set_move_mark (inv->invno, gain); if (! flag_ira_loop_pressure) @@ -1504,11 +1508,11 @@ struct invariant *inv; unsigned i; - for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++) + FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv) move_invariant_reg (loop, i); if (flag_ira_loop_pressure && resize_reg_info ()) { - for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++) + FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv) if (inv->reg != NULL_RTX) { if (inv->orig_regno >= 0) @@ -1557,7 +1561,7 @@ } } - for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++) + FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv) { BITMAP_FREE (inv->depends_on); free (inv); @@ -1573,7 +1577,8 @@ init_inv_motion_data (); find_invariants (loop); - find_invariants_to_move (optimize_loop_for_speed_p (loop)); + find_invariants_to_move (optimize_loop_for_speed_p (loop), + LOOP_DATA (loop)->has_call); move_invariants (loop); free_inv_motion_data (); @@ -1666,9 +1671,8 @@ loop != current_loops->tree_root; loop = loop_outer (loop)) bitmap_set_bit (&LOOP_DATA (loop)->regs_live, regno); - if (bitmap_bit_p (&curr_regs_live, regno)) + if (!bitmap_set_bit (&curr_regs_live, regno)) return; - bitmap_set_bit (&curr_regs_live, regno); change_pressure (regno, true); } @@ -1676,9 +1680,8 @@ static void mark_regno_death (int regno) { - if (! bitmap_bit_p (&curr_regs_live, regno)) + if (! bitmap_clear_bit (&curr_regs_live, regno)) return; - bitmap_clear_bit (&curr_regs_live, regno); change_pressure (regno, false); }