/* Loop optimization definitions for GNU C-Compiler
- Copyright (C) 1991 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1995 Free Software Foundation, Inc.
This file is part of GNU CC.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
/* Get the luid of an insn. Catch the error of trying to reference the LUID
of an insn added during loop, since these don't have LUIDs. */
even if further info is available.
Both this and the above can be zero. */
unsigned ignore : 1; /* 1 prohibits further processing of giv */
- unsigned always_computable : 1;/* 1 if this set occurs each iteration */
+ unsigned always_computable : 1;/* 1 if this value is computable every
+ iteration. */
+ unsigned always_executed : 1; /* 1 if this set occurs each iteration. */
+ unsigned maybe_multiple : 1; /* Only used for a biv and 1 if this biv
+ update may be done multiple times per
+ iteration. */
unsigned cant_derive : 1; /* For giv's, 1 if this giv cannot derive
another giv. This occurs in many cases
where a giv's lifetime spans an update to
unsigned maybe_dead : 1; /* 1 if this giv might be dead. In that case,
we won't use it to eliminate a biv, it
would probably lose. */
+ unsigned auto_inc_opt : 1; /* 1 if this giv had its increment output next
+ to it to try to form an auto-inc address. */
+ unsigned unrolled : 1; /* 1 if new register has been allocated in
+ unrolled loop. */
+ unsigned shared : 1;
int lifetime; /* Length of life of this giv */
int times_used; /* # times this giv is used. */
rtx derive_adjustment; /* If nonzero, is an adjustment to be
struct induction *same; /* If this giv has been combined with another
giv, this points to the base giv. The base
giv will have COMBINED_WITH non-zero. */
- int const_adjust; /* Used by loop unrolling, when an address giv
+ HOST_WIDE_INT const_adjust; /* Used by loop unrolling, when an address giv
is split, and a constant is eliminated from
the address, the -constant is stored here
for later use. */
+ struct induction *same_insn; /* If there are multiple identical givs in
+ the same insn, then all but one have this
+ field set, and they all point to the giv
+ that doesn't have this field set. */
};
/* A `struct iv_class' is created for each biv. */
rtx initial_value; /* Value of reg at loop start */
rtx initial_test; /* Test performed on BIV before loop */
struct iv_class *next; /* Links all class structures together */
- rtx init_insn; /* insn which intializes biv, 0 if none. */
+ rtx init_insn; /* insn which initializes biv, 0 if none. */
rtx init_set; /* SET of INIT_INSN, if any. */
unsigned incremented : 1; /* 1 if somewhere incremented/decremented */
unsigned eliminable : 1; /* 1 if plausible candidate for elimination. */
extern int *uid_loop_num;
extern int *loop_outer_loop;
extern rtx *loop_number_exit_labels;
-extern unsigned long loop_n_iterations;
+extern int *loop_number_exit_count;
+extern unsigned HOST_WIDE_INT loop_n_iterations;
extern int max_reg_before_loop;
extern FILE *loop_dump_stream;
/* Forward declarations for non-static functions declared in loop.c and
unroll.c. */
-int invariant_p ();
-rtx get_condition_for_loop ();
-void emit_iv_add_mult ();
-
-/* Variables declared in stmt.c but also needed in loop.c. */
-
-extern union tree_node **loop_number_first_block;
-extern union tree_node **loop_number_last_block;
-extern int *loop_number_block_level;
+int invariant_p PROTO((rtx));
+rtx get_condition_for_loop PROTO((rtx));
+void emit_iv_add_mult PROTO((rtx, rtx, rtx, rtx, rtx));
/* Forward declarations for non-static functions declared in stmt.c. */
-void find_loop_tree_blocks ();
-void unroll_block_trees ();
-
-void unroll_loop ();
-rtx biv_total_increment ();
-unsigned long loop_iterations ();
-rtx final_biv_value ();
-rtx final_giv_value ();
-void emit_unrolled_add ();
+void find_loop_tree_blocks PROTO((void));
+void unroll_block_trees PROTO((void));
+
+void unroll_loop PROTO((rtx, int, rtx, rtx, int));
+rtx biv_total_increment PROTO((struct iv_class *, rtx, rtx));
+unsigned HOST_WIDE_INT loop_iterations PROTO((rtx, rtx));
+rtx final_biv_value PROTO((struct iv_class *, rtx, rtx));
+rtx final_giv_value PROTO((struct induction *, rtx, rtx));
+void emit_unrolled_add PROTO((rtx, rtx, rtx));
+int back_branch_in_range_p PROTO((rtx, rtx, rtx));
+
+extern int *loop_unroll_factor;
+#ifdef HAIFA
+/* variables for interaction between unroll.c and loop.c, for
+ the insertion of branch-on-count instruction. */
+extern rtx *loop_start_value;
+#endif /* HAIFA */
+