This patch replaces the rtx_insn argument to
targetm.hard_regno_call_part_clobbered with an ABI identifier, since
call insns are now just one possible way of getting an ABI handle.
This in turn allows predefined_function_abi::initialize to do the
right thing for non-default ABIs.

The horrible ?: in need_for_call_save_p goes away in a later patch,
with the series as a whole removing most direct calls to the hook in
favour of function_abi operations.


2019-09-11  Richard Sandiford  <richard.sandif...@arm.com>

gcc/
        * target.def (hard_regno_call_part_clobbered): Take an ABI
        identifier instead of an rtx_insn.
        * doc/tm.texi: Regenerate.
        * hooks.h (hook_bool_insn_uint_mode_false): Delete.
        (hook_bool_uint_uint_mode_false): New function.
        * hooks.c (hook_bool_insn_uint_mode_false): Delete.
        (hook_bool_uint_uint_mode_false): New function.
        * config/aarch64/aarch64.c (aarch64_hard_regno_call_part_clobbered):
        Take an ABI identifier instead of an rtx_insn.
        * config/avr/avr.c (avr_hard_regno_call_part_clobbered): Likewise.
        * config/i386/i386.c (ix86_hard_regno_call_part_clobbered): Likewise.
        * config/mips/mips.c (mips_hard_regno_call_part_clobbered): Likewise.
        * config/pru/pru.c (pru_hard_regno_call_part_clobbered): Likewise.
        * config/rs6000/rs6000.c (rs6000_hard_regno_call_part_clobbered):
        Likewise.
        * config/s390/s390.c (s390_hard_regno_call_part_clobbered): Likewise.
        * cselib.c: Include function-abi.h.
        (cselib_process_insn): Update call to
        targetm.hard_regno_call_part_clobbered, using call_insn_abi
        to get the appropriate ABI identifier.
        * function-abi.cc (predefined_function_abi::initialize): Update call
        to targetm.hard_regno_call_part_clobbered.
        * ira-conflicts.c (ira_build_conflicts): Likewise.
        * ira-costs.c (ira_tune_allocno_costs): Likewise.
        * lra-constraints.c: Include function-abi.h.
        (need_for_call_save_p): Update call to
        targetm.hard_regno_call_part_clobbered, using call_insn_abi
        to get the appropriate ABI identifier.
        * lra-lives.c (check_pseudos_live_through_calls): Likewise.
        * regcprop.c (copyprop_hardreg_forward_1): Update call
        to targetm.hard_regno_call_part_clobbered.
        * reginfo.c (choose_hard_reg_mode): Likewise.
        * regrename.c (check_new_reg_p): Likewise.
        * reload.c (find_equiv_reg): Likewise.
        * reload1.c (emit_reload_insns): Likewise.
        * sched-deps.c: Include function-abi.h.
        (deps_analyze_insn): Update call to
        targetm.hard_regno_call_part_clobbered, using call_insn_abi
        to get the appropriate ABI identifier.
        * sel-sched.c (init_regs_for_mode, mark_unavailable_hard_regs): Update
        call to targetm.hard_regno_call_part_clobbered.
        * targhooks.c (default_dwarf_frame_reg_mode): Likewise.

Index: gcc/target.def
===================================================================
--- gcc/target.def      2019-09-11 19:47:24.422262645 +0100
+++ gcc/target.def      2019-09-11 19:47:32.906202859 +0100
@@ -5763,18 +5763,27 @@ The default version of this hook always
 
 DEFHOOK
 (hard_regno_call_part_clobbered,
- "This hook should return true if @var{regno} is partly call-saved and\n\
-partly call-clobbered, and if a value of mode @var{mode} would be partly\n\
-clobbered by call instruction @var{insn}.  If @var{insn} is NULL then it\n\
-should return true if any call could partly clobber the register.\n\
-For example, if the low 32 bits of @var{regno} are preserved across a call\n\
-but higher bits are clobbered, this hook should return true for a 64-bit\n\
-mode but false for a 32-bit mode.\n\
+ "ABIs usually specify that calls must preserve the full contents\n\
+of a particular register, or that calls can alter any part of a\n\
+particular register.  This information is captured by the target macro\n\
+@code{CALL_REALLY_USED_REGISTERS}.  However, some ABIs specify that calls\n\
+must preserve certain bits of a particular register but can alter others.\n\
+This hook should return true if this applies to at least one of the\n\
+registers in @samp{(reg:@var{mode} @var{regno})}, and if as a result the\n\
+call would alter part of the @var{mode} value.  For example, if a call\n\
+preserves the low 32 bits of a 64-bit hard register @var{regno} but can\n\
+clobber the upper 32 bits, this hook should return true for a 64-bit mode\n\
+but false for a 32-bit mode.\n\
+\n\
+The value of @var{abi_id} comes from the @code{predefined_function_abi}\n\
+structure that describes the ABI of the call; see the definition of the\n\
+structure for more details.  If (as is usual) the target uses the same ABI\n\
+for all functions in a translation unit, @var{abi_id} is always 0.\n\
 \n\
 The default implementation returns false, which is correct\n\
 for targets that don't have partly call-clobbered registers.",
- bool, (rtx_insn *insn, unsigned int regno, machine_mode mode),
- hook_bool_insn_uint_mode_false)
+ bool, (unsigned int abi_id, unsigned int regno, machine_mode mode),
+ hook_bool_uint_uint_mode_false)
 
 DEFHOOK
 (return_call_with_max_clobbers,
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi     2019-09-11 19:47:24.414262702 +0100
+++ gcc/doc/tm.texi     2019-09-11 19:47:32.898202916 +0100
@@ -1919,14 +1919,23 @@ interoperability between several ABIs in
 @cindex call-used register
 @cindex call-clobbered register
 @cindex call-saved register
-@deftypefn {Target Hook} bool TARGET_HARD_REGNO_CALL_PART_CLOBBERED (rtx_insn 
*@var{insn}, unsigned int @var{regno}, machine_mode @var{mode})
-This hook should return true if @var{regno} is partly call-saved and
-partly call-clobbered, and if a value of mode @var{mode} would be partly
-clobbered by call instruction @var{insn}.  If @var{insn} is NULL then it
-should return true if any call could partly clobber the register.
-For example, if the low 32 bits of @var{regno} are preserved across a call
-but higher bits are clobbered, this hook should return true for a 64-bit
-mode but false for a 32-bit mode.
+@deftypefn {Target Hook} bool TARGET_HARD_REGNO_CALL_PART_CLOBBERED (unsigned 
int @var{abi_id}, unsigned int @var{regno}, machine_mode @var{mode})
+ABIs usually specify that calls must preserve the full contents
+of a particular register, or that calls can alter any part of a
+particular register.  This information is captured by the target macro
+@code{CALL_REALLY_USED_REGISTERS}.  However, some ABIs specify that calls
+must preserve certain bits of a particular register but can alter others.
+This hook should return true if this applies to at least one of the
+registers in @samp{(reg:@var{mode} @var{regno})}, and if as a result the
+call would alter part of the @var{mode} value.  For example, if a call
+preserves the low 32 bits of a 64-bit hard register @var{regno} but can
+clobber the upper 32 bits, this hook should return true for a 64-bit mode
+but false for a 32-bit mode.
+
+The value of @var{abi_id} comes from the @code{predefined_function_abi}
+structure that describes the ABI of the call; see the definition of the
+structure for more details.  If (as is usual) the target uses the same ABI
+for all functions in a translation unit, @var{abi_id} is always 0.
 
 The default implementation returns false, which is correct
 for targets that don't have partly call-clobbered registers.
Index: gcc/hooks.h
===================================================================
--- gcc/hooks.h 2019-09-05 08:49:25.869775043 +0100
+++ gcc/hooks.h 2019-09-11 19:47:32.898202916 +0100
@@ -40,7 +40,7 @@ extern bool hook_bool_const_rtx_insn_con
 extern bool hook_bool_mode_uhwi_false (machine_mode,
                                       unsigned HOST_WIDE_INT);
 extern bool hook_bool_puint64_puint64_true (poly_uint64, poly_uint64);
-extern bool hook_bool_insn_uint_mode_false (rtx_insn *, unsigned int,
+extern bool hook_bool_uint_uint_mode_false (unsigned int, unsigned int,
                                            machine_mode);
 extern bool hook_bool_uint_mode_true (unsigned int, machine_mode);
 extern bool hook_bool_tree_false (tree);
Index: gcc/hooks.c
===================================================================
--- gcc/hooks.c 2019-09-05 08:49:25.869775043 +0100
+++ gcc/hooks.c 2019-09-11 19:47:32.898202916 +0100
@@ -140,9 +140,8 @@ hook_bool_puint64_puint64_true (poly_uin
   return true;
 }
 
-/* Generic hook that takes (unsigned int, machine_mode) and returns false.  */
 bool
-hook_bool_insn_uint_mode_false (rtx_insn *, unsigned int, machine_mode)
+hook_bool_uint_uint_mode_false (unsigned int, unsigned int, machine_mode)
 {
   return false;
 }
Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c        2019-09-11 19:47:24.410262730 +0100
+++ gcc/config/aarch64/aarch64.c        2019-09-11 19:47:32.858203198 +0100
@@ -1910,12 +1910,13 @@ aarch64_call_insn_abi (const rtx_insn *i
    clobbers the top 64 bits when restoring the bottom 64 bits.  */
 
 static bool
-aarch64_hard_regno_call_part_clobbered (rtx_insn *insn, unsigned int regno,
+aarch64_hard_regno_call_part_clobbered (unsigned int abi_id,
+                                       unsigned int regno,
                                        machine_mode mode)
 {
   if (FP_REGNUM_P (regno))
     {
-      bool simd_p = insn && CALL_P (insn) && aarch64_simd_call_p (insn);
+      bool simd_p = (abi_id == ARM_PCS_SIMD);
       poly_int64 per_register_size = GET_MODE_SIZE (mode);
       unsigned int nregs = hard_regno_nregs (regno, mode);
       if (nregs > 1)
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c        2019-09-10 19:56:45.329178088 +0100
+++ gcc/config/avr/avr.c        2019-09-11 19:47:32.862203170 +0100
@@ -12164,8 +12164,8 @@ avr_hard_regno_mode_ok (unsigned int reg
 /* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  */
 
 static bool
-avr_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
-                                   unsigned regno, machine_mode mode)
+avr_hard_regno_call_part_clobbered (unsigned, unsigned regno,
+                                   machine_mode mode)
 {
   /* FIXME: This hook gets called with MODE:REGNO combinations that don't
         represent valid hard registers like, e.g. HI:29.  Returning TRUE
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c      2019-09-11 19:47:28.506233865 +0100
+++ gcc/config/i386/i386.c      2019-09-11 19:47:32.866203141 +0100
@@ -18794,8 +18794,8 @@ ix86_hard_regno_mode_ok (unsigned int re
    the low 16 bytes are saved.  */
 
 static bool
-ix86_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
-                                    unsigned int regno, machine_mode mode)
+ix86_hard_regno_call_part_clobbered (unsigned int, unsigned int regno,
+                                    machine_mode mode)
 {
   return SSE_REGNO_P (regno) && GET_MODE_SIZE (mode) > 16;
 }
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c      2019-09-10 19:57:04.697041394 +0100
+++ gcc/config/mips/mips.c      2019-09-11 19:47:32.874203085 +0100
@@ -12928,8 +12928,8 @@ mips_hard_regno_scratch_ok (unsigned int
    registers with MODE > 64 bits are part clobbered too.  */
 
 static bool
-mips_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
-                                    unsigned int regno, machine_mode mode)
+mips_hard_regno_call_part_clobbered (unsigned int, unsigned int regno,
+                                    machine_mode mode)
 {
   if (TARGET_FLOATXX
       && hard_regno_nregs (regno, mode) == 1
Index: gcc/config/pru/pru.c
===================================================================
--- gcc/config/pru/pru.c        2019-09-10 19:56:45.345177975 +0100
+++ gcc/config/pru/pru.c        2019-09-11 19:47:32.886203000 +0100
@@ -559,8 +559,8 @@ pru_hard_regno_scratch_ok (unsigned int
 /* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  */
 
 static bool
-pru_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
-                                   unsigned regno, machine_mode mode)
+pru_hard_regno_call_part_clobbered (unsigned, unsigned regno,
+                                   machine_mode mode)
 {
   HARD_REG_SET caller_saved_set;
   HARD_REG_SET callee_saved_set;
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  2019-09-10 19:57:04.701041365 +0100
+++ gcc/config/rs6000/rs6000.c  2019-09-11 19:47:32.890202972 +0100
@@ -1936,8 +1936,8 @@ rs6000_modes_tieable_p (machine_mode mod
 /* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  */
 
 static bool
-rs6000_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
-                                      unsigned int regno, machine_mode mode)
+rs6000_hard_regno_call_part_clobbered (unsigned int, unsigned int regno,
+                                      machine_mode mode)
 {
   if (TARGET_32BIT
       && TARGET_POWERPC64
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c      2019-09-10 19:57:04.705041337 +0100
+++ gcc/config/s390/s390.c      2019-09-11 19:47:32.894202944 +0100
@@ -10297,8 +10297,8 @@ s390_hard_regno_scratch_ok (unsigned int
    bytes are saved across calls, however.  */
 
 static bool
-s390_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
-                                    unsigned int regno, machine_mode mode)
+s390_hard_regno_call_part_clobbered (unsigned int, unsigned int regno,
+                                    machine_mode mode)
 {
   if (!TARGET_64BIT
       && TARGET_ZARCH
Index: gcc/cselib.c
===================================================================
--- gcc/cselib.c        2019-09-10 19:56:45.353177919 +0100
+++ gcc/cselib.c        2019-09-11 19:47:32.894202944 +0100
@@ -32,6 +32,7 @@ Software Foundation; either version 3, o
 #include "dumpfile.h"
 #include "cselib.h"
 #include "params.h"
+#include "function-abi.h"
 
 /* A list of cselib_val structures.  */
 struct elt_list
@@ -2765,11 +2766,12 @@ cselib_process_insn (rtx_insn *insn)
      memory.  */
   if (CALL_P (insn))
     {
+      function_abi abi = call_insn_abi (insn);
       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
        if (call_used_or_fixed_reg_p (i)
            || (REG_VALUES (i) && REG_VALUES (i)->elt
                && (targetm.hard_regno_call_part_clobbered
-                   (insn, i, GET_MODE (REG_VALUES (i)->elt->val_rtx)))))
+                   (abi.id (), i, GET_MODE (REG_VALUES (i)->elt->val_rtx)))))
          cselib_invalidate_regno (i, reg_raw_mode[i]);
 
       /* Since it is not clear how cselib is going to be used, be
Index: gcc/function-abi.cc
===================================================================
--- gcc/function-abi.cc 2019-09-11 19:47:24.414262702 +0100
+++ gcc/function-abi.cc 2019-09-11 19:47:32.898202916 +0100
@@ -50,7 +50,7 @@ predefined_function_abi::initialize (uns
 
      If the ABI specifies that part of a hard register R is call-clobbered,
      we should be able to find a single-register mode M for which
-     targetm.hard_regno_call_part_clobbered (NULL, R, M) is true.
+     targetm.hard_regno_call_part_clobbered (m_id, R, M) is true.
      In other words, it shouldn't be the case that R can hold all
      single-register modes across a call, but can't hold part of
      a multi-register mode.
@@ -66,7 +66,7 @@ predefined_function_abi::initialize (uns
       for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
        if (targetm.hard_regno_mode_ok (regno, mode)
            && hard_regno_nregs (regno, mode) == 1
-           && targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+           && targetm.hard_regno_call_part_clobbered (m_id, regno, mode))
          SET_HARD_REG_BIT (m_full_and_partial_reg_clobbers, regno);
     }
 
@@ -89,7 +89,7 @@ predefined_function_abi::initialize (uns
       for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
        if (targetm.hard_regno_mode_ok (regno, mode)
            && !overlaps_hard_reg_set_p (m_full_reg_clobbers, mode, regno)
-           && !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+           && !targetm.hard_regno_call_part_clobbered (m_id, regno, mode))
          remove_from_hard_reg_set (&m_mode_clobbers[i], mode, regno);
     }
 
@@ -104,7 +104,7 @@ predefined_function_abi::initialize (uns
        for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
          if (targetm.hard_regno_mode_ok (regno, mode)
              && !overlaps_hard_reg_set_p (m_full_reg_clobbers, mode, regno)
-             && targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+             && targetm.hard_regno_call_part_clobbered (m_id, regno, mode))
            gcc_assert (overlaps_hard_reg_set_p (all_clobbers, mode, regno)
                        && overlaps_hard_reg_set_p (m_mode_clobbers[i],
                                                    mode, regno));
Index: gcc/ira-conflicts.c
===================================================================
--- gcc/ira-conflicts.c 2019-09-10 19:56:32.569268148 +0100
+++ gcc/ira-conflicts.c 2019-09-11 19:47:32.898202916 +0100
@@ -806,7 +806,7 @@ ira_build_conflicts (void)
                 regs must conflict with them.  */
              for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
                if (!TEST_HARD_REG_BIT (call_used_or_fixed_regs, regno)
-                   && targetm.hard_regno_call_part_clobbered (NULL, regno,
+                   && targetm.hard_regno_call_part_clobbered (0, regno,
                                                               obj_mode))
                  {
                    SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
Index: gcc/ira-costs.c
===================================================================
--- gcc/ira-costs.c     2019-09-10 19:56:32.569268148 +0100
+++ gcc/ira-costs.c     2019-09-11 19:47:32.898202916 +0100
@@ -2381,7 +2381,7 @@ ira_tune_allocno_costs (void)
                                                   *crossed_calls_clobber_regs)
                  && (ira_hard_reg_set_intersection_p (regno, mode,
                                                       call_used_or_fixed_regs)
-                     || targetm.hard_regno_call_part_clobbered (NULL, regno,
+                     || targetm.hard_regno_call_part_clobbered (0, regno,
                                                                 mode)))
                cost += (ALLOCNO_CALL_FREQ (a)
                         * (ira_memory_move_cost[mode][rclass][0]
Index: gcc/lra-constraints.c
===================================================================
--- gcc/lra-constraints.c       2019-09-10 19:56:32.573268120 +0100
+++ gcc/lra-constraints.c       2019-09-11 19:47:32.898202916 +0100
@@ -131,6 +131,7 @@
 #include "lra.h"
 #include "lra-int.h"
 #include "print-rtl.h"
+#include "function-abi.h"
 
 /* Value of LRA_CURR_RELOAD_NUM at the beginning of BB of the current
    insn.  Remember that LRA_CURR_RELOAD_NUM is the number of emitted
@@ -5442,7 +5443,8 @@ need_for_call_save_p (int regno)
               : call_used_or_fixed_regs,
               PSEUDO_REGNO_MODE (regno), reg_renumber[regno])
              || (targetm.hard_regno_call_part_clobbered
-                 (lra_reg_info[regno].call_insn,
+                 (lra_reg_info[regno].call_insn
+                  ? call_insn_abi (lra_reg_info[regno].call_insn).id () : 0,
                   reg_renumber[regno], PSEUDO_REGNO_MODE (regno)))));
 }
 
Index: gcc/lra-lives.c
===================================================================
--- gcc/lra-lives.c     2019-09-11 19:47:24.418262673 +0100
+++ gcc/lra-lives.c     2019-09-11 19:47:32.898202916 +0100
@@ -594,7 +594,7 @@ check_pseudos_live_through_calls (int re
   if (! sparseset_bit_p (pseudos_live_through_calls, regno))
     return;
 
-  gcc_assert (call_insn && CALL_P (call_insn));
+  function_abi abi = call_insn_abi (call_insn);
   old_call_insn = lra_reg_info[regno].call_insn;
   if (!old_call_insn
       || (targetm.return_call_with_max_clobbers
@@ -606,7 +606,7 @@ check_pseudos_live_through_calls (int re
   lra_reg_info[regno].conflict_hard_regs |= last_call_used_reg_set;
 
   for (hr = 0; HARD_REGISTER_NUM_P (hr); hr++)
-    if (targetm.hard_regno_call_part_clobbered (call_insn, hr,
+    if (targetm.hard_regno_call_part_clobbered (abi.id (), hr,
                                                PSEUDO_REGNO_MODE (regno)))
       add_to_hard_reg_set (&lra_reg_info[regno].conflict_hard_regs,
                           PSEUDO_REGNO_MODE (regno), hr);
Index: gcc/regcprop.c
===================================================================
--- gcc/regcprop.c      2019-09-11 19:47:24.418262673 +0100
+++ gcc/regcprop.c      2019-09-11 19:47:32.898202916 +0100
@@ -1057,7 +1057,7 @@ copyprop_hardreg_forward_1 (basic_block
          for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
            if ((abi.clobbers_full_reg_p (regno)
                 || (targetm.hard_regno_call_part_clobbered
-                    (insn, regno, vd->e[regno].mode)))
+                    (abi.id (), regno, vd->e[regno].mode)))
                && (regno < set_regno || regno >= set_regno + set_nregs))
              kill_value_regno (regno, 1, vd);
 
Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c       2019-09-11 19:47:07.490381964 +0100
+++ gcc/reginfo.c       2019-09-11 19:47:32.898202916 +0100
@@ -568,7 +568,7 @@ choose_hard_reg_mode (unsigned int regno
     if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+           || !targetm.hard_regno_call_part_clobbered (0, regno, mode))
        && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
@@ -576,7 +576,7 @@ choose_hard_reg_mode (unsigned int regno
     if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+           || !targetm.hard_regno_call_part_clobbered (0, regno, mode))
        && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
@@ -584,7 +584,7 @@ choose_hard_reg_mode (unsigned int regno
     if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+           || !targetm.hard_regno_call_part_clobbered (0, regno, mode))
        && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
@@ -592,7 +592,7 @@ choose_hard_reg_mode (unsigned int regno
     if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+           || !targetm.hard_regno_call_part_clobbered (0, regno, mode))
        && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
@@ -606,7 +606,7 @@ choose_hard_reg_mode (unsigned int regno
       if (hard_regno_nregs (regno, mode) == nregs
          && targetm.hard_regno_mode_ok (regno, mode)
          && (!call_saved
-             || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode)))
+             || !targetm.hard_regno_call_part_clobbered (0, regno, mode)))
        return mode;
     }
 
Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c     2019-09-10 19:56:45.357177891 +0100
+++ gcc/regrename.c     2019-09-11 19:47:32.898202916 +0100
@@ -339,9 +339,9 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSE
         && ! DEBUG_INSN_P (tmp->insn))
        || (this_head->need_caller_save_reg
            && ! (targetm.hard_regno_call_part_clobbered
-                 (NULL, reg, GET_MODE (*tmp->loc)))
+                 (0, reg, GET_MODE (*tmp->loc)))
            && (targetm.hard_regno_call_part_clobbered
-               (NULL, new_reg, GET_MODE (*tmp->loc)))))
+               (0, new_reg, GET_MODE (*tmp->loc)))))
       return false;
 
   return true;
Index: gcc/reload.c
===================================================================
--- gcc/reload.c        2019-09-10 19:56:45.357177891 +0100
+++ gcc/reload.c        2019-09-11 19:47:32.902202887 +0100
@@ -6912,14 +6912,14 @@ find_equiv_reg (rtx goal, rtx_insn *insn
          if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER)
            for (i = 0; i < nregs; ++i)
              if (call_used_or_fixed_reg_p (regno + i)
-                 || targetm.hard_regno_call_part_clobbered (NULL, regno + i,
+                 || targetm.hard_regno_call_part_clobbered (0, regno + i,
                                                             mode))
                return 0;
 
          if (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER)
            for (i = 0; i < valuenregs; ++i)
              if (call_used_or_fixed_reg_p (valueno + i)
-                 || targetm.hard_regno_call_part_clobbered (NULL, valueno + i,
+                 || targetm.hard_regno_call_part_clobbered (0, valueno + i,
                                                             mode))
                return 0;
        }
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c       2019-09-10 19:56:45.357177891 +0100
+++ gcc/reload1.c       2019-09-11 19:47:32.902202887 +0100
@@ -8193,8 +8193,7 @@ emit_reload_insns (class insn_chain *cha
                           : out_regno + k);
                      reg_reloaded_insn[regno + k] = insn;
                      SET_HARD_REG_BIT (reg_reloaded_valid, regno + k);
-                     if (targetm.hard_regno_call_part_clobbered (NULL,
-                                                                 regno + k,
+                     if (targetm.hard_regno_call_part_clobbered (0, regno + k,
                                                                  mode))
                        SET_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
                                          regno + k);
@@ -8274,8 +8273,7 @@ emit_reload_insns (class insn_chain *cha
                           : in_regno + k);
                      reg_reloaded_insn[regno + k] = insn;
                      SET_HARD_REG_BIT (reg_reloaded_valid, regno + k);
-                     if (targetm.hard_regno_call_part_clobbered (NULL,
-                                                                 regno + k,
+                     if (targetm.hard_regno_call_part_clobbered (0, regno + k,
                                                                  mode))
                        SET_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
                                          regno + k);
@@ -8391,7 +8389,7 @@ emit_reload_insns (class insn_chain *cha
                      CLEAR_HARD_REG_BIT (reg_reloaded_dead, src_regno + k);
                      SET_HARD_REG_BIT (reg_reloaded_valid, src_regno + k);
                      if (targetm.hard_regno_call_part_clobbered
-                         (NULL, src_regno + k, mode))
+                         (0, src_regno + k, mode))
                        SET_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
                                          src_regno + k);
                      else
Index: gcc/sched-deps.c
===================================================================
--- gcc/sched-deps.c    2019-09-09 19:01:40.371078272 +0100
+++ gcc/sched-deps.c    2019-09-11 19:47:32.902202887 +0100
@@ -38,6 +38,7 @@ Software Foundation; either version 3, o
 #include "sched-int.h"
 #include "params.h"
 #include "cselib.h"
+#include "function-abi.h"
 
 #ifdef INSN_SCHEDULING
 
@@ -3723,6 +3724,7 @@ deps_analyze_insn (class deps_desc *deps
         }
       else
         {
+         function_abi abi = call_insn_abi (insn);
           for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
             /* A call may read and modify global register variables.  */
             if (global_regs[i])
@@ -3734,7 +3736,7 @@ deps_analyze_insn (class deps_desc *deps
              Since we only have a choice between 'might be clobbered'
              and 'definitely not clobbered', we must include all
              partly call-clobbered registers here.  */
-           else if (targetm.hard_regno_call_part_clobbered (insn, i,
+           else if (targetm.hard_regno_call_part_clobbered (abi.id (), i,
                                                             reg_raw_mode[i])
                      || TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
               SET_REGNO_REG_SET (reg_pending_clobbers, i);
Index: gcc/sel-sched.c
===================================================================
--- gcc/sel-sched.c     2019-09-10 19:56:45.357177891 +0100
+++ gcc/sel-sched.c     2019-09-11 19:47:32.902202887 +0100
@@ -1102,7 +1102,7 @@ init_regs_for_mode (machine_mode mode)
       if (i >= 0)
         continue;
 
-      if (targetm.hard_regno_call_part_clobbered (NULL, cur_reg, mode))
+      if (targetm.hard_regno_call_part_clobbered (0, cur_reg, mode))
         SET_HARD_REG_BIT (sel_hrd.regs_for_call_clobbered[mode],
                           cur_reg);
 
@@ -1247,7 +1247,7 @@ mark_unavailable_hard_regs (def_t def, s
 
   /* Exclude registers that are partially call clobbered.  */
   if (def->crosses_call
-      && !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+      && !targetm.hard_regno_call_part_clobbered (0, regno, mode))
     reg_rename_p->available_for_renaming
       &= ~sel_hrd.regs_for_call_clobbered[mode];
 
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c     2019-09-11 19:47:24.422262645 +0100
+++ gcc/targhooks.c     2019-09-11 19:47:32.906202859 +0100
@@ -1928,7 +1928,7 @@ default_dwarf_frame_reg_mode (int regno)
 {
   machine_mode save_mode = reg_raw_mode[regno];
 
-  if (targetm.hard_regno_call_part_clobbered (NULL, regno, save_mode))
+  if (targetm.hard_regno_call_part_clobbered (0, regno, save_mode))
     save_mode = choose_hard_reg_mode (regno, 1, true);
   return save_mode;
 }

Reply via email to