[new-regalloc] tidy rest_of_compilation
Daniel Berlin
dberlin@redhat.com
Fri Feb 2 10:39:00 GMT 2001
On Fri, 2 Feb 2001, Geert Bosch wrote:
> 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);
> }
>
>
These two are equivalent code, if one works, and the other doesn't,
something else is wrong.
Most likely compute_bb_for_insn info isn't up to date.
--Dan
More information about the Gcc-patches
mailing list