This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [new-regalloc] tidy rest_of_compilation
- To: "Daniel Berlin" <dberlin at redhat dot com>,"Richard Henderson" <rth at redhat dot com>
- Subject: Re: [new-regalloc] tidy rest_of_compilation
- From: "Geert Bosch" <bosch at gnat dot com>
- Date: Fri, 02 Feb 2001 11:04:35 -0500
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Reply-To: "Geert Bosch" <bosch at gnat dot com>
Hi Daniel,
Unfortunately the latest changes to the new-regalloc.c cause my compiler
to blowup with a signal 6. I'm using a gcc-2.8.1 based compiler for
bootstrapping and never had any trouble with compiling the current GCC.
The patch below fixes this and it makes the code a tiny bit more
readable at the same time I think.
Index: new-regalloc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/new-regalloc.c,v
retrieving revision 1.1.2.11
diff -c -r1.1.2.11 new-regalloc.c
*** new-regalloc.c 2001/02/02 06:01:14 1.1.2.11
--- new-regalloc.c 2001/02/02 16:01:37
***************
*** 881,897 ****
rtx move;
{
rtx body = PATTERN (move);
enum reg_class lhs;
enum reg_class rhs;
if (HARD_REGISTER_NUM_P (REGNO (SET_DEST (body))))
lhs = REGNO_REG_CLASS (REGNO (SET_DEST (body)));
else
lhs = reg_preferred_class (REGNO (SET_DEST (body)));
if (HARD_REGISTER_NUM_P (REGNO (SET_SRC (body))))
rhs = REGNO_REG_CLASS (REGNO (SET_SRC (body)));
else
rhs = reg_preferred_class (REGNO (SET_SRC (body)));
! return (BLOCK_FOR_INSN (move)->loop_depth + 1)
* REGISTER_MOVE_COST (GET_MODE (SET_SRC (body)), rhs, lhs);
}
--- 881,901 ----
rtx move;
{
rtx body = PATTERN (move);
+ struct basic_block_def * bb = BLOCK_FOR_INSN (move);
enum reg_class lhs;
enum reg_class rhs;
+
if (HARD_REGISTER_NUM_P (REGNO (SET_DEST (body))))
lhs = REGNO_REG_CLASS (REGNO (SET_DEST (body)));
else
lhs = reg_preferred_class (REGNO (SET_DEST (body)));
+
if (HARD_REGISTER_NUM_P (REGNO (SET_SRC (body))))
rhs = REGNO_REG_CLASS (REGNO (SET_SRC (body)));
else
rhs = reg_preferred_class (REGNO (SET_SRC (body)));
!
! return (bb->loop_depth + 1)
* REGISTER_MOVE_COST (GET_MODE (SET_SRC (body)), rhs, lhs);
}