diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2017-03-03 18:00:50 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2017-03-03 18:00:50 +0100 |
commit | f325c4567336a2e5c9643e7adb3a152d22022d7d (patch) | |
tree | a4d76a99bfbb21fd99b0f4e3d342539aa4e15718 /gcc | |
parent | 945b6e16e23ede6f80ea67634b14e3fd07f51cce (diff) | |
download | gcc-f325c4567336a2e5c9643e7adb3a152d22022d7d.zip gcc-f325c4567336a2e5c9643e7adb3a152d22022d7d.tar.gz gcc-f325c4567336a2e5c9643e7adb3a152d22022d7d.tar.bz2 |
rs6000: Fix for -mwarn-cell-microcode (PR43763)
If using -mwarn-cell-microcode, rs6000_final_prescan_insn calls
get_insn_template to get the name of the machine instruction. But,
get_insn_template calls the output template if that is code, and that
then can modify recog_data (it is normal to change the operands, for
example).
This patch saves and restores recog_data around the call to
get_insn_template to fix the problems this causes.
PR target/43763
* config/rs6000/rs6000.c (rs6000_final_prescan_insn): Save and
restore recog_data (including the operand rtxes inside it) around
the call to get_insn_template.
From-SVN: r245880
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d78b3f4..79d2004 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-03-03 Segher Boesssenkool <segher@kernel.crashing.org> + + PR target/43763 + * config/rs6000/rs6000.c (rs6000_final_prescan_insn): Save and + restore recog_data (including the operand rtxes inside it) around + the call to get_insn_template. + 2017-03-03 Martin Sebor <msebor@redhat.com> PR tree-optimization/79699 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 25b10f1..fde7cc7 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -38848,7 +38848,12 @@ rs6000_final_prescan_insn (rtx_insn *insn, rtx *operand ATTRIBUTE_UNUSED, if (insn_code_number < 0) return; + /* get_insn_template can modify recog_data, so save and restore it. */ + struct recog_data_d recog_data_save = recog_data; + for (int i = 0; i < recog_data.n_operands; i++) + recog_data.operand[i] = copy_rtx (recog_data.operand[i]); temp = get_insn_template (insn_code_number, insn); + recog_data = recog_data_save; if (get_attr_cell_micro (insn) == CELL_MICRO_ALWAYS) warning_at (location, OPT_mwarn_cell_microcode, |