aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-04-30 10:04:16 +0930
committerAlan Modra <amodra@gcc.gnu.org>2016-04-30 10:04:16 +0930
commit223de6dae11fe1d12c10511b79a33e977e1eeaba (patch)
tree7859a6585634ae7871b9850b757d702a3a7d0126 /gcc
parentfd1c95f7fb199ee3ab5dfe1c54a70df1b6fb6290 (diff)
downloadgcc-223de6dae11fe1d12c10511b79a33e977e1eeaba.zip
gcc-223de6dae11fe1d12c10511b79a33e977e1eeaba.tar.gz
gcc-223de6dae11fe1d12c10511b79a33e977e1eeaba.tar.bz2
[RS6000] PR69645, -ffixed-reg ignored
Treat -ffixed-reg as we do for global asm regs. PR target/69645 * config/rs6000/rs6000.c (fixed_reg_p): New function. (fixed_regs_p): Rename from global_regs_p. Call fixed_reg_p. Update all uses. From-SVN: r235670
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/rs6000/rs6000.c39
2 files changed, 35 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea7fe29..9f1ca04 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2016-04-30 Alan Modra <amodra@gmail.com>
+ PR target/69645
+ * config/rs6000/rs6000.c (fixed_reg_p): New function.
+ (fixed_regs_p): Rename from global_regs_p. Call fixed_reg_p.
+ Update all uses.
+
+2016-04-30 Alan Modra <amodra@gmail.com>
+
* config/rs6000/rs6000.c (rs6000_conditional_register_usage):
Remove redundant PIC_OFFSET_TABLE_REGNUM test. Replace with
flag_pic test for Darwin.
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 1d24aa7..2ca2c55 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -23230,17 +23230,34 @@ is_altivec_return_reg (rtx reg, void *xyes)
}
-/* Look for user-defined global regs in the range FIRST to LAST-1.
- We should not restore these, and so cannot use lmw or out-of-line
- restore functions if there are any. We also can't save them
- (well, emit frame notes for them), because frame unwinding during
- exception handling will restore saved registers. */
+/* Return whether REG is a global user reg or has been specifed by
+ -ffixed-REG. */
static bool
-global_regs_p (unsigned first, unsigned last)
+fixed_reg_p (int reg)
+{
+ /* Ignore fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] when the
+ backend sets it, overriding anything the user might have given. */
+ if (reg == RS6000_PIC_OFFSET_TABLE_REGNUM
+ && ((DEFAULT_ABI == ABI_V4 && flag_pic)
+ || (DEFAULT_ABI == ABI_DARWIN && flag_pic)
+ || (TARGET_TOC && TARGET_MINIMAL_TOC)))
+ return false;
+
+ return fixed_regs[reg];
+}
+
+/* Look for user-defined global regs or -ffixed-<reg> in the range
+ FIRST to LAST-1. We should not restore these, and so cannot use
+ lmw or out-of-line restore functions if there are any. We also
+ can't save them (well, emit frame notes for them), because frame
+ unwinding during exception handling will restore saved registers. */
+
+static bool
+fixed_regs_p (unsigned first, unsigned last)
{
while (first < last)
- if (global_regs[first++])
+ if (fixed_reg_p (first++))
return true;
return false;
}
@@ -23271,7 +23288,7 @@ rs6000_savres_strategy (rs6000_stack_t *info,
&& !TARGET_POWERPC64
&& !(TARGET_SPE_ABI && info->spe_64bit_regs_used)
&& info->first_gp_reg_save < 31
- && !global_regs_p (info->first_gp_reg_save, 32))
+ && !fixed_regs_p (info->first_gp_reg_save, 32))
strategy |= SAVRES_MULTIPLE;
if (crtl->calls_eh_return
@@ -23284,16 +23301,16 @@ rs6000_savres_strategy (rs6000_stack_t *info,
/* The out-of-line FP routines use double-precision stores;
we can't use those routines if we don't have such stores. */
|| (TARGET_HARD_FLOAT && !TARGET_DOUBLE_FLOAT)
- || global_regs_p (info->first_fp_reg_save, 64))
+ || fixed_regs_p (info->first_fp_reg_save, 64))
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
if (info->first_gp_reg_save == 32
|| (!(strategy & SAVRES_MULTIPLE)
- && global_regs_p (info->first_gp_reg_save, 32)))
+ && fixed_regs_p (info->first_gp_reg_save, 32)))
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
if (info->first_altivec_reg_save == LAST_ALTIVEC_REGNO + 1
- || global_regs_p (info->first_altivec_reg_save, LAST_ALTIVEC_REGNO + 1))
+ || fixed_regs_p (info->first_altivec_reg_save, LAST_ALTIVEC_REGNO + 1))
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
/* Define cutoff for using out-of-line functions to save registers. */