comparison gcc/tree-scalar-evolution.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
1 /* Scalar evolution detector. 1 /* Scalar evolution detector.
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 Contributed by Sebastian Pop <s.pop@laposte.net> 4 Contributed by Sebastian Pop <s.pop@laposte.net>
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
258 #include "system.h" 258 #include "system.h"
259 #include "coretypes.h" 259 #include "coretypes.h"
260 #include "tm.h" 260 #include "tm.h"
261 #include "ggc.h" 261 #include "ggc.h"
262 #include "tree.h" 262 #include "tree.h"
263 #include "real.h"
264
265 /* These RTL headers are needed for basic-block.h. */
266 #include "rtl.h"
267 #include "basic-block.h" 263 #include "basic-block.h"
268 #include "diagnostic.h" 264 #include "diagnostic.h"
265 #include "tree-pretty-print.h"
266 #include "gimple-pretty-print.h"
269 #include "tree-flow.h" 267 #include "tree-flow.h"
270 #include "tree-dump.h" 268 #include "tree-dump.h"
271 #include "timevar.h" 269 #include "timevar.h"
272 #include "cfgloop.h" 270 #include "cfgloop.h"
273 #include "tree-chrec.h" 271 #include "tree-chrec.h"
1640 1638
1641 /* Otherwise really interpret the loop phi. */ 1639 /* Otherwise really interpret the loop phi. */
1642 init_cond = analyze_initial_condition (loop_phi_node); 1640 init_cond = analyze_initial_condition (loop_phi_node);
1643 res = analyze_evolution_in_loop (loop_phi_node, init_cond); 1641 res = analyze_evolution_in_loop (loop_phi_node, init_cond);
1644 1642
1643 /* Verify we maintained the correct initial condition throughout
1644 possible conversions in the SSA chain. */
1645 if (res != chrec_dont_know)
1646 {
1647 tree new_init = res;
1648 if (CONVERT_EXPR_P (res)
1649 && TREE_CODE (TREE_OPERAND (res, 0)) == POLYNOMIAL_CHREC)
1650 new_init = fold_convert (TREE_TYPE (res),
1651 CHREC_LEFT (TREE_OPERAND (res, 0)));
1652 else if (TREE_CODE (res) == POLYNOMIAL_CHREC)
1653 new_init = CHREC_LEFT (res);
1654 STRIP_USELESS_TYPE_CONVERSION (new_init);
1655 gcc_assert (TREE_CODE (new_init) != POLYNOMIAL_CHREC);
1656 if (!operand_equal_p (init_cond, new_init, 0))
1657 return chrec_dont_know;
1658 }
1659
1645 return res; 1660 return res;
1646 } 1661 }
1647 1662
1648 /* This function merges the branches of a condition-phi-node, 1663 /* This function merges the branches of a condition-phi-node,
1649 contained in the outermost loop, and whose arguments are already 1664 contained in the outermost loop, and whose arguments are already
3014 { 3029 {
3015 loop->nb_iterations = NULL_TREE; 3030 loop->nb_iterations = NULL_TREE;
3016 } 3031 }
3017 } 3032 }
3018 3033
3019 /* Cleans up the information cached by the scalar evolutions analysis. */ 3034 /* Cleans up the information cached by the scalar evolutions analysis
3035 in the hash table. */
3036
3037 void
3038 scev_reset_htab (void)
3039 {
3040 if (!scalar_evolution_info)
3041 return;
3042
3043 htab_empty (scalar_evolution_info);
3044 }
3045
3046 /* Cleans up the information cached by the scalar evolutions analysis
3047 in the hash table and in the loop->nb_iterations. */
3020 3048
3021 void 3049 void
3022 scev_reset (void) 3050 scev_reset (void)
3023 { 3051 {
3024 loop_iterator li; 3052 loop_iterator li;
3025 struct loop *loop; 3053 struct loop *loop;
3026 3054
3027 if (!scalar_evolution_info || !current_loops) 3055 scev_reset_htab ();
3056
3057 if (!current_loops)
3028 return; 3058 return;
3029 3059
3030 htab_empty (scalar_evolution_info);
3031 FOR_EACH_LOOP (li, loop, 0) 3060 FOR_EACH_LOOP (li, loop, 0)
3032 { 3061 {
3033 loop->nb_iterations = NULL_TREE; 3062 loop->nb_iterations = NULL_TREE;
3034 } 3063 }
3035 } 3064 }