From 3df28f006a7ceaf958a9ce9d100dd1e266e18f26 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 30 Sep 2019 16:21:03 +0000 Subject: [PATCH] Remove global call sets: postreload.c The "|= fixed_regs" in reload_combine isn't necessary, since the set is only used to determine which values have changed (rather than, for example, which registers are available for use). In reload_cse_move2add we can be accurate about which registers are still available. BLKmode indicates a continuation of the previous register, and since clobbers_reg_p handles multi-register values, it's enough to skip over BLKmode entries and just test the start register. 2019-09-30 Richard Sandiford gcc/ * postreload.c (reload_combine_recognize_pattern): Use crtl->abi when deciding whether a register is free for use after RA. (reload_combine): Remove unnecessary use of fixed_reg_set. (reload_cse_move2add): Use insn_callee_abi to get the ABI of the call insn target. Use reg_mode when testing whether a register is no longer available. From-SVN: r276328 --- gcc/ChangeLog | 9 +++++++++ gcc/postreload.c | 17 ++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df3a2f657af..208d32fe28c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-09-30 Richard Sandiford + + * postreload.c (reload_combine_recognize_pattern): Use crtl->abi + when deciding whether a register is free for use after RA. + (reload_combine): Remove unnecessary use of fixed_reg_set. + (reload_cse_move2add): Use insn_callee_abi to get the ABI of the + call insn target. Use reg_mode when testing whether a register + is no longer available. + 2019-09-30 Richard Sandiford * target.def (return_call_with_max_clobbers): Delete. diff --git a/gcc/postreload.c b/gcc/postreload.c index 467df7bb0b6..e66377e6cba 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -1136,7 +1136,8 @@ reload_combine_recognize_pattern (rtx_insn *insn) if (TEST_HARD_REG_BIT (reg_class_contents[INDEX_REG_CLASS], i) && reg_state[i].use_index == RELOAD_COMBINE_MAX_USES && reg_state[i].store_ruid <= reg_state[regno].use_ruid - && (call_used_or_fixed_reg_p (i) || df_regs_ever_live_p (i)) + && (crtl->abi->clobbers_full_reg_p (i) + || df_regs_ever_live_p (i)) && (!frame_pointer_needed || i != HARD_FRAME_POINTER_REGNUM) && !fixed_regs[i] && !global_regs[i] && hard_regno_nregs (i, GET_MODE (reg)) == 1 @@ -1332,9 +1333,6 @@ reload_combine (void) { rtx link; HARD_REG_SET used_regs = insn_callee_abi (insn).full_reg_clobbers (); - /* ??? This preserves traditional behavior; it might not be - needed. */ - used_regs |= fixed_reg_set; for (r = 0; r < FIRST_PSEUDO_REGISTER; r++) if (TEST_HARD_REG_BIT (used_regs, r)) @@ -2126,12 +2124,13 @@ reload_cse_move2add (rtx_insn *first) unknown values. */ if (CALL_P (insn)) { + function_abi callee_abi = insn_callee_abi (insn); for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) - { - if (call_used_or_fixed_reg_p (i)) - /* Reset the information about this register. */ - reg_mode[i] = VOIDmode; - } + if (reg_mode[i] != VOIDmode + && reg_mode[i] != BLKmode + && callee_abi.clobbers_reg_p (reg_mode[i], i)) + /* Reset the information about this register. */ + reg_mode[i] = VOIDmode; } } return changed; -- 2.30.2