This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Loop IV info patch 3
- To: gcc-patches at gcc dot gnu dot org
- Subject: Loop IV info patch 3
- From: Michael Hayes <mhayes at redhat dot com>
- Date: Sun, 31 Dec 2000 21:04:52 +1300 (NZDT)
This patch removes some more clutter from strength_reduce.
2000-12-28 Michael Hayes <mhayes@redhat.com>
* loop.c (loop_ivs_free): New function.
(strength_reduce): Break out from...
*** loop-9.c Thu Dec 28 16:00:13 2000
--- loop.c Thu Dec 28 16:00:33 2000
*************** static void loop_givs_dead_check PARAMS(
*** 197,202 ****
--- 197,203 ----
static void loop_givs_reduce PARAMS((struct loop *, struct iv_class *));
static void loop_givs_rescan PARAMS((struct loop *, struct iv_class *,
rtx *, rtx));
+ static void loop_ivs_free PARAMS((struct loop *));
static void strength_reduce PARAMS ((struct loop *, int, int));
static void find_single_use_in_loop PARAMS ((rtx, rtx, varray_type));
static int valid_initial_value_p PARAMS ((rtx, rtx, int, rtx));
*************** loop_giv_reduce_benefit (loop, bl, v, te
*** 4252,4257 ****
--- 4253,4292 ----
}
+ /* Free IV structures for LOOP. */
+
+ static void
+ loop_ivs_free (loop)
+ struct loop *loop;
+ {
+ struct loop_ivs *ivs = LOOP_IVS (loop);
+ struct iv_class *iv = ivs->list;
+
+ free (ivs->regs);
+
+ while (iv)
+ {
+ struct iv_class *next = iv->next;
+ struct induction *induction;
+ struct induction *next_induction;
+
+ for (induction = iv->biv; induction; induction = next_induction)
+ {
+ next_induction = induction->next_iv;
+ free (induction);
+ }
+ for (induction = iv->giv; induction; induction = next_induction)
+ {
+ next_induction = induction->next_iv;
+ free (induction);
+ }
+
+ free (iv);
+ iv = next;
+ }
+ }
+
+
/* Perform strength reduction and induction variable elimination.
Pseudo registers created during this function will be beyond the
*************** strength_reduce (loop, insn_count, flags
*** 4314,4320 ****
if (flags & LOOP_UNROLL)
unroll_loop (loop, insn_count, end_insert_before, 0);
! goto egress;
}
/* Determine how BIVS are initialised by looking through pre-header
--- 4349,4356 ----
if (flags & LOOP_UNROLL)
unroll_loop (loop, insn_count, end_insert_before, 0);
! loop_ivs_free (loop);
! return;
}
/* Determine how BIVS are initialised by looking through pre-header
*************** strength_reduce (loop, insn_count, flags
*** 4573,4603 ****
if (loop_dump_stream)
fprintf (loop_dump_stream, "\n");
! egress:
! free (ivs->regs);
! {
! struct iv_class *iv = ivs->list;
!
! while (iv) {
! struct iv_class *next = iv->next;
! struct induction *induction;
! struct induction *next_induction;
!
! for (induction = iv->biv; induction; induction = next_induction)
! {
! next_induction = induction->next_iv;
! free (induction);
! }
! for (induction = iv->giv; induction; induction = next_induction)
! {
! next_induction = induction->next_iv;
! free (induction);
! }
!
! free (iv);
! iv = next;
! }
! }
if (reg_map)
free (reg_map);
}
--- 4609,4615 ----
if (loop_dump_stream)
fprintf (loop_dump_stream, "\n");
! loop_ivs_free (loop);
if (reg_map)
free (reg_map);
}