OSDN Git Service

PR c++/15815
[pf3gnuchains/gcc-fork.git] / gcc / cfgloop.h
index 58184b5..d73c99b 100644 (file)
@@ -1,5 +1,5 @@
 /* Natural loop functions
-   Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -19,6 +19,13 @@ along with GCC; see the file COPYING.  If not, write to the Free
 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
+#ifndef GCC_CFGLOOP_H
+#define GCC_CFGLOOP_H
+
+#include "basic-block.h"
+/* For rtx_code.  */
+#include "rtl.h"
+
 /* Structure to hold decision about unrolling/peeling.  */
 enum lpt_dec
 {
@@ -36,29 +43,6 @@ struct lpt_decision
   unsigned times;
 };
 
-/* Description of loop for simple loop unrolling.  */
-struct loop_desc
-{
-  int postincr;                /* 1 if increment/decrement is done after loop exit condition.  */
-  rtx stride;          /* Value added to VAR in each iteration.  */
-  rtx var;             /* Loop control variable.  */
-  enum machine_mode inner_mode;
-                       /* The mode from that it is extended.  */
-  enum rtx_code extend;        /* With this extend.  */
-  rtx var_alts;                /* List of definitions of its initial value.  */
-  rtx lim;             /* Expression var is compared with.  */
-  rtx lim_alts;                /* List of definitions of its initial value.  */
-  bool const_iter;      /* True if it iterates constant number of times.  */
-  unsigned HOST_WIDE_INT niter;
-                       /* Number of iterations if it is constant.  */
-  bool may_be_zero;     /* If we cannot determine that the first iteration will pass.  */
-  enum rtx_code cond;  /* Exit condition.  */
-  int neg;             /* Set to 1 if loop ends when condition is satisfied.  */
-  edge out_edge;       /* The exit edge.  */
-  edge in_edge;                /* And the other one.  */
-  int n_branches;      /* Number of branches inside the loop.  */
-};
-
 /* Structure to hold information for each natural loop.  */
 struct loop
 {
@@ -77,11 +61,6 @@ struct loop
   /* For loop unrolling/peeling decision.  */
   struct lpt_decision lpt_decision;
 
-  /* Simple loop description.  */
-  int simple;
-  struct loop_desc desc;
-  int has_desc;
-
   /* Number of loop insns.  */
   unsigned ninsns;
 
@@ -265,6 +244,7 @@ extern void flow_loop_dump (const struct loop *, FILE *,
 extern int flow_loop_scan (struct loop *, int);
 extern void flow_loop_free (struct loop *);
 void mark_irreducible_loops (struct loops *);
+extern void create_loop_notes (void);
 
 /* Loop data structure manipulation/querying.  */
 extern void flow_loop_tree_node_add (struct loop *, struct loop *);
@@ -275,6 +255,7 @@ extern bool flow_bb_inside_loop_p (const struct loop *, const basic_block);
 extern struct loop * find_common_loop (struct loop *, struct loop *);
 extern int num_loop_insns (struct loop *);
 extern int average_num_loop_insns (struct loop *);
+extern unsigned get_loop_level (const struct loop *);
 
 /* Loops & cfg manipulation.  */
 extern basic_block *get_loop_body (const struct loop *);
@@ -305,8 +286,6 @@ extern void force_single_succ_latches (struct loops *);
 extern void verify_loop_structure (struct loops *);
 
 /* Loop analysis.  */
-extern bool simple_loop_p (struct loop *, struct loop_desc *);
-extern rtx count_loop_iterations (struct loop_desc *, rtx, rtx);
 extern bool just_once_each_iteration_p (struct loop *, basic_block);
 extern unsigned expected_loop_iterations (const struct loop *);
 
@@ -370,8 +349,8 @@ struct rtx_iv
   unsigned first_special : 1;
 };
 
-/* This should replace struct loop_desc.  We keep this just so that we are
-   able to compare the results.  */
+/* The description of an exit from the loop and of the number of iterations
+   till we take the exit.  */
 
 struct niter_desc
 {
@@ -416,7 +395,7 @@ struct niter_desc
 
 extern void iv_analysis_loop_init (struct loop *);
 extern rtx iv_get_reaching_def (rtx, rtx);
-extern bool iv_analyse (rtx, rtx, struct rtx_iv *);
+extern bool iv_analyze (rtx, rtx, struct rtx_iv *);
 extern rtx get_iv_value (struct rtx_iv *, rtx);
 extern void find_simple_exit (struct loop *, struct niter_desc *);
 extern void iv_number_of_iterations (struct loop *, rtx, rtx,
@@ -432,6 +411,11 @@ simple_loop_desc (struct loop *loop)
   return loop->aux;
 }
 
+/* Register pressure estimation for induction variable optimizations & loop
+   invariant motion.  */
+extern unsigned global_cost_for_size (unsigned, unsigned, unsigned);
+extern void init_set_costs (void);
+
 /* Loop optimizer initialization.  */
 extern struct loops *loop_optimizer_init (FILE *);
 extern void loop_optimizer_finalize (struct loops *, FILE *);
@@ -447,3 +431,7 @@ enum
 };
 
 extern void unroll_and_peel_loops (struct loops *, int);
+extern void doloop_optimize_loops (struct loops *);
+extern void move_loop_invariants (struct loops *);
+
+#endif /* GCC_CFGLOOP_H */