From: Alan Modra Date: Wed, 16 Aug 2017 01:19:59 +0000 (+0930) Subject: [RS6000] Merge rs6000_reg_live_or_pic_offset_p into save_reg_p X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bce59dcb63e2a675a387ea3150f340b609552354;p=gcc.git [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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e6720faf9d..10ff39e7fbc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-08-16 Alan Modra + + * 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 * config/rs6000/rs6000.c (rs6000_savres_strategy): Don't restore diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5510306efdf..5e79933855a 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); }