This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Use of single_set() in loop_regs_update()
- To: Jeffrey A Law <law at redhat dot com>
- Subject: Re: Use of single_set() in loop_regs_update()
- From: Richard Sandiford <rsandifo at redhat dot com>
- Date: Thu, 15 Mar 2001 16:21:14 +0000 (GMT)
- Cc: <gcc-patches at gcc dot gnu dot org>
On Wed, 14 Mar 2001, Jeffrey A Law wrote:
> Hmmm, I believe that loop_regs_update is supposed to be passed either an
> INSN or a SEQUENCE (with INSNs inside the SEQUENCE).
>
> Who is passing a raw SET to loop_regs_update?
All values passed to loop_regs_update() seem to come directly from
gen_sequence(). If the idea's to pass the insn instead, how about the
patch below? Bootstraps on i686 cygwin, make check-gcc shows no
regressions. record_base_value() gets called when expected.
Please install if OK.
Richard
2001-03-15 Richard Sandiford <rsandifo@redhat.com>
* loop.c (loop_regs_update): Expect an insn in all cases.
(loop_iv_add_mult_emit_before): Pass it the insn, not the pattern.
(loop_iv_add_mult_sink): Likewise.
(loop_iv_add_mult_hoist): Likewise.
Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.324
diff -c -p -d -r1.324 loop.c
*** loop.c 2001/02/25 00:08:01 1.324
--- loop.c 2001/03/15 14:08:54
*************** gen_add_mult (b, m, a, reg)
*** 6877,6890 ****
/* Update registers created in insn sequence SEQ. */
static void
! loop_regs_update (loop, seq)
const struct loop *loop ATTRIBUTE_UNUSED;
! rtx seq;
{
/* Update register info for alias analysis. */
! if (GET_CODE (seq) == SEQUENCE)
{
int i;
for (i = 0; i < XVECLEN (seq, 0); ++i)
{
--- 6877,6891 ----
/* Update registers created in insn sequence SEQ. */
static void
! loop_regs_update (loop, insn)
const struct loop *loop ATTRIBUTE_UNUSED;
! rtx insn;
{
/* Update register info for alias analysis. */
! if (GET_CODE (PATTERN (insn)) == SEQUENCE)
{
+ rtx seq = PATTERN (insn);
int i;
for (i = 0; i < XVECLEN (seq, 0); ++i)
{
*************** loop_regs_update (loop, seq)
*** 6895,6901 ****
}
else
{
! rtx set = single_set (seq);
if (set && GET_CODE (SET_DEST (set)) == REG)
record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
}
--- 6896,6902 ----
}
else
{
! rtx set = single_set (insn);
if (set && GET_CODE (SET_DEST (set)) == REG)
record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
}
*************** loop_iv_add_mult_emit_before (loop, b, m
*** 6914,6920 ****
basic_block before_bb;
rtx before_insn;
{
! rtx seq;
if (! before_insn)
{
--- 6915,6921 ----
basic_block before_bb;
rtx before_insn;
{
! rtx seq, insn;
if (! before_insn)
{
*************** loop_iv_add_mult_emit_before (loop, b, m
*** 6930,6940 ****
update_reg_last_use (b, before_insn);
update_reg_last_use (m, before_insn);
! loop_insn_emit_before (loop, before_bb, before_insn, seq);
/* It is possible that the expansion created lots of new registers.
Iterate over the sequence we just created and record them all. */
! loop_regs_update (loop, seq);
}
--- 6931,6941 ----
update_reg_last_use (b, before_insn);
update_reg_last_use (m, before_insn);
! insn = loop_insn_emit_before (loop, before_bb, before_insn, seq);
/* It is possible that the expansion created lots of new registers.
Iterate over the sequence we just created and record them all. */
! loop_regs_update (loop, insn);
}
*************** loop_iv_add_mult_sink (loop, b, m, a, re
*** 6948,6954 ****
rtx a; /* additive constant */
rtx reg; /* destination register */
{
! rtx seq;
/* Use copy_rtx to prevent unexpected sharing of these rtx. */
seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);
--- 6949,6955 ----
rtx a; /* additive constant */
rtx reg; /* destination register */
{
! rtx seq, insn;
/* Use copy_rtx to prevent unexpected sharing of these rtx. */
seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);
*************** loop_iv_add_mult_sink (loop, b, m, a, re
*** 6959,6969 ****
update_reg_last_use (b, loop->sink);
update_reg_last_use (m, loop->sink);
! loop_insn_sink (loop, seq);
/* It is possible that the expansion created lots of new registers.
Iterate over the sequence we just created and record them all. */
! loop_regs_update (loop, seq);
}
--- 6960,6970 ----
update_reg_last_use (b, loop->sink);
update_reg_last_use (m, loop->sink);
! insn = loop_insn_sink (loop, seq);
/* It is possible that the expansion created lots of new registers.
Iterate over the sequence we just created and record them all. */
! loop_regs_update (loop, insn);
}
*************** loop_iv_add_mult_hoist (loop, b, m, a, r
*** 6977,6992 ****
rtx a; /* additive constant */
rtx reg; /* destination register */
{
! rtx seq;
/* Use copy_rtx to prevent unexpected sharing of these rtx. */
seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);
! loop_insn_hoist (loop, seq);
/* It is possible that the expansion created lots of new registers.
Iterate over the sequence we just created and record them all. */
! loop_regs_update (loop, seq);
}
--- 6978,6993 ----
rtx a; /* additive constant */
rtx reg; /* destination register */
{
! rtx seq, insn;
/* Use copy_rtx to prevent unexpected sharing of these rtx. */
seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);
! insn = loop_insn_hoist (loop, seq);
/* It is possible that the expansion created lots of new registers.
Iterate over the sequence we just created and record them all. */
! loop_regs_update (loop, insn);
}