Fix RISCV ICE on linux kernel build.

gcc/
	Backport from mainline
	2017-11-03  Kito Cheng  <kito.cheng@gmail.com>

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

From-SVN: r255181
This commit is contained in:
Jim Wilson 2017-11-27 22:33:29 +00:00 committed by Jim Wilson
parent 37c3433979
commit 247da19e84
2 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2017-11-27 Jim Wilson <jimw@sifive.com>
Backport from mainline
2017-11-03 Kito Cheng <kito.cheng@gmail.com>
* config/riscv/riscv.c (riscv_legitimize_move): Handle
non-legitimate address.
2017-11-24 Segher Boessenkool <segher@kernel.crashing.org>
Backport from mainline

View File

@ -1377,6 +1377,22 @@ riscv_legitimize_move (enum 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;
}