This series of patches makes the rs6000 backend properly honour -ffixed-reg in that compiler generated code should never write them, even when restoring saved copies of registers.
Patch 1 and 2 are the bugfix. Patch 3 and 4 allow saving regs using stmw or out-of-line save functions, even when the range includes some global/-ffixed regs. Bootstrapped and regression tested powerpc64le-linux. OK for gcc-7? Alan Modra (4): [RS6000] Simplify setting of fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] [RS6000] PR69645, -ffixed-reg ignored [RS6000] Split SAVRES_STRATEGY [RS6000] Allow saving of fixed regs. gcc/config/rs6000/rs6000.c | 210 +++++++++++++++++++++++++-------------------- 1 file changed, 115 insertions(+), 95 deletions(-) -- Alan Modra Australia Development Lab, IBM