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.
This commit is contained in:
rin 2023-10-07 12:02:23 +00:00
parent 3325d1e00a
commit 5c422d1814
1 changed files with 44 additions and 0 deletions

View File

@ -4529,6 +4529,50 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
}
}
#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