RISC-V: Handle non-legitimate address in riscv_legitimize_move

GCC may generate non-legitimate address due to we allow some
load/store with non-legitimate address in pic.md.

gcc/ChangeLog

2017-11-03  Kito Cheng  <kito.cheng@gmail.com>

        * config/riscv/riscv.c (riscv_legitimize_move): Handle
        non-legitimate address.

From-SVN: r254376
This commit is contained in:
Kito Cheng 2017-11-03 14:59:39 +00:00 committed by Palmer Dabbelt
parent 91afdf4c79
commit 13e4f305e0
2 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2017-11-03 Kito Cheng <kito.cheng@gmail.com>
* config/riscv/riscv.c (riscv_legitimize_move): Handle
non-legitimate address.
2017-11-03 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (*lt0_disi): Delete.

View file

@ -1332,6 +1332,22 @@ riscv_legitimize_move (machine_mode mode, rtx dest, rtx src)
return true;
}
/* RISC-V GCC may generate non-legitimate address due to we provide some
pattern for optimize access PIC local symbol and it's make GCC generate
unrecognizable instruction during optmizing. */
if (MEM_P (dest) && !riscv_legitimate_address_p (mode, XEXP (dest, 0),
reload_completed))
{
XEXP (dest, 0) = riscv_force_address (XEXP (dest, 0), mode);
}
if (MEM_P (src) && !riscv_legitimate_address_p (mode, XEXP (src, 0),
reload_completed))
{
XEXP (src, 0) = riscv_force_address (XEXP (src, 0), mode);
}
return false;
}