https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112906

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alex Coplan <acop...@gcc.gnu.org>:

https://gcc.gnu.org/g:bac33a522bb51e30729191e935f25c2b0a63e225

commit r14-6582-gbac33a522bb51e30729191e935f25c2b0a63e225
Author: Alex Coplan <alex.cop...@arm.com>
Date:   Fri Dec 15 09:31:28 2023 +0000

    emit-rtl, lra: Move lra's emit_inc to emit-rtl.cc

    In PR112906 we ICE because we try to use force_reg to reload an
    auto-increment address, but force_reg can't do this.

    With the aim of fixing the PR by supporting reloading arbitrary
    addresses in pre-RA splitters, this patch generalizes
    lra-constraints.cc:emit_inc and makes it available to the rest of the
    compiler by moving the generalized version to emit-rtl.cc.

    We observe that the separate IN parameter to LRA's emit_inc is
    redundant, since the function is static and is only (statically) called
    once in lra-constraints.cc, with in == value.  As such, we drop the IN
    parameter and simplify the code accordingly.

    We wrap the emit_inc code in a virtual class to allow LRA to override
    how reload pseudos are created, thereby preserving the existing LRA
    behaviour as much as possible.

    We then add a second (higher-level) routine to emit-rtl.cc,
    force_reload_address, which can reload arbitrary addresses.  This uses
    the generalized emit_inc code to handle the RTX_AUTOINC case.  The
    second patch in this series uses force_reload_address to fix PR112906.

    Since we intend to call address_reload_context::emit_autoinc from within
    splitters, and the code lifted from LRA calls recog, we have to avoid
    clobbering recog_data.  We do this by introducing a new RAII class for
    saving/restoring recog_data on the stack.

    gcc/ChangeLog:

            PR target/112906
            * emit-rtl.cc (address_reload_context::emit_autoinc): New.
            (force_reload_address): New.
            * emit-rtl.h (struct address_reload_context): Declare.
            (force_reload_address): Declare.
            * lra-constraints.cc (class lra_autoinc_reload_context): New.
            (emit_inc): Drop IN parameter, invoke
            code moved to emit-rtl.cc:address_reload_context::emit_autoinc.
            (curr_insn_transform): Drop redundant IN parameter in call to
            emit_inc.
            * recog.h (class recog_data_saver): New.

Reply via email to