comparison gcc/tree-ssa-loop.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
1 /* Loop optimizations over tree-ssa. 1 /* Loop optimizations over tree-ssa.
2 Copyright (C) 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 2 Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
3 4
4 This file is part of GCC. 5 This file is part of GCC.
5 6
6 GCC is free software; you can redistribute it and/or modify it 7 GCC is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
23 #include "tm.h" 24 #include "tm.h"
24 #include "tree.h" 25 #include "tree.h"
25 #include "tm_p.h" 26 #include "tm_p.h"
26 #include "basic-block.h" 27 #include "basic-block.h"
27 #include "output.h" 28 #include "output.h"
28 #include "diagnostic.h"
29 #include "tree-flow.h" 29 #include "tree-flow.h"
30 #include "tree-dump.h" 30 #include "tree-dump.h"
31 #include "tree-pass.h" 31 #include "tree-pass.h"
32 #include "timevar.h" 32 #include "timevar.h"
33 #include "cfgloop.h" 33 #include "cfgloop.h"
34 #include "flags.h" 34 #include "flags.h"
35 #include "tree-inline.h" 35 #include "tree-inline.h"
36 #include "tree-scalar-evolution.h" 36 #include "tree-scalar-evolution.h"
37 #include "toplev.h" 37 #include "diagnostic-core.h"
38 #include "tree-vectorizer.h" 38 #include "tree-vectorizer.h"
39 39
40 /* The loop superpass. */ 40 /* The loop superpass. */
41 41
42 static bool 42 static bool
177 run_tree_predictive_commoning (void) 177 run_tree_predictive_commoning (void)
178 { 178 {
179 if (!current_loops) 179 if (!current_loops)
180 return 0; 180 return 0;
181 181
182 tree_predictive_commoning (); 182 return tree_predictive_commoning ();
183 return 0;
184 } 183 }
185 184
186 static bool 185 static bool
187 gate_tree_predictive_commoning (void) 186 gate_tree_predictive_commoning (void)
188 { 187 {
244 TODO_dump_func | TODO_update_ssa 243 TODO_dump_func | TODO_update_ssa
245 | TODO_ggc_collect /* todo_flags_finish */ 244 | TODO_ggc_collect /* todo_flags_finish */
246 } 245 }
247 }; 246 };
248 247
249 /* Loop nest optimizations. */
250
251 static unsigned int
252 tree_linear_transform (void)
253 {
254 if (number_of_loops () <= 1)
255 return 0;
256
257 linear_transform_loops ();
258 return 0;
259 }
260
261 static bool
262 gate_tree_linear_transform (void)
263 {
264 return flag_tree_loop_linear != 0;
265 }
266
267 struct gimple_opt_pass pass_linear_transform =
268 {
269 {
270 GIMPLE_PASS,
271 "ltrans", /* name */
272 gate_tree_linear_transform, /* gate */
273 tree_linear_transform, /* execute */
274 NULL, /* sub */
275 NULL, /* next */
276 0, /* static_pass_number */
277 TV_TREE_LINEAR_TRANSFORM, /* tv_id */
278 PROP_cfg | PROP_ssa, /* properties_required */
279 0, /* properties_provided */
280 0, /* properties_destroyed */
281 0, /* todo_flags_start */
282 TODO_dump_func
283 | TODO_update_ssa_only_virtuals
284 | TODO_ggc_collect /* todo_flags_finish */
285 }
286 };
287
288 /* GRAPHITE optimizations. */ 248 /* GRAPHITE optimizations. */
289 249
290 static unsigned int 250 static unsigned int
291 graphite_transforms (void) 251 graphite_transforms (void)
292 { 252 {
301 static bool 261 static bool
302 gate_graphite_transforms (void) 262 gate_graphite_transforms (void)
303 { 263 {
304 /* Enable -fgraphite pass if any one of the graphite optimization flags 264 /* Enable -fgraphite pass if any one of the graphite optimization flags
305 is turned on. */ 265 is turned on. */
306 if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine 266 if (flag_loop_block
307 || flag_graphite_identity || flag_loop_parallelize_all) 267 || flag_loop_interchange
268 || flag_loop_strip_mine
269 || flag_graphite_identity
270 || flag_loop_parallelize_all
271 || flag_loop_flatten)
308 flag_graphite = 1; 272 flag_graphite = 1;
309 273
310 return flag_graphite != 0; 274 return flag_graphite != 0;
311 } 275 }
276
277 struct gimple_opt_pass pass_graphite =
278 {
279 {
280 GIMPLE_PASS,
281 "graphite0", /* name */
282 gate_graphite_transforms, /* gate */
283 NULL, /* execute */
284 NULL, /* sub */
285 NULL, /* next */
286 0, /* static_pass_number */
287 TV_GRAPHITE, /* tv_id */
288 PROP_cfg | PROP_ssa, /* properties_required */
289 0, /* properties_provided */
290 0, /* properties_destroyed */
291 0, /* todo_flags_start */
292 0 /* todo_flags_finish */
293 }
294 };
312 295
313 struct gimple_opt_pass pass_graphite_transforms = 296 struct gimple_opt_pass pass_graphite_transforms =
314 { 297 {
315 { 298 {
316 GIMPLE_PASS, 299 GIMPLE_PASS,
323 TV_GRAPHITE_TRANSFORMS, /* tv_id */ 306 TV_GRAPHITE_TRANSFORMS, /* tv_id */
324 PROP_cfg | PROP_ssa, /* properties_required */ 307 PROP_cfg | PROP_ssa, /* properties_required */
325 0, /* properties_provided */ 308 0, /* properties_provided */
326 0, /* properties_destroyed */ 309 0, /* properties_destroyed */
327 0, /* todo_flags_start */ 310 0, /* todo_flags_start */
328 0 /* todo_flags_finish */ 311 TODO_dump_func /* todo_flags_finish */
329 } 312 }
330 }; 313 };
331 314
332 /* Check the correctness of the data dependence analyzers. */ 315 /* Check the correctness of the data dependence analyzers. */
333 316
437 tree_ssa_loop_bounds (void) 420 tree_ssa_loop_bounds (void)
438 { 421 {
439 if (number_of_loops () <= 1) 422 if (number_of_loops () <= 1)
440 return 0; 423 return 0;
441 424
442 estimate_numbers_of_iterations (); 425 estimate_numbers_of_iterations (true);
443 scev_reset (); 426 scev_reset ();
444 return 0; 427 return 0;
445 } 428 }
446 429
447 struct gimple_opt_pass pass_record_bounds = 430 struct gimple_opt_pass pass_record_bounds =
542 TV_COMPLETE_UNROLL, /* tv_id */ 525 TV_COMPLETE_UNROLL, /* tv_id */
543 PROP_cfg | PROP_ssa, /* properties_required */ 526 PROP_cfg | PROP_ssa, /* properties_required */
544 0, /* properties_provided */ 527 0, /* properties_provided */
545 0, /* properties_destroyed */ 528 0, /* properties_destroyed */
546 0, /* todo_flags_start */ 529 0, /* todo_flags_start */
547 TODO_dump_func 530 TODO_verify_flow
531 | TODO_dump_func
548 | TODO_ggc_collect /* todo_flags_finish */ 532 | TODO_ggc_collect /* todo_flags_finish */
549 } 533 }
550 }; 534 };
551 535
552 /* Parallelization. */ 536 /* Parallelization. */
599 } 583 }
600 584
601 static bool 585 static bool
602 gate_tree_ssa_loop_prefetch (void) 586 gate_tree_ssa_loop_prefetch (void)
603 { 587 {
604 return flag_prefetch_loop_arrays != 0; 588 return flag_prefetch_loop_arrays > 0;
605 } 589 }
606 590
607 struct gimple_opt_pass pass_loop_prefetch = 591 struct gimple_opt_pass pass_loop_prefetch =
608 { 592 {
609 { 593 {
684 TV_TREE_LOOP_FINI, /* tv_id */ 668 TV_TREE_LOOP_FINI, /* tv_id */
685 PROP_cfg, /* properties_required */ 669 PROP_cfg, /* properties_required */
686 0, /* properties_provided */ 670 0, /* properties_provided */
687 0, /* properties_destroyed */ 671 0, /* properties_destroyed */
688 0, /* todo_flags_start */ 672 0, /* todo_flags_start */
689 TODO_cleanup_cfg | TODO_dump_func /* todo_flags_finish */ 673 TODO_cleanup_cfg
690 } 674 | TODO_verify_flow
691 }; 675 | TODO_dump_func /* todo_flags_finish */
676 }
677 };