Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-ssa-loop-manip.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 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
24 #include "tm.h" | 24 #include "tm.h" |
25 #include "tree.h" | 25 #include "tree.h" |
26 #include "tm_p.h" | 26 #include "tm_p.h" |
27 #include "basic-block.h" | 27 #include "basic-block.h" |
28 #include "output.h" | 28 #include "output.h" |
29 #include "diagnostic.h" | |
30 #include "tree-flow.h" | 29 #include "tree-flow.h" |
31 #include "tree-dump.h" | 30 #include "tree-dump.h" |
32 #include "timevar.h" | 31 #include "timevar.h" |
33 #include "cfgloop.h" | 32 #include "cfgloop.h" |
34 #include "tree-pass.h" | 33 #include "tree-pass.h" |
439 } | 438 } |
440 | 439 |
441 /* Checks that invariants of the loop closed ssa form are preserved. | 440 /* Checks that invariants of the loop closed ssa form are preserved. |
442 Call verify_ssa when VERIFY_SSA_P is true. */ | 441 Call verify_ssa when VERIFY_SSA_P is true. */ |
443 | 442 |
444 void | 443 DEBUG_FUNCTION void |
445 verify_loop_closed_ssa (bool verify_ssa_p) | 444 verify_loop_closed_ssa (bool verify_ssa_p) |
446 { | 445 { |
447 basic_block bb; | 446 basic_block bb; |
448 gimple_stmt_iterator bsi; | 447 gimple_stmt_iterator bsi; |
449 gimple phi; | 448 gimple phi; |
453 if (number_of_loops () <= 1) | 452 if (number_of_loops () <= 1) |
454 return; | 453 return; |
455 | 454 |
456 if (verify_ssa_p) | 455 if (verify_ssa_p) |
457 verify_ssa (false); | 456 verify_ssa (false); |
457 | |
458 timevar_push (TV_VERIFY_LOOP_CLOSED); | |
458 | 459 |
459 FOR_EACH_BB (bb) | 460 FOR_EACH_BB (bb) |
460 { | 461 { |
461 for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) | 462 for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) |
462 { | 463 { |
467 } | 468 } |
468 | 469 |
469 for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) | 470 for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) |
470 check_loop_closed_ssa_stmt (bb, gsi_stmt (bsi)); | 471 check_loop_closed_ssa_stmt (bb, gsi_stmt (bsi)); |
471 } | 472 } |
473 | |
474 timevar_pop (TV_VERIFY_LOOP_CLOSED); | |
472 } | 475 } |
473 | 476 |
474 /* Split loop exit edge EXIT. The things are a bit complicated by a need to | 477 /* Split loop exit edge EXIT. The things are a bit complicated by a need to |
475 preserve the loop closed ssa form. The newly created block is returned. */ | 478 preserve the loop closed ssa form. The newly created block is returned. */ |
476 | 479 |
1044 (loop, loop_latch_edge (loop), factor - 1, | 1047 (loop, loop_latch_edge (loop), factor - 1, |
1045 wont_exit, new_exit, &to_remove, DLTHE_FLAG_UPDATE_FREQ); | 1048 wont_exit, new_exit, &to_remove, DLTHE_FLAG_UPDATE_FREQ); |
1046 free (wont_exit); | 1049 free (wont_exit); |
1047 gcc_assert (ok); | 1050 gcc_assert (ok); |
1048 | 1051 |
1049 for (i = 0; VEC_iterate (edge, to_remove, i, e); i++) | 1052 FOR_EACH_VEC_ELT (edge, to_remove, i, e) |
1050 { | 1053 { |
1051 ok = remove_path (e); | 1054 ok = remove_path (e); |
1052 gcc_assert (ok); | 1055 gcc_assert (ok); |
1053 } | 1056 } |
1054 VEC_free (edge, heap, to_remove); | 1057 VEC_free (edge, heap, to_remove); |
1080 scale_bbs_frequencies_int (&loop->latch, 1, new_nonexit->probability, | 1083 scale_bbs_frequencies_int (&loop->latch, 1, new_nonexit->probability, |
1081 prob); | 1084 prob); |
1082 | 1085 |
1083 /* Finally create the new counter for number of iterations and add the new | 1086 /* Finally create the new counter for number of iterations and add the new |
1084 exit instruction. */ | 1087 exit instruction. */ |
1085 bsi = gsi_last_bb (exit_bb); | 1088 bsi = gsi_last_nondebug_bb (exit_bb); |
1086 exit_if = gsi_stmt (bsi); | 1089 exit_if = gsi_stmt (bsi); |
1087 create_iv (exit_base, exit_step, NULL_TREE, loop, | 1090 create_iv (exit_base, exit_step, NULL_TREE, loop, |
1088 &bsi, false, &ctr_before, &ctr_after); | 1091 &bsi, false, &ctr_before, &ctr_after); |
1089 gimple_cond_set_code (exit_if, exit_cmp); | 1092 gimple_cond_set_code (exit_if, exit_cmp); |
1090 gimple_cond_set_lhs (exit_if, ctr_after); | 1093 gimple_cond_set_lhs (exit_if, ctr_after); |
1216 *nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE); | 1219 *nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE); |
1217 if (stmts) | 1220 if (stmts) |
1218 gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts); | 1221 gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts); |
1219 } | 1222 } |
1220 | 1223 |
1221 gsi = gsi_last_bb (bump_in_latch ? loop->latch : loop->header); | 1224 if (bump_in_latch) |
1225 gsi = gsi_last_bb (loop->latch); | |
1226 else | |
1227 gsi = gsi_last_nondebug_bb (loop->header); | |
1222 create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE, | 1228 create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE, |
1223 loop, &gsi, bump_in_latch, &var_before, NULL); | 1229 loop, &gsi, bump_in_latch, &var_before, NULL); |
1224 | 1230 |
1225 rewrite_all_phi_nodes_with_iv (loop, var_before); | 1231 rewrite_all_phi_nodes_with_iv (loop, var_before); |
1226 | 1232 |