aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-08-16 10:49:59 +0930
committerAlan Modra <amodra@gcc.gnu.org>2017-08-16 10:49:59 +0930
commitbce59dcb63e2a675a387ea3150f340b609552354 (patch)
tree09984e7216cfd35479100de77d8de4cc6edaedf1 /gcc
parent973d3f1905307988ba17a4f93d9a95518b91fe42 (diff)
downloadgcc-bce59dcb63e2a675a387ea3150f340b609552354.zip
gcc-bce59dcb63e2a675a387ea3150f340b609552354.tar.gz
gcc-bce59dcb63e2a675a387ea3150f340b609552354.tar.bz2
[RS6000] Merge rs6000_reg_live_or_pic_offset_p into save_reg_p
rs6000_reg_live_or_pic_offset_p is just save_reg_p with special handling for the pic register and eh_return. This merge also simplifies the eh_return handling. The intent of https://gcc.gnu.org/ml/gcc-patches/2010-09/msg01838.html was to say the PIC reg needed to be saved for eh_return, not all gprs. Of course, it doesn't hurt to say all gprs need to be saved for eh_return as that is what the target-independent code does by setting DF live, but it's unnecessary in the backend. * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Merge.. (save_reg_p): ..into this. Update all callers. (first_reg_to_save): Simplify. From-SVN: r251115
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rs6000/rs6000.c40
2 files changed, 17 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4e6720f..10ff39e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2017-08-16 Alan Modra <amodra@gmail.com>
+ * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Merge..
+ (save_reg_p): ..into this. Update all callers.
+ (first_reg_to_save): Simplify.
+
+2017-08-16 Alan Modra <amodra@gmail.com>
+
* config/rs6000/rs6000.c (rs6000_savres_strategy): Don't restore
fixed regs.
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 5510306..5e79933 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -24078,22 +24078,19 @@ rs6000_split_multireg_move (rtx dst, rtx src)
/* This page contains routines that are used to determine what the
function prologue and epilogue code will do and write them out. */
-static inline bool
-save_reg_p (int r)
-{
- return !call_used_regs[r] && df_regs_ever_live_p (r);
-}
-
-/* Determine whether the gp REG is really used. */
+/* Determine whether the REG is really used. */
static bool
-rs6000_reg_live_or_pic_offset_p (int reg)
+save_reg_p (int reg)
{
/* We need to mark the PIC offset register live for the same conditions
as it is set up, or otherwise it won't be saved before we clobber it. */
if (reg == RS6000_PIC_OFFSET_TABLE_REGNUM && !TARGET_SINGLE_PIC_BASE)
{
+ /* When calling eh_return, we must return true for all the cases
+ where conditional_register_usage marks the PIC offset reg
+ call used. */
if (TARGET_TOC && TARGET_MINIMAL_TOC
&& (crtl->calls_eh_return
|| df_regs_ever_live_p (reg)
@@ -24105,11 +24102,7 @@ rs6000_reg_live_or_pic_offset_p (int reg)
return true;
}
- /* If the function calls eh_return, claim used all the registers that would
- be checked for liveness otherwise. */
-
- return ((crtl->calls_eh_return || df_regs_ever_live_p (reg))
- && !call_used_regs[reg]);
+ return !call_used_regs[reg] && df_regs_ever_live_p (reg);
}
/* Return the first fixed-point register that is required to be
@@ -24125,13 +24118,6 @@ first_reg_to_save (void)
if (save_reg_p (first_reg))
break;
- if (first_reg > RS6000_PIC_OFFSET_TABLE_REGNUM
- && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
- || (DEFAULT_ABI == ABI_DARWIN && flag_pic)
- || (TARGET_TOC && TARGET_MINIMAL_TOC))
- && rs6000_reg_live_or_pic_offset_p (RS6000_PIC_OFFSET_TABLE_REGNUM))
- first_reg = RS6000_PIC_OFFSET_TABLE_REGNUM;
-
#if TARGET_MACHO
if (flag_pic
&& crtl->uses_pic_offset_table
@@ -26306,7 +26292,7 @@ rs6000_get_separate_components (void)
for (unsigned regno = info->first_gp_reg_save; regno < 32; regno++)
{
if (IN_RANGE (offset, -0x8000, 0x7fff)
- && rs6000_reg_live_or_pic_offset_p (regno))
+ && save_reg_p (regno))
bitmap_set_bit (components, regno);
offset += reg_size;
@@ -27047,7 +27033,7 @@ rs6000_emit_prologue (void)
int offset = info->gp_save_offset + frame_off;
for (int i = info->first_gp_reg_save; i < 32; i++)
{
- if (rs6000_reg_live_or_pic_offset_p (i)
+ if (save_reg_p (i)
&& !cfun->machine->gpr_is_wrapped_separately[i])
emit_frame_save (frame_reg_rtx, reg_mode, i, offset,
sp_off - frame_off);
@@ -28497,7 +28483,7 @@ rs6000_emit_epilogue (int sibcall)
int offset = info->gp_save_offset + frame_off;
for (i = info->first_gp_reg_save; i < 32; i++)
{
- if (rs6000_reg_live_or_pic_offset_p (i)
+ if (save_reg_p (i)
&& !cfun->machine->gpr_is_wrapped_separately[i])
{
rtx reg = gen_rtx_REG (reg_mode, i);
@@ -28540,13 +28526,9 @@ rs6000_emit_epilogue (int sibcall)
cfa_restores = add_crlr_cfa_restore (info, cfa_restores);
for (i = info->first_gp_reg_save; i < 32; i++)
- if (!restoring_GPRs_inline
- || using_load_multiple
- || rs6000_reg_live_or_pic_offset_p (i))
+ if (save_reg_p (i)
+ && !cfun->machine->gpr_is_wrapped_separately[i])
{
- if (cfun->machine->gpr_is_wrapped_separately[i])
- continue;
-
rtx reg = gen_rtx_REG (reg_mode, i);
cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores);
}