This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: reload1.c:eliminate_regs_in_insn bugfix
- To: rth at cygnus dot com (Richard Henderson)
- Subject: Re: reload1.c:eliminate_regs_in_insn bugfix
- From: Joern Rennecke <amylaar at redhat dot com>
- Date: Mon, 6 Nov 2000 20:51:59 +0000 (GMT)
- Cc: amylaar at redhat dot com (Joern Rennecke), gcc-patches at gcc dot gnu dot org, amylaar at cygnus dot co dot uk
> > I thought I stick with this convention. Or should we fix all the places
> > where there is such a usage?
>
> I think we should fix them.
Some cases I first though were bogus (in the gen* files) were actually
printing proper code. But two places still need a fix:
Mon Nov 6 20:44:51 2000 J"orn Rennecke <amylaar@redhat.com>
* combine.c (recog_for_combine): Allocate uninitialized vector with
rtvec_alloc.
* recog.c (apply_change_group): Likewise.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.160
diff -p -r1.160 combine.c
*** combine.c 2000/11/02 22:02:21 1.160
--- combine.c 2000/11/06 20:44:44
*************** recog_for_combine (pnewpat, insn, pnotes
*** 9680,9689 ****
if (num_clobbers_to_add)
{
rtx newpat = gen_rtx_PARALLEL (VOIDmode,
! gen_rtvec (GET_CODE (pat) == PARALLEL
! ? (XVECLEN (pat, 0)
! + num_clobbers_to_add)
! : num_clobbers_to_add + 1));
if (GET_CODE (pat) == PARALLEL)
for (i = 0; i < XVECLEN (pat, 0); i++)
--- 9680,9689 ----
if (num_clobbers_to_add)
{
rtx newpat = gen_rtx_PARALLEL (VOIDmode,
! rtvec_alloc (GET_CODE (pat) == PARALLEL
! ? (XVECLEN (pat, 0)
! + num_clobbers_to_add)
! : num_clobbers_to_add + 1));
if (GET_CODE (pat) == PARALLEL)
for (i = 0; i < XVECLEN (pat, 0); i++)
Index: recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.82
diff -p -r1.82 recog.c
*** recog.c 2000/10/31 10:06:49 1.82
--- recog.c 2000/11/06 20:44:44
*************** apply_change_group ()
*** 334,340 ****
newpat
= gen_rtx_PARALLEL (VOIDmode,
! gen_rtvec (XVECLEN (pat, 0) - 1));
for (j = 0; j < XVECLEN (newpat, 0); j++)
XVECEXP (newpat, 0, j) = XVECEXP (pat, 0, j);
}
--- 334,340 ----
newpat
= gen_rtx_PARALLEL (VOIDmode,
! rtvec_alloc (XVECLEN (pat, 0) - 1));
for (j = 0; j < XVECLEN (newpat, 0); j++)
XVECEXP (newpat, 0, j) = XVECEXP (pat, 0, j);
}
> Good. In that case, consider a revised patch using
> rtvec_alloc and not constrain_operands pre-approved.
Checked in:
Mon Nov 6 20:08:13 2000 J"orn Rennecke <amylaar@redhat.com>
* reload1.c (eliminate_regs_in_insn): Allow a set to be a PARALLEL
with (clobber (match_scratch...)).
Index: reload1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/reload1.c,v
retrieving revision 1.277
diff -p -r1.277 reload1.c
*** reload1.c 2000/10/16 22:11:01 1.277
--- reload1.c 2000/11/03 22:11:50
*************** eliminate_regs_in_insn (insn, replace)
*** 2945,2957 ****
if (offset == 0)
{
! /* We assume here that we don't need a PARALLEL of
! any CLOBBERs for this assignment. There's not
! much we can do if we do need it. */
PATTERN (insn) = gen_rtx_SET (VOIDmode,
SET_DEST (old_set),
ep->to_rtx);
! INSN_CODE (insn) = recog (PATTERN (insn), insn, 0);
if (INSN_CODE (insn) < 0)
abort ();
}
--- 2946,2969 ----
if (offset == 0)
{
! int num_clobbers;
! /* We assume here that if we need a PARALLEL with
! CLOBBERs for this assignment, we can do with the
! MATCH_SCRATCHes that add_clobbers allocates.
! There's not much we can do if that doesn't work. */
PATTERN (insn) = gen_rtx_SET (VOIDmode,
SET_DEST (old_set),
ep->to_rtx);
! num_clobbers = 0;
! INSN_CODE (insn) = recog (PATTERN (insn), insn, &num_clobbers);
! if (num_clobbers)
! {
! rtvec vec = rtvec_alloc (num_clobbers + 1);
!
! vec->elem[0] = PATTERN (insn);
! PATTERN (insn) = gen_rtx_PARALLEL (VOIDmode, vec);
! add_clobbers (PATTERN (insn), INSN_CODE (insn));
! }
if (INSN_CODE (insn) < 0)
abort ();
}