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

commit r15-4300-gf0f11559d569faffacea63db5c4a5ad98335c4ad
Author: Andreas Schwab <sch...@linux-m68k.org>
Date:   Fri Oct 11 10:28:38 2024 +0200

    m68k: replace reload_in_progress by reload_in_progress || lra_in_progress
    
    For now assume that LRA needs the same treatment as reload.
    
            * config/m68k/m68k.md ("movsi", "movxf"): Replace
            reload_in_progress by reload_in_progress || lra_in_progress.
            * config/m68k/m68k.cc (m68k_legitimate_mem_p)
            (emit_move_sequence): Likewise.
            * config/m68k/predicates.md ("fp_src_operand"): Likewise.

Diff:
---
 gcc/config/m68k/m68k.cc       | 21 ++++++++++++++-------
 gcc/config/m68k/m68k.md       |  9 +++++----
 gcc/config/m68k/predicates.md |  1 +
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/gcc/config/m68k/m68k.cc b/gcc/config/m68k/m68k.cc
index 7986e92c5116..729a1e8875d9 100644
--- a/gcc/config/m68k/m68k.cc
+++ b/gcc/config/m68k/m68k.cc
@@ -2352,7 +2352,8 @@ m68k_legitimate_mem_p (rtx x, struct m68k_address 
*address)
 {
   return (MEM_P (x)
          && m68k_decompose_address (GET_MODE (x), XEXP (x, 0),
-                                    reload_in_progress || reload_completed,
+                                    (reload_in_progress || lra_in_progress
+                                     || reload_completed),
                                     address));
 }
 
@@ -3899,11 +3900,13 @@ emit_move_sequence (rtx *operands, machine_mode mode, 
rtx scratch_reg)
   rtx tem;
 
   if (scratch_reg
-      && reload_in_progress && GET_CODE (operand0) == REG
+      && (reload_in_progress || lra_in_progress)
+      && GET_CODE (operand0) == REG
       && REGNO (operand0) >= FIRST_PSEUDO_REGISTER)
     operand0 = reg_equiv_mem (REGNO (operand0));
   else if (scratch_reg
-          && reload_in_progress && GET_CODE (operand0) == SUBREG
+          && (reload_in_progress || lra_in_progress)
+          && GET_CODE (operand0) == SUBREG
           && GET_CODE (SUBREG_REG (operand0)) == REG
           && REGNO (SUBREG_REG (operand0)) >= FIRST_PSEUDO_REGISTER)
     {
@@ -3916,11 +3919,13 @@ emit_move_sequence (rtx *operands, machine_mode mode, 
rtx scratch_reg)
     }
 
   if (scratch_reg
-      && reload_in_progress && GET_CODE (operand1) == REG
+      && (reload_in_progress || lra_in_progress)
+      && GET_CODE (operand1) == REG
       && REGNO (operand1) >= FIRST_PSEUDO_REGISTER)
     operand1 = reg_equiv_mem (REGNO (operand1));
   else if (scratch_reg
-          && reload_in_progress && GET_CODE (operand1) == SUBREG
+          && (reload_in_progress || lra_in_progress)
+          && GET_CODE (operand1) == SUBREG
           && GET_CODE (SUBREG_REG (operand1)) == REG
           && REGNO (SUBREG_REG (operand1)) >= FIRST_PSEUDO_REGISTER)
     {
@@ -3932,11 +3937,13 @@ emit_move_sequence (rtx *operands, machine_mode mode, 
rtx scratch_reg)
       operand1 = alter_subreg (&temp, true);
     }
 
-  if (scratch_reg && reload_in_progress && GET_CODE (operand0) == MEM
+  if (scratch_reg && (reload_in_progress || lra_in_progress)
+      && GET_CODE (operand0) == MEM
       && ((tem = find_replacement (&XEXP (operand0, 0)))
          != XEXP (operand0, 0)))
     operand0 = gen_rtx_MEM (GET_MODE (operand0), tem);
-  if (scratch_reg && reload_in_progress && GET_CODE (operand1) == MEM
+  if (scratch_reg && (reload_in_progress || lra_in_progress)
+      && GET_CODE (operand1) == MEM
       && ((tem = find_replacement (&XEXP (operand1, 0)))
          != XEXP (operand1, 0)))
     operand1 = gen_rtx_MEM (GET_MODE (operand1), tem);
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index e5c252888448..1c9a6bf1748c 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -957,11 +957,12 @@
       /* The source is an address which requires PIC relocation.
          Call legitimize_pic_address with the source, mode, and a relocation
          register (a new pseudo, or the final destination if reload_in_progress
-         is set).   Then fall through normally */
-      rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
+         or lra_in_progress is set).   Then fall through normally */
+      rtx temp = ((reload_in_progress || lra_in_progress)
+                 ? operands[0] : gen_reg_rtx (Pmode));
       operands[1] = legitimize_pic_address (operands[1], SImode, temp);
     }
-  else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
+  else if (flag_pic && TARGET_PCREL && ! (reload_in_progress || 
lra_in_progress))
     {
       /* Don't allow writes to memory except via a register;
         the m68k doesn't consider PC-relative addresses to be writable.  */
@@ -1452,7 +1453,7 @@
   ""
 {
   /* We can't rewrite operands during reload.  */
-  if (! reload_in_progress)
+  if (! (reload_in_progress || lra_in_progress))
     {
       if (CONSTANT_P (operands[1]))
        {
diff --git a/gcc/config/m68k/predicates.md b/gcc/config/m68k/predicates.md
index 46fc3795a178..787e544a43f5 100644
--- a/gcc/config/m68k/predicates.md
+++ b/gcc/config/m68k/predicates.md
@@ -237,6 +237,7 @@
          || (TARGET_68881
              && (!standard_68881_constant_p (op)
                  || reload_in_progress
+                 || lra_in_progress
                  || reload_completed)));
 })

Reply via email to