/* Loop optimization definitions for GNU C-Compiler
- Copyright (C) 1991, 1995, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1995, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC 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 2, or (at your option)
-any later version.
+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 2, or (at your option) any later
+version.
-GNU CC 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.
+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 GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+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. */
#include "bitmap.h"
+#include "sbitmap.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
/* Flags passed to loop_optimize. */
#define LOOP_UNROLL 1
#define LOOP_BCT 2
+#define LOOP_PREFETCH 4
/* Get the loop info pointer of a loop. */
#define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux)
/* Get a pointer to the loop movables structure. */
-#define LOOP_MOVABLES(LOOP) (&LOOP_INFO (loop)->movables)
+#define LOOP_MOVABLES(LOOP) (&LOOP_INFO (LOOP)->movables)
/* Get a pointer to the loop registers structure. */
-#define LOOP_REGS(LOOP) (&LOOP_INFO (loop)->regs)
+#define LOOP_REGS(LOOP) (&LOOP_INFO (LOOP)->regs)
/* Get a pointer to the loop induction variables structure. */
-#define LOOP_IVS(LOOP) (&LOOP_INFO (loop)->ivs)
+#define LOOP_IVS(LOOP) (&LOOP_INFO (LOOP)->ivs)
/* 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. */
/* For a biv, this is the place where add_val
was found. */
enum machine_mode mode; /* The mode of this biv or giv */
- enum machine_mode mem_mode; /* For DEST_ADDR, mode of the memory object. */
+ rtx mem; /* For DEST_ADDR, the memory object. */
rtx mult_val; /* Multiplicative factor for src_reg. */
rtx add_val; /* Additive constant for that product. */
int benefit; /* Gain from eliminating this insn. */
subtracted from add_val when this giv
derives another. This occurs when the
giv spans a biv update by incrementation. */
- rtx ext_dependant; /* If nonzero, is a sign or zero extension
- if a biv on which this giv is dependant. */
+ rtx ext_dependent; /* If nonzero, is a sign or zero extension
+ if a biv on which this giv is dependent. */
struct induction *next_iv; /* For givs, links together all givs that are
based on the same biv. For bivs, links
together all biv entries that refer to the
unsigned reversed : 1; /* 1 if we reversed the loop that this
biv controls. */
unsigned all_reduced : 1; /* 1 if all givs using this biv have
- been reduced. */
+ been reduced. */
};
struct movable *head;
/* Last movable in chain. */
struct movable *last;
- /* Number of movables in the loop. */
- int num;
};
unroll.c. */
int loop_invariant_p PARAMS ((const struct loop *, rtx));
rtx get_condition_for_loop PARAMS ((const struct loop *, rtx));
-void emit_iv_add_mult PARAMS ((rtx, rtx, rtx, rtx, rtx));
+void loop_iv_add_mult_hoist PARAMS ((const struct loop *, rtx, rtx, rtx, rtx));
+void loop_iv_add_mult_sink PARAMS ((const struct loop *, rtx, rtx, rtx, rtx));
+void loop_iv_add_mult_emit_before PARAMS ((const struct loop *, rtx,
+ rtx, rtx, rtx,
+ basic_block, rtx));
rtx express_from PARAMS ((struct induction *, struct induction *));
rtx extend_value_for_giv PARAMS ((struct induction *, rtx));
-void unroll_loop PARAMS ((struct loop *, int, rtx, int));
-rtx biv_total_increment PARAMS ((struct iv_class *));
+void unroll_loop PARAMS ((struct loop *, int, int));
+rtx biv_total_increment PARAMS ((const struct iv_class *));
unsigned HOST_WIDE_INT loop_iterations PARAMS ((struct loop *));
int precondition_loop_p PARAMS ((const struct loop *,
rtx *, rtx *, rtx *,
int loop_insn_first_p PARAMS ((rtx, rtx));
typedef rtx (*loop_insn_callback) PARAMS ((struct loop *, rtx, int, int));
void for_each_insn_in_loop PARAMS ((struct loop *, loop_insn_callback));
+rtx loop_insn_emit_before PARAMS((const struct loop *, basic_block,
+ rtx, rtx));
+rtx loop_insn_sink PARAMS((const struct loop *, rtx));
+rtx loop_insn_hoist PARAMS((const struct loop *, rtx));
/* Forward declarations for non-static functions declared in doloop.c. */
int doloop_optimize PARAMS ((const struct loop *));