gcc.old: vax: PR port-vax/57646 patch provided by Kalvis Duckmanton [3/21]

Reduce expressions specifying an address of a 64 bit quantity to
a sequence of assignments to temporary variables; this allows virtual
registers to be inst antiated properly.
This commit is contained in:
rin 2023-10-07 11:57:56 +00:00
parent 7e3f0ee31d
commit 036a217363
1 changed files with 41 additions and 1 deletions

View File

@ -2049,6 +2049,46 @@ vax_mode_dependent_address_p (const_rtx x, addr_space_t as ATTRIBUTE_UNUSED)
return true;
}
static rtx
decompose_address_operand(rtx addr)
{
enum rtx_code code = GET_CODE (addr);
switch (code)
{
case CONST:
return decompose_address_operand (XEXP (addr, 0));
case PLUS:
case MULT:
{
rtx op0, op1;
rtx temp;
/*
* Generate a temporary register, assign the result of
* decomposing op0 to it, then generate an op code opping (PLUS
* or MULT) the result of decomposing op1 to it.
* Return the temporary register.
*/
temp = gen_reg_rtx (Pmode);
op0 = decompose_address_operand (XEXP (addr, 0));
op1 = decompose_address_operand (XEXP (addr, 1));
emit_move_insn (temp, op0);
if (code == PLUS)
temp = gen_rtx_PLUS (Pmode, temp, op1);
else if (code == MULT)
temp = gen_rtx_MULT (Pmode, temp, op1);
return temp;
}
break;
default:
break;
}
return addr;
}
static rtx
fixup_mathdi_operand (rtx x, machine_mode mode)
{
@ -2064,7 +2104,7 @@ fixup_mathdi_operand (rtx x, machine_mode mode)
addr = XEXP (XEXP (addr, 0), 0);
}
#endif
emit_move_insn (temp, addr);
emit_move_insn (temp, decompose_address_operand (addr));
if (offset)
temp = gen_rtx_PLUS (Pmode, temp, offset);
x = gen_rtx_MEM (DImode, temp);