Module Name: src
Committed By: rin
Date: Sat Oct 7 12:02:23 UTC 2023
Modified Files:
src/external/gpl3/gcc.old/dist/gcc: reload.c
Log Message:
gcc.old: PR port-vax/57646 patch provided by Kalvis Duckmanton [9/21]
A reload for the address of an operand's address should not use the same
register as a reload of an operand's address if the two reloads are for
different operands
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.11 -r1.12 src/external/gpl3/gcc.old/dist/gcc/reload.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/reload.c
diff -u src/external/gpl3/gcc.old/dist/gcc/reload.c:1.11 src/external/gpl3/gcc.old/dist/gcc/reload.c:1.12
--- src/external/gpl3/gcc.old/dist/gcc/reload.c:1.11 Mon Feb 20 02:11:07 2023
+++ src/external/gpl3/gcc.old/dist/gcc/reload.c Sat Oct 7 12:02:23 2023
@@ -4529,6 +4529,50 @@ find_reloads (rtx_insn *insn, int replac
}
}
+#if NB_FIX_VAX_BACKEND
+ /*
+ * Scan the reloads again looking for a case where there is
+ * precisely one RELOAD_FOR_OPERAND_ADDRESS reload and one
+ * RELOAD_FOR_OPADDR_ADDR reload BUT they are for different
+ * operands. choose_reload_regs assumes that the
+ * RELOAD_FOR_OPADDR_ADDR and RELOAD_FOR_OPERAND_ADDRESS reloads are
+ * a pair operating on the same operand and will choose the same
+ * register for both, which is not what is wanted.
+ */
+ {
+ int n_operand_address_reloads = 0,
+ n_opaddr_addr_reloads = 0;
+ int reloadnum_for_operand_address_reload = -1,
+ reloadnum_for_opaddr_addr_reload = -1;
+
+ for (i = 0; i < n_reloads; i++)
+ {
+ switch (rld[i].when_needed)
+ {
+ case RELOAD_FOR_OPADDR_ADDR:
+ n_opaddr_addr_reloads++;
+ reloadnum_for_opaddr_addr_reload = i;
+ break;
+ case RELOAD_FOR_OPERAND_ADDRESS:
+ n_operand_address_reloads++;
+ reloadnum_for_operand_address_reload = i;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (n_operand_address_reloads == 1
+ && n_opaddr_addr_reloads == 1
+ && rld[reloadnum_for_opaddr_addr_reload].opnum
+ != rld[reloadnum_for_operand_address_reload].opnum)
+ {
+ rld[reloadnum_for_opaddr_addr_reload].when_needed
+ = RELOAD_FOR_OPERAND_ADDRESS;
+ }
+ }
+#endif
+
/* See if we have any reloads that are now allowed to be merged
because we've changed when the reload is needed to
RELOAD_FOR_OPERAND_ADDRESS or RELOAD_FOR_OTHER_ADDRESS. Only