Module Name:    src
Committed By:   kalvisd
Date:           Sun Sep 29 07:52:04 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/gcc: function.cc

Log Message:
gcc: vax: instantiate virtual registers in SUBREGs' address operands

    Load the address operand of a SUBREG into a register to allow virtual
    registers to be instantiated

    OK rin@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/function.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/function.cc
diff -u src/external/gpl3/gcc/dist/gcc/function.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/function.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/function.cc:1.1.1.1	Sun Jul 30 05:20:52 2023
+++ src/external/gpl3/gcc/dist/gcc/function.cc	Sun Sep 29 07:52:04 2024
@@ -1724,6 +1724,25 @@ instantiate_virtual_regs_in_insn (rtx_in
 	  break;
 
 	case SUBREG:
+	  if (MEM_P (XEXP (x, 0)))
+	    {
+	      /* convert a subreg of a MEMORY operand into a
+		 register operand */
+	      rtx mx = XEXP (x, 0); /* memory operand */
+	      rtx addr = XEXP (mx, 0);
+	      instantiate_virtual_regs_in_rtx (&addr);
+	      start_sequence ();
+	      mx = replace_equiv_address (mx, addr, true);
+	      addr = force_reg (GET_MODE (addr), addr);
+	      mx = replace_equiv_address (mx, addr, true);
+	      seq = get_insns ();
+	      end_sequence ();
+	      if (seq)
+		emit_insn_before (seq, insn);
+              /* generate a new subreg expression */
+	      x = gen_rtx_SUBREG (GET_MODE (x), mx, SUBREG_BYTE (x));
+	    }
+
 	  new_rtx = instantiate_new_reg (SUBREG_REG (x), &offset);
 	  if (new_rtx == NULL)
 	    continue;
@@ -1830,6 +1849,13 @@ instantiate_decl_rtl (rtx x)
       return;
     }
 
+  /* If this is a SUBREG, recurse for the pieces */
+  if (GET_CODE (x) == SUBREG)
+    {
+      instantiate_decl_rtl (XEXP (x, 0));
+      return;
+    }
+
   /* If this is not a MEM, no need to do anything.  Similarly if the
      address is a constant or a register that is not a virtual register.  */
   if (!MEM_P (x))

Reply via email to