On 08/29/14 12:07, David Malcolm wrote:


Yes: I made various mistakes in reorg.c and resource.c where I assumed
that a JUMP_LABEL(insn) was an insn, whereas the existing code is set up
to handle RETURN nodes.
Well, it would seem to me that reorg is being totally braindead in mixing and matching these two nodes. In particular whatever code is passing around a RETURN rtx into places that normally accept some kind of INSN would appear to be broken.


It eliminates all uses of JUMP_LABEL_AS_INSN from reorg.c, and indeed
after that there are only 6 uses in the tree (including config subdirs).
Good to some extent as I see JUMP_LABEL_AS_INSN as papering over bugs elsewhere, but this patch is also a step backwards as we're papering over a mess in reorg.c.



2014-08-29  David Malcolm  <dmalc...@redhat.com>

        PR bootstrap/62304

        * gcc/reorg.c (skip_consecutive_labels): Convert return type and
        param back from rtx_insn * to rtx.  Rename param from "label" to
        "label_or_return", reintroducing "label" as an rtx_insn * after
        we've ensured it's not a RETURN.
        (first_active_target_insn): Likewise for return type and param;
        add a checked cast to rtx_insn * once we've ensured "insn" is not
        a RETURN.
        (steal_delay_list_from_target): Convert param "pnew_thread" back
        from rtx_insn ** to rtx *.  Replace use of JUMP_LABEL_AS_INSN
        with JUMP_LABEL.
        (own_thread_p): Convert param "thread" back from an rtx_insn * to
        an rtx.  Introduce local rtx_insn * "thread_insn" with a checked
        cast once we've established we're not dealing with a RETURN,
        renaming subsequent uses of "thread" to "thread_insn".
        (fill_simple_delay_slots): Convert uses of JUMP_LABEL_AS_INSN back
        to JUMP_LABEL.
        (follow_jumps): Convert return type and param "label" from
        rtx_insn * back to rtx.  Move initialization of "value" to after
        the handling for ANY_RETURN_P, adding a checked cast there to
        rtx_insn *.  Convert local rtx_insn * "this_label" to an rtx and
        rename to "this_label_or_return", reintroducing "this_label" as
        an rtx_insn * once we've handled the case where it could be an
        ANY_RETURN_P.
        (fill_slots_from_thread): Rename param "thread" to
        "thread_or_return", converting from an rtx_insn * back to an rtx.
        Reintroduce name "thread" as an rtx_insn * local with a checked
        cast once we've handled the case of it being an ANY_RETURN_P.
        Convert local "new_thread" from an rtx_insn * back to an rtx.
        Add a checked cast when assigning to "trial" from "new_thread".
        Convert use of JUMP_LABEL_AS_INSN back to JUMP_LABEL.  Add a
        checked cast to rtx_insn * from "new_thread" when invoking
        get_label_before.
        (fill_eager_delay_slots): Convert locals "target_label",
        "insn_at_target" from rtx_insn * back to rtx.
        Convert uses of JUMP_LABEL_AS_INSN back to JUMP_LABEL.
        (relax_delay_slots): Convert locals "trial", "target_label" from
        rtx_insn * back to rtx.  Convert uses of JUMP_LABEL_AS_INSN back
        to JUMP_LABEL.  Add a checked cast to rtx_insn * on "trial" when
        invoking update_block.
        (dbr_schedule): Convert use of JUMP_LABEL_AS_INSN back to
        JUMP_LABEL; this removes all JUMP_LABEL_AS_INSN from reorg.c.

        * resource.h (mark_target_live_regs): Undo erroneous conversion
        of second param of r214693, converting it back from rtx_insn * to
        rtx, since it could be a RETURN.

        * resource.c (find_dead_or_set_registers): Similarly, convert
        param "jump_target" back from an rtx_insn ** to an rtx *, as we
        could be writing back a RETURN.  Rename local rtx_insn * "next" to
        "next_insn", and introduce "lab_or_return" as a local rtx,
        handling the case where JUMP_LABEL (this_jump_insn) is a RETURN.
        (mark_target_live_regs): Undo erroneous conversion
        of second param of r214693, converting it back from rtx_insn * to
        rtx, since it could be a RETURN.  Rename it from "target" to
        "target_maybe_return", reintroducing the name "target" as a local
        rtx_insn * with a checked cast, after we've handled the case of
        ANY_RETURN_P.
I'll OK as a means to restore the trunk to working order, but let's add a follow-up item to track down places where we're passing things like a RETURN rtx in places where we really are expecting insns.

jeff


Reply via email to