Module Name: src
Committed By: rin
Date: Sat Oct 7 12:00:36 UTC 2023
Modified Files:
src/external/gpl3/gcc.old/dist/gcc: function.c
Log Message:
gcc.old: PR port-vax/57646 patch provided by Kalvis Duckmanton [6/21]
load the address operand of a SUBREG into a register to allow virtual
registers to be instantiated
XXXRO: Hidden within ``#ifdef NB_FIX_VAX_BACKEND'' and enabled only for
vax at the moment.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/gpl3/gcc.old/dist/gcc/function.c
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.old/dist/gcc/function.c
diff -u src/external/gpl3/gcc.old/dist/gcc/function.c:1.15 src/external/gpl3/gcc.old/dist/gcc/function.c:1.16
--- src/external/gpl3/gcc.old/dist/gcc/function.c:1.15 Fri Jul 14 19:46:26 2023
+++ src/external/gpl3/gcc.old/dist/gcc/function.c Sat Oct 7 12:00:35 2023
@@ -1720,6 +1720,27 @@ instantiate_virtual_regs_in_insn (rtx_in
break;
case SUBREG:
+#ifdef NB_FIX_VAX_BACKEND
+ 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));
+ }
+#endif
new_rtx = instantiate_new_reg (SUBREG_REG (x), &offset);
if (new_rtx == NULL)
continue;
@@ -1822,6 +1843,15 @@ instantiate_decl_rtl (rtx x)
return;
}
+#ifdef NB_FIX_VAX_BACKEND
+ /* If this is a SUBREG, recurse for the pieces */
+ if (GET_CODE (x) == SUBREG)
+ {
+ instantiate_decl_rtl (XEXP (x, 0));
+ return;
+ }
+#endif
+
/* 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))