]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[74/77] Various small scalar_mode changes
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 30 Aug 2017 11:20:47 +0000 (11:20 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 30 Aug 2017 11:20:47 +0000 (11:20 +0000)
This patch uses scalar_mode in a few miscellaneous places:

- Previous patches mean mode_to_vector can take a scalar_mode without
  further changes.

- Implicit promotion is limited to scalar types (affects promote_mode
  and sdbout_parms)

2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* machmode.h (mode_for_vector): Take a scalar_mode instead
of a machine_mode.
* stor-layout.c (mode_for_vector): Likewise.
* explow.c (promote_mode): Use as_a <scalar_mode>.
* sdbout.c (sdbout_parms): Use is_a <scalar_mode>.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251525

gcc/ChangeLog
gcc/explow.c
gcc/machmode.h
gcc/sdbout.c
gcc/stor-layout.c

index 95e24a3c47d42c448a337a29e119b213fc6ef6f5..bc704067bf063cf04f9c426dd04cda86a3293cf1 100644 (file)
@@ -1,3 +1,13 @@
+2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * machmode.h (mode_for_vector): Take a scalar_mode instead
+       of a machine_mode.
+       * stor-layout.c (mode_for_vector): Likewise.
+       * explow.c (promote_mode): Use as_a <scalar_mode>.
+       * sdbout.c (sdbout_parms): Use is_a <scalar_mode>.
+
 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index ee20969d23a52e642b39d188d380e2388635a76c..82380f31093c629e6d676b81521e56cb61d10ad3 100644 (file)
@@ -787,6 +787,7 @@ promote_mode (const_tree type ATTRIBUTE_UNUSED, machine_mode mode,
 #ifdef PROMOTE_MODE
   enum tree_code code;
   int unsignedp;
+  scalar_mode smode;
 #endif
 
   /* For libcalls this is invoked without TYPE from the backends
@@ -806,9 +807,11 @@ promote_mode (const_tree type ATTRIBUTE_UNUSED, machine_mode mode,
     {
     case INTEGER_TYPE:   case ENUMERAL_TYPE:   case BOOLEAN_TYPE:
     case REAL_TYPE:      case OFFSET_TYPE:     case FIXED_POINT_TYPE:
-      PROMOTE_MODE (mode, unsignedp, type);
+      /* Values of these types always have scalar mode.  */
+      smode = as_a <scalar_mode> (mode);
+      PROMOTE_MODE (smode, unsignedp, type);
       *punsignedp = unsignedp;
-      return mode;
+      return smode;
 
 #ifdef POINTERS_EXTEND_UNSIGNED
     case REFERENCE_TYPE:
index 5d84a2eca583ec7181bacfaecd2629f032cceef2..b3e79ca4df6850170269b1053e6cee82f099c394 100644 (file)
@@ -650,7 +650,7 @@ extern machine_mode bitwise_mode_for_mode (machine_mode);
 /* Return a mode that is suitable for representing a vector,
    or BLKmode on failure.  */
 
-extern machine_mode mode_for_vector (machine_mode, unsigned);
+extern machine_mode mode_for_vector (scalar_mode, unsigned);
 
 /* A class for iterating through possible bitfield modes.  */
 class bit_field_mode_iterator
index 8fcb97712172def20d28435e0df0501f7b738c71..acd25a3c7658eae14609fffabab9963da2d53965 100644 (file)
@@ -1281,11 +1281,15 @@ sdbout_parms (tree parms)
                   the parm with the variable's declared type, and adjust
                   the address if the least significant bytes (which we are
                   using) are not the first ones.  */
+               scalar_mode from_mode, to_mode;
                if (BYTES_BIG_ENDIAN
-                   && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
-                 current_sym_value +=
-                   (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
-                    - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
+                   && TREE_TYPE (parms) != DECL_ARG_TYPE (parms)
+                   && is_a <scalar_mode> (TYPE_MODE (DECL_ARG_TYPE (parms)),
+                                          &from_mode)
+                   && is_a <scalar_mode> (GET_MODE (DECL_RTL (parms)),
+                                          &to_mode))
+                 current_sym_value += (GET_MODE_SIZE (from_mode)
+                                       - GET_MODE_SIZE (to_mode));
 
                if (MEM_P (DECL_RTL (parms))
                    && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
index d6c1bb6e1f534278db164268b400156438521137..6414545d138aadb075385a595539c38aca444ea5 100644 (file)
@@ -478,7 +478,7 @@ bitwise_type_for_mode (machine_mode mode)
    is no suitable mode.  */
 
 machine_mode
-mode_for_vector (machine_mode innermode, unsigned nunits)
+mode_for_vector (scalar_mode innermode, unsigned nunits)
 {
   machine_mode mode;