x86: Update message for target_clones and unsupported ISAs
[gcc.git] / gcc / reginfo.c
index 6f699eb0fb7c0cae152d27698da4803ae852d4a5..315c5ecabe6d7bb220f3accc8b01674876606605 100644 (file)
@@ -1,5 +1,5 @@
 /* Compute different info about registers.
-   Copyright (C) 1987-2017 Free Software Foundation, Inc.
+   Copyright (C) 1987-2019 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -508,7 +508,8 @@ init_reg_modes_target (void)
 
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
     for (j = 0; j < MAX_MACHINE_MODE; j++)
-      hard_regno_nregs[i][j] = HARD_REGNO_NREGS (i, (machine_mode)j);
+      this_target_regs->x_hard_regno_nregs[i][j]
+       = targetm.hard_regno_nregs (i, (machine_mode) j);
 
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
     {
@@ -518,7 +519,7 @@ init_reg_modes_target (void)
         if it is suitable, otherwise fall back on word_mode.  */
       if (reg_raw_mode[i] == VOIDmode)
        {
-         if (i > 0 && hard_regno_nregs[i][reg_raw_mode[i - 1]] == 1)
+         if (i > 0 && hard_regno_nregs (i, reg_raw_mode[i - 1]) == 1)
            reg_raw_mode[i] = reg_raw_mode[i - 1];
          else
            reg_raw_mode[i] = word_mode;
@@ -630,38 +631,40 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
 
   /* We first look for the largest integer mode that can be validly
      held in REGNO.  If none, we look for the largest floating-point mode.
-     If we still didn't find a valid mode, try CCmode.  */
+     If we still didn't find a valid mode, try CCmode.
 
+     The tests use maybe_gt rather than known_gt because we want (for example)
+     N V4SFs to win over plain V4SF even though N might be 1.  */
   FOR_EACH_MODE_IN_CLASS (mode, MODE_INT)
-    if ((unsigned) hard_regno_nregs[regno][mode] == nregs
+    if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (regno, mode))
-       && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+       && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT)
-    if ((unsigned) hard_regno_nregs[regno][mode] == nregs
+    if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (regno, mode))
-       && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+       && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_FLOAT)
-    if ((unsigned) hard_regno_nregs[regno][mode] == nregs
+    if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (regno, mode))
-       && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+       && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT)
-    if ((unsigned) hard_regno_nregs[regno][mode] == nregs
+    if (hard_regno_nregs (regno, mode) == nregs
        && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
-           || !targetm.hard_regno_call_part_clobbered (regno, mode))
-       && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+           || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode))
+       && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
       found_mode = mode;
 
   if (found_mode != VOIDmode)
@@ -671,10 +674,10 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
   for (m = (unsigned int) CCmode; m < (unsigned int) NUM_MACHINE_MODES; ++m)
     {
       mode = (machine_mode) m;
-      if ((unsigned) hard_regno_nregs[regno][mode] == nregs
+      if (hard_regno_nregs (regno, mode) == nregs
          && targetm.hard_regno_mode_ok (regno, mode)
          && (!call_saved
-             || !targetm.hard_regno_call_part_clobbered (regno, mode)))
+             || !targetm.hard_regno_call_part_clobbered (NULL, regno, mode)))
        return mode;
     }
 
@@ -779,6 +782,7 @@ globalize_reg (tree decl, int i)
 
   if (global_regs[i])
     {
+      auto_diagnostic_group d;
       warning_at (loc, 0, 
                  "register of %qD used for multiple global register variables",
                  decl);
@@ -1097,6 +1101,10 @@ reg_scan_mark_refs (rtx x, rtx_insn *insn)
        reg_scan_mark_refs (XEXP (XEXP (x, 0), 0), insn);
       break;
 
+    case CLOBBER_HIGH:
+      gcc_assert (!(MEM_P (XEXP (x, 0))));
+      break;
+
     case SET:
       /* Count a set of the destination if it is a register.  */
       for (dest = SET_DEST (x);
@@ -1205,7 +1213,9 @@ reg_classes_intersect_p (reg_class_t c1, reg_class_t c2)
 inline hashval_t
 simplifiable_subregs_hasher::hash (const simplifiable_subreg *value)
 {
-  return value->shape.unique_id ();
+  inchash::hash h;
+  h.add_hwi (value->shape.unique_id ());
+  return h.end ();
 }
 
 inline bool
@@ -1230,9 +1240,11 @@ simplifiable_subregs (const subreg_shape &shape)
   if (!this_target_hard_regs->x_simplifiable_subregs)
     this_target_hard_regs->x_simplifiable_subregs
       = new hash_table <simplifiable_subregs_hasher> (30);
+  inchash::hash h;
+  h.add_hwi (shape.unique_id ());
   simplifiable_subreg **slot
     = (this_target_hard_regs->x_simplifiable_subregs
-       ->find_slot_with_hash (&shape, shape.unique_id (), INSERT));
+       ->find_slot_with_hash (&shape, h.end (), INSERT));
 
   if (!*slot)
     {
@@ -1289,11 +1301,15 @@ record_subregs_of_mode (rtx subreg, bool partial_def)
         subregs will be invalid.
 
         This relies on the fact that we've already been passed
-        SUBREG with PARTIAL_DEF set to false.  */
-      unsigned int size = MAX (REGMODE_NATURAL_SIZE (shape.inner_mode),
-                              GET_MODE_SIZE (shape.outer_mode));
-      gcc_checking_assert (size < GET_MODE_SIZE (shape.inner_mode));
-      if (shape.offset >= size)
+        SUBREG with PARTIAL_DEF set to false.
+
+        The size of the outer mode must ordered wrt the size of the
+        inner mode's registers, since otherwise we wouldn't know at
+        compile time how many registers the outer mode occupies.  */
+      poly_uint64 size = ordered_max (REGMODE_NATURAL_SIZE (shape.inner_mode),
+                                     GET_MODE_SIZE (shape.outer_mode));
+      gcc_checking_assert (known_lt (size, GET_MODE_SIZE (shape.inner_mode)));
+      if (known_ge (shape.offset, size))
        shape.offset -= size;
       else
        shape.offset += size;