
	* tree-flow.h: Move some protoypes.  Include new tree-ssa-loop.h.
	(struct affine_iv, struct tree_niter_desc): Move to tree-ssa-loop.h.
	(enum move_pos): Move to tree-ssa-loop-niter.h
	* cfgloop.h: Move some prototypes.
	* tree-ssa-loop.h: New File.  Include other tree-ssa-loop-*.h files.
	(struct affine_iv, struct tree_niter_desc): Relocate from tree-flow.h.
	* tree-ssa-loop-ch.c: (do_while_loop_p): Make static.
	* tree-ssa-loop-im.h: New file.  Add prototypes.
	(enum move_pos): Move here.
	* tree-ssa-loop-ivcanon.c (loop_edge_to_cancel, unloop_loops): Make
	static.
	* tree-ssa-loop-ivcanon.h: New file.  Add prototypes.
	* tree-ssa-loop-ivopts.c: Remove local prototypes.
	(stmt_invariant_in_loop_p): Remove unused function.
	* tree-ssa-loop-ivopts.h: New file.  Add prototypes.
	* tree-ssa-loop-manip.h: New file.  Add prototypes.
	* tree-ssa-loop-niter.c (double_int_cmp, bound_index,
	estimate_numbers_of_iterations_loop): Make static.
	* tree-ssa-loop-niter.h: New file.  Add prototypes.
	* tree-ssa-loop-prefetch.h: New file.  Add prototypes.
	* tree-ssa-loop-unswitch.h: New file.  Add prototypes.
	* tree-ssa-loop.c: Include tree-ssa-loop-{prefetch,unswitch}.h
	* loop-iv.c: Include tree-ssa-loop-niter.h.
	* loop-unroll.c: Include tree-ssa-loop-niter.h.
	* loop-unswitch.c: Include tree-ssa-loop-niter.h.


Index: tree-flow.h
===================================================================
*** tree-flow.h	(revision 203128)
--- tree-flow.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 35,40 ****
--- 35,41 ----
  #include "tree-pretty-print.h"
  #include "gimple-low.h"
  #include "tree-into-ssa.h"
+ #include "tree-ssa-loop.h"
  
  /* This structure is used to map a gimple statement to a label,
     or list of labels to represent transaction restart.  */
*************** extern basic_block move_sese_region_to_f
*** 244,352 ****
  void remove_edge_and_dominated_blocks (edge);
  bool tree_node_can_be_shared (tree);
  
- /* In tree-ssa-loop-ch.c  */
- bool do_while_loop_p (struct loop *);
- 
- /* Affine iv.  */
- 
- typedef struct
- {
-   /* Iv = BASE + STEP * i.  */
-   tree base, step;
- 
-   /* True if this iv does not overflow.  */
-   bool no_overflow;
- } affine_iv;
- 
- /* Description of number of iterations of a loop.  All the expressions inside
-    the structure can be evaluated at the end of the loop's preheader
-    (and due to ssa form, also anywhere inside the body of the loop).  */
- 
- struct tree_niter_desc
- {
-   tree assumptions;	/* The boolean expression.  If this expression evaluates
- 			   to false, then the other fields in this structure
- 			   should not be used; there is no guarantee that they
- 			   will be correct.  */
-   tree may_be_zero;	/* The boolean expression.  If it evaluates to true,
- 			   the loop will exit in the first iteration (i.e.
- 			   its latch will not be executed), even if the niter
- 			   field says otherwise.  */
-   tree niter;		/* The expression giving the number of iterations of
- 			   a loop (provided that assumptions == true and
- 			   may_be_zero == false), more precisely the number
- 			   of executions of the latch of the loop.  */
-   double_int max;	/* The upper bound on the number of iterations of
- 			   the loop.  */
- 
-   /* The simplified shape of the exit condition.  The loop exits if
-      CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
-      LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
-      LE_EXPR and negative if CMP is GE_EXPR.  This information is used
-      by loop unrolling.  */
-   affine_iv control;
-   tree bound;
-   enum tree_code cmp;
- };
  
  
  /* In tree-ssa-loop*.c  */
  
- unsigned int tree_ssa_lim (void);
- unsigned int tree_ssa_unswitch_loops (void);
- unsigned int canonicalize_induction_variables (void);
- unsigned int tree_unroll_loops_completely (bool, bool);
- unsigned int tree_ssa_prefetch_arrays (void);
- void tree_ssa_iv_optimize (void);
  unsigned tree_predictive_commoning (void);
- tree canonicalize_loop_ivs (struct loop *, tree *, bool);
  bool parallelize_loops (void);
  
- bool loop_only_exit_p (const struct loop *, const_edge);
- bool number_of_iterations_exit (struct loop *, edge,
- 				struct tree_niter_desc *niter, bool,
- 				bool every_iteration = true);
- tree find_loop_niter (struct loop *, edge *);
- tree loop_niter_by_eval (struct loop *, edge);
- tree find_loop_niter_by_eval (struct loop *, edge *);
- void estimate_numbers_of_iterations (void);
- bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool);
  bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple, bool);
  
- bool nowrap_type_p (tree);
  enum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN};
  enum ev_direction scev_direction (const_tree);
  
- void free_numbers_of_iterations_estimates (void);
- void free_numbers_of_iterations_estimates_loop (struct loop *);
- void rewrite_into_loop_closed_ssa (bitmap, unsigned);
- void verify_loop_closed_ssa (bool);
- bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
- void create_iv (tree, tree, tree, struct loop *, gimple_stmt_iterator *, bool,
- 		tree *, tree *);
- basic_block split_loop_exit_edge (edge);
- void standard_iv_increment_position (struct loop *, gimple_stmt_iterator *,
- 				     bool *);
- basic_block ip_end_pos (struct loop *);
- basic_block ip_normal_pos (struct loop *);
- bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
- 					 unsigned int, sbitmap,
- 					 edge, vec<edge> *,
- 					 int);
  struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
- tree expand_simple_operations (tree);
- void substitute_in_loop_info (struct loop *, tree, tree);
- edge single_dom_exit (struct loop *);
- bool can_unroll_loop_p (struct loop *loop, unsigned factor,
- 			struct tree_niter_desc *niter);
- void tree_unroll_loop (struct loop *, unsigned,
- 		       edge, struct tree_niter_desc *);
- typedef void (*transform_callback)(struct loop *, void *);
- void tree_transform_and_unroll_loop (struct loop *, unsigned,
- 				     edge, struct tree_niter_desc *,
- 				     transform_callback, void *);
- bool contains_abnormal_ssa_name_p (tree);
- bool stmt_dominates_stmt_p (gimple, gimple);
  
  /* In tree-ssa-threadedge.c */
  extern void threadedge_initialize_values (void);
--- 245,263 ----
*************** extern void thread_across_edge (gimple,
*** 362,380 ****
  				vec<tree> *, tree (*) (gimple, gimple));
  extern void propagate_threaded_block_debug_into (basic_block, basic_block);
  
- /* In tree-ssa-loop-im.c  */
- /* The possibilities of statement movement.  */
- 
- enum move_pos
-   {
-     MOVE_IMPOSSIBLE,		/* No movement -- side effect expression.  */
-     MOVE_PRESERVE_EXECUTION,	/* Must not cause the non-executed statement
- 				   become executed -- memory accesses, ... */
-     MOVE_POSSIBLE		/* Unlimited movement.  */
-   };
- extern enum move_pos movement_possibility (gimple);
- char *get_lsm_tmp_name (tree, unsigned);
- 
  /* In tree-flow-inline.h  */
  static inline bool unmodifiable_var_p (const_tree);
  static inline bool ref_contains_array_ref (const_tree);
--- 273,278 ----
*************** extern void graphite_transform_loops (vo
*** 417,430 ****
  /* In tree-data-ref.c  */
  extern void tree_check_data_deps (void);
  
- /* In tree-ssa-loop-ivopts.c  */
- bool expr_invariant_in_loop_p (struct loop *, tree);
- bool stmt_invariant_in_loop_p (struct loop *, gimple);
- struct loop *outermost_invariant_loop_for_expr (struct loop *, tree);
- bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
- 				      addr_space_t);
- bool may_be_nonaddressable_p (tree expr);
- 
  /* In gimplify.c  */
  tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
  tree force_gimple_operand (tree, gimple_seq *, bool, tree);
--- 315,320 ----
Index: cfgloop.h
===================================================================
*** cfgloop.h	(revision 203128)
--- cfgloop.h	(working copy)
*************** extern bool flow_bb_inside_loop_p (const
*** 255,261 ****
  extern struct loop * find_common_loop (struct loop *, struct loop *);
  struct loop *superloop_at_depth (struct loop *, unsigned);
  struct eni_weights_d;
- extern unsigned tree_num_loop_insns (struct loop *, struct eni_weights_d *);
  extern int num_loop_insns (const struct loop *);
  extern int average_num_loop_insns (const struct loop *);
  extern unsigned get_loop_level (const struct loop *);
--- 255,260 ----
*************** gcov_type expected_loop_iterations_unbou
*** 306,321 ****
  extern unsigned expected_loop_iterations (const struct loop *);
  extern rtx doloop_condition_get (rtx);
  
- void estimate_numbers_of_iterations_loop (struct loop *);
- void record_niter_bound (struct loop *, double_int, bool, bool);
- bool estimated_loop_iterations (struct loop *, double_int *);
- bool max_loop_iterations (struct loop *, double_int *);
- HOST_WIDE_INT estimated_loop_iterations_int (struct loop *);
- HOST_WIDE_INT max_loop_iterations_int (struct loop *);
- bool max_stmt_executions (struct loop *, double_int *);
- bool estimated_stmt_executions (struct loop *, double_int *);
- HOST_WIDE_INT max_stmt_executions_int (struct loop *);
- HOST_WIDE_INT estimated_stmt_executions_int (struct loop *);
  
  /* Loop manipulation.  */
  extern bool can_duplicate_loop_p (const struct loop *loop);
--- 305,310 ----
*************** enum
*** 735,741 ****
  extern void unroll_and_peel_loops (int);
  extern void doloop_optimize_loops (void);
  extern void move_loop_invariants (void);
- extern bool finite_loop_p (struct loop *);
  extern void scale_loop_profile (struct loop *loop, int scale, gcov_type iteration_bound);
  extern vec<basic_block> get_loop_hot_path (const struct loop *loop);
  
--- 724,729 ----
Index: tree-ssa-loop.h
===================================================================
*** tree-ssa-loop.h	(revision 0)
--- tree-ssa-loop.h	(working copy)
***************
*** 0 ****
--- 1,71 ----
+ /* Header file for SSA loop optimizations.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_H
+ #define GCC_TREE_SSA_LOOP_H
+ 
+ /* Affine iv.  */
+ 
+ typedef struct
+ {
+   /* Iv = BASE + STEP * i.  */
+   tree base, step;
+ 
+   /* True if this iv does not overflow.  */
+   bool no_overflow;
+ } affine_iv;
+ 
+ /* Description of number of iterations of a loop.  All the expressions inside
+    the structure can be evaluated at the end of the loop's preheader
+    (and due to ssa form, also anywhere inside the body of the loop).  */
+ 
+ struct tree_niter_desc
+ {
+   tree assumptions;	/* The boolean expression.  If this expression evaluates
+ 			   to false, then the other fields in this structure
+ 			   should not be used; there is no guarantee that they
+ 			   will be correct.  */
+   tree may_be_zero;	/* The boolean expression.  If it evaluates to true,
+ 			   the loop will exit in the first iteration (i.e.
+ 			   its latch will not be executed), even if the niter
+ 			   field says otherwise.  */
+   tree niter;		/* The expression giving the number of iterations of
+ 			   a loop (provided that assumptions == true and
+ 			   may_be_zero == false), more precisely the number
+ 			   of executions of the latch of the loop.  */
+   double_int max;	/* The upper bound on the number of iterations of
+ 			   the loop.  */
+ 
+   /* The simplified shape of the exit condition.  The loop exits if
+      CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
+      LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
+      LE_EXPR and negative if CMP is GE_EXPR.  This information is used
+      by loop unrolling.  */
+   affine_iv control;
+   tree bound;
+   enum tree_code cmp;
+ };
+ 
+ #include "tree-ssa-loop-im.h"
+ #include "tree-ssa-loop-ivcanon.h"
+ #include "tree-ssa-loop-ivopts.h"
+ #include "tree-ssa-loop-manip.h"
+ #include "tree-ssa-loop-niter.h"
+ 
+ #endif /* GCC_TREE_SSA_LOOP_H */
Index: tree-ssa-loop-ch.c
===================================================================
*** tree-ssa-loop-ch.c	(revision 203128)
--- tree-ssa-loop-ch.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 29,35 ****
  #include "cfgloop.h"
  #include "tree-inline.h"
  #include "flags.h"
- #include "tree-inline.h"
  
  /* Duplicates headers of loops if they are small enough, so that the statements
     in the loop body are always executed when the loop is entered.  This
--- 29,34 ----
*************** should_duplicate_loop_header_p (basic_bl
*** 100,106 ****
  
  /* Checks whether LOOP is a do-while style loop.  */
  
! bool
  do_while_loop_p (struct loop *loop)
  {
    gimple stmt = last_stmt (loop->latch);
--- 99,105 ----
  
  /* Checks whether LOOP is a do-while style loop.  */
  
! static bool
  do_while_loop_p (struct loop *loop)
  {
    gimple stmt = last_stmt (loop->latch);
Index: tree-ssa-loop-im.h
===================================================================
*** tree-ssa-loop-im.h	(revision 0)
--- tree-ssa-loop-im.h	(working copy)
***************
*** 0 ****
--- 1,37 ----
+ /* Header file for loop invariant motion.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_IM_H
+ #define GCC_TREE_SSA_LOOP_IM_H
+ 
+ /* The possibilities of statement movement.  */
+ enum move_pos
+   {
+     MOVE_IMPOSSIBLE,		/* No movement -- side effect expression.  */
+     MOVE_PRESERVE_EXECUTION,	/* Must not cause the non-executed statement
+ 				   become executed -- memory accesses, ... */
+     MOVE_POSSIBLE		/* Unlimited movement.  */
+   };
+ 
+ extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
+ extern enum move_pos movement_possibility (gimple);
+ extern char *get_lsm_tmp_name (tree, unsigned);
+ unsigned int tree_ssa_lim (void);
+ 
+ #endif /* GCC_TREE_SSA_LOOP_IM_H */
Index: tree-ssa-loop-ivcanon.c
===================================================================
*** tree-ssa-loop-ivcanon.c	(revision 203128)
--- tree-ssa-loop-ivcanon.c	(working copy)
*************** estimated_unrolled_size (struct loop_siz
*** 422,428 ****
     loop-niter identified as having undefined effect in the last iteration.
     The other cases are hopefully rare and will be cleaned up later.  */
  
! edge
  loop_edge_to_cancel (struct loop *loop)
  {
    vec<edge> exits;
--- 422,428 ----
     loop-niter identified as having undefined effect in the last iteration.
     The other cases are hopefully rare and will be cleaned up later.  */
  
! static edge
  loop_edge_to_cancel (struct loop *loop)
  {
    vec<edge> exits;
*************** static vec<int> loops_to_unloop_nunroll;
*** 598,604 ****
     LOOP_CLOSED_SSA_INVALIDATED is used to bookkepp the case
     when we need to go into loop closed SSA form.  */
  
! void
  unloop_loops (bitmap loop_closed_ssa_invalidated,
  	      bool *irred_invalidated)
  {
--- 598,604 ----
     LOOP_CLOSED_SSA_INVALIDATED is used to bookkepp the case
     when we need to go into loop closed SSA form.  */
  
! static void
  unloop_loops (bitmap loop_closed_ssa_invalidated,
  	      bool *irred_invalidated)
  {
Index: tree-ssa-loop-ivcanon.h
===================================================================
*** tree-ssa-loop-ivcanon.h	(revision 0)
--- tree-ssa-loop-ivcanon.h	(working copy)
***************
*** 0 ****
--- 1,27 ----
+ /* Header file for Induction variable canonicalization and loop peeling.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_IVCANON_H
+ #define GCC_TREE_SSA_LOOP_IVCANON_H
+ 
+ extern unsigned tree_num_loop_insns (struct loop *, struct eni_weights_d *);
+ extern unsigned int canonicalize_induction_variables (void);
+ extern unsigned int tree_unroll_loops_completely (bool, bool);
+ 
+ #endif /* GCC_TREE_SSA_LOOP_IVCANON_H */
Index: tree-ssa-loop-ivopts.c
===================================================================
*** tree-ssa-loop-ivopts.c	(revision 203128)
--- tree-ssa-loop-ivopts.c	(working copy)
*************** single_dom_exit (struct loop *loop)
*** 452,458 ****
  
  /* Dumps information about the induction variable IV to FILE.  */
  
- extern void dump_iv (FILE *, struct iv *);
  void
  dump_iv (FILE *file, struct iv *iv)
  {
--- 452,457 ----
*************** dump_iv (FILE *file, struct iv *iv)
*** 497,503 ****
  
  /* Dumps information about the USE to FILE.  */
  
- extern void dump_use (FILE *, struct iv_use *);
  void
  dump_use (FILE *file, struct iv_use *use)
  {
--- 496,501 ----
*************** dump_use (FILE *file, struct iv_use *use
*** 541,547 ****
  
  /* Dumps information about the uses to FILE.  */
  
- extern void dump_uses (FILE *, struct ivopts_data *);
  void
  dump_uses (FILE *file, struct ivopts_data *data)
  {
--- 539,544 ----
*************** dump_uses (FILE *file, struct ivopts_dat
*** 559,565 ****
  
  /* Dumps information about induction variable candidate CAND to FILE.  */
  
- extern void dump_cand (FILE *, struct iv_cand *);
  void
  dump_cand (FILE *file, struct iv_cand *cand)
  {
--- 556,561 ----
*************** expr_invariant_in_loop_p (struct loop *l
*** 1453,1481 ****
  
    return true;
  }
- 
- /* Returns true if statement STMT is obviously invariant in LOOP,
-    i.e. if all its operands on the RHS are defined outside of the LOOP.
-    LOOP should not be the function body.  */
- 
- bool
- stmt_invariant_in_loop_p (struct loop *loop, gimple stmt)
- {
-   unsigned i;
-   tree lhs;
- 
-   gcc_assert (loop_depth (loop) > 0);
- 
-   lhs = gimple_get_lhs (stmt);
-   for (i = 0; i < gimple_num_ops (stmt); i++)
-     {
-       tree op = gimple_op (stmt, i);
-       if (op != lhs && !expr_invariant_in_loop_p (loop, op))
- 	return false;
-     }
- 
-   return true;
- }
  
  /* Cumulates the steps of indices into DATA and replaces their values with the
     initial ones.  Returns false when the value of the index cannot be determined.
--- 1449,1454 ----
Index: tree-ssa-loop-ivopts.h
===================================================================
*** tree-ssa-loop-ivopts.h	(revision 0)
--- tree-ssa-loop-ivopts.h	(working copy)
***************
*** 0 ****
--- 1,36 ----
+ /* Header file for Induction variable optimizations.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_IVOPTS_H
+ #define GCC_TREE_SSA_LOOP_IVOPTS_H
+ 
+ extern edge single_dom_exit (struct loop *);
+ extern void dump_iv (FILE *, struct iv *);
+ extern void dump_use (FILE *, struct iv_use *);
+ extern void dump_uses (FILE *, struct ivopts_data *);
+ extern void dump_cand (FILE *, struct iv_cand *);
+ extern bool contains_abnormal_ssa_name_p (tree);
+ extern struct loop *outermost_invariant_loop_for_expr (struct loop *, tree);
+ extern bool expr_invariant_in_loop_p (struct loop *, tree);
+ bool may_be_nonaddressable_p (tree expr);
+ bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
+ 				      addr_space_t);
+ void tree_ssa_iv_optimize (void);
+ 
+ #endif /* GCC_TREE_SSA_LOOP_IVOPTS_H */
Index: tree-ssa-loop-manip.h
===================================================================
*** tree-ssa-loop-manip.h	(revision 0)
--- tree-ssa-loop-manip.h	(working copy)
***************
*** 0 ****
--- 1,49 ----
+ /* Header file for High-level loop manipulation functions.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_MANIP_H
+ #define GCC_TREE_SSA_LOOP_MANIP_H
+ 
+ typedef void (*transform_callback)(struct loop *, void *);
+ 
+ extern void create_iv (tree, tree, tree, struct loop *, gimple_stmt_iterator *,
+ 		       bool, tree *, tree *);
+ extern void rewrite_into_loop_closed_ssa (bitmap, unsigned);
+ extern void verify_loop_closed_ssa (bool);
+ extern basic_block split_loop_exit_edge (edge);
+ extern basic_block ip_end_pos (struct loop *);
+ extern basic_block ip_normal_pos (struct loop *);
+ extern void standard_iv_increment_position (struct loop *,
+ 					    gimple_stmt_iterator *, bool *);
+ extern bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
+ 						  unsigned int, sbitmap,
+ 						  edge, vec<edge> *,
+ 						  int);
+ extern bool can_unroll_loop_p (struct loop *loop, unsigned factor,
+ 			       struct tree_niter_desc *niter);
+ extern void tree_transform_and_unroll_loop (struct loop *, unsigned,
+ 					    edge, struct tree_niter_desc *,
+ 					    transform_callback, void *);
+ extern void tree_unroll_loop (struct loop *, unsigned,
+ 			      edge, struct tree_niter_desc *);
+ extern tree canonicalize_loop_ivs (struct loop *, tree *, bool);
+ 
+ 
+ 
+ #endif /* GCC_TREE_SSA_LOOP_MANIP_H */
Index: tree-ssa-loop-niter.c
===================================================================
*** tree-ssa-loop-niter.c	(revision 203128)
--- tree-ssa-loop-niter.c	(working copy)
*************** gcov_type_to_double_int (gcov_type val)
*** 3027,3033 ****
  
  /* Compare double ints, callback for qsort.  */
  
! int
  double_int_cmp (const void *p1, const void *p2)
  {
    const double_int *d1 = (const double_int *)p1;
--- 3027,3033 ----
  
  /* Compare double ints, callback for qsort.  */
  
! static int
  double_int_cmp (const void *p1, const void *p2)
  {
    const double_int *d1 = (const double_int *)p1;
*************** double_int_cmp (const void *p1, const vo
*** 3042,3048 ****
  /* Return index of BOUND in BOUNDS array sorted in increasing order.
     Lookup by binary search.  */
  
! int
  bound_index (vec<double_int> bounds, double_int bound)
  {
    unsigned int end = bounds.length ();
--- 3042,3048 ----
  /* Return index of BOUND in BOUNDS array sorted in increasing order.
     Lookup by binary search.  */
  
! static int
  bound_index (vec<double_int> bounds, double_int bound)
  {
    unsigned int end = bounds.length ();
*************** maybe_lower_iteration_bound (struct loop
*** 3349,3355 ****
  /* Records estimates on numbers of iterations of LOOP.  If USE_UNDEFINED_P
     is true also use estimates derived from undefined behavior.  */
  
! void
  estimate_numbers_of_iterations_loop (struct loop *loop)
  {
    vec<edge> exits;
--- 3349,3355 ----
  /* Records estimates on numbers of iterations of LOOP.  If USE_UNDEFINED_P
     is true also use estimates derived from undefined behavior.  */
  
! static void
  estimate_numbers_of_iterations_loop (struct loop *loop)
  {
    vec<edge> exits;
Index: tree-ssa-loop-niter.h
===================================================================
*** tree-ssa-loop-niter.h	(revision 0)
--- tree-ssa-loop-niter.h	(working copy)
***************
*** 0 ****
--- 1,49 ----
+ /* Header file for loop interation estimates.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_NITER_H
+ #define GCC_TREE_SSA_LOOP_NITER_H
+ 
+ extern tree expand_simple_operations (tree);
+ extern bool loop_only_exit_p (const struct loop *, const_edge);
+ extern bool number_of_iterations_exit (struct loop *, edge,
+ 				       struct tree_niter_desc *niter, bool,
+ 				       bool every_iteration = true);
+ extern tree find_loop_niter (struct loop *, edge *);
+ extern bool finite_loop_p (struct loop *);
+ extern tree loop_niter_by_eval (struct loop *, edge);
+ extern tree find_loop_niter_by_eval (struct loop *, edge *);
+ extern void record_niter_bound (struct loop *, double_int, bool, bool);
+ extern bool estimated_loop_iterations (struct loop *, double_int *);
+ extern bool max_loop_iterations (struct loop *, double_int *);
+ extern HOST_WIDE_INT estimated_loop_iterations_int (struct loop *);
+ extern HOST_WIDE_INT max_loop_iterations_int (struct loop *);
+ extern HOST_WIDE_INT max_stmt_executions_int (struct loop *);
+ extern HOST_WIDE_INT estimated_stmt_executions_int (struct loop *);
+ extern bool max_stmt_executions (struct loop *, double_int *);
+ extern bool estimated_stmt_executions (struct loop *, double_int *);
+ extern void estimate_numbers_of_iterations (void);
+ extern bool stmt_dominates_stmt_p (gimple, gimple);
+ extern bool nowrap_type_p (tree);
+ extern bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool);
+ extern void free_numbers_of_iterations_estimates_loop (struct loop *);
+ extern void free_numbers_of_iterations_estimates (void);
+ extern void substitute_in_loop_info (struct loop *, tree, tree);
+ 
+ #endif /* GCC_TREE_SSA_LOOP_NITER_H */
Index: tree-ssa-loop-prefetch.h
===================================================================
*** tree-ssa-loop-prefetch.h	(revision 0)
--- tree-ssa-loop-prefetch.h	(working copy)
***************
*** 0 ****
--- 1,25 ----
+ /* Header file for Array Prefetching.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_PREFETCH_H
+ #define GCC_TREE_SSA_LOOP_PREFETCH_H
+ 
+ extern unsigned int tree_ssa_prefetch_arrays (void);
+ 
+ #endif /* GCC_TREE_SSA_LOOP_PREFETCH_H */
Index: tree-ssa-loop-unswitch.h
===================================================================
*** tree-ssa-loop-unswitch.h	(revision 0)
--- tree-ssa-loop-unswitch.h	(working copy)
***************
*** 0 ****
--- 1,25 ----
+ /* Header file for loop unswitching.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_LOOP_UNSWITCH_H
+ #define GCC_TREE_SSA_LOOP_UNSWITCH_H
+ 
+ unsigned int tree_ssa_unswitch_loops (void);
+ 
+ #endif /* GCC_TREE_SSA_LOOP_UNSWITCH_H */
Index: tree-ssa-loop.c
===================================================================
*** tree-ssa-loop.c	(revision 203128)
--- tree-ssa-loop.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 32,37 ****
--- 32,39 ----
  #include "tree-scalar-evolution.h"
  #include "diagnostic-core.h"
  #include "tree-vectorizer.h"
+ #include "tree-ssa-loop-prefetch.h"
+ #include "tree-ssa-loop-unswitch.h"
  
  /* The loop superpass.  */
  
Index: loop-iv.c
===================================================================
*** loop-iv.c	(revision 203128)
--- loop-iv.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 62,67 ****
--- 62,68 ----
  #include "df.h"
  #include "hash-table.h"
  #include "dumpfile.h"
+ #include "tree-ssa-loop-niter.h"
  
  /* Possible return values of iv_get_reaching_def.  */
  
Index: loop-unroll.c
===================================================================
*** loop-unroll.c	(revision 203128)
--- loop-unroll.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 32,37 ****
--- 32,38 ----
  #include "recog.h"
  #include "target.h"
  #include "dumpfile.h"
+ #include "tree-ssa-loop-niter.h"
  
  /* This pass performs loop unrolling and peeling.  We only perform these
     optimizations on innermost loops (with single exception) because
Index: loop-unswitch.c
===================================================================
*** loop-unswitch.c	(revision 203128)
--- loop-unswitch.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 29,34 ****
--- 29,35 ----
  #include "params.h"
  #include "expr.h"
  #include "dumpfile.h"
+ #include "tree-ssa-loop-niter.h"
  
  /* This pass moves constant conditions out of loops, duplicating the loop
     in progress, i.e. this code:
