[33/77] Add a NARROWEST_INT_MODE macro

Message ID 877ezciuum.fsf@linaro.org
State New
Headers show
Series
  • Add wrapper classes for machine_modes
Related show

Commit Message

Richard Sandiford July 13, 2017, 8:50 a.m.
This patch replaces uses of GET_CLASS_NARROWEST_MODE (MODE_INT) with a
new NARROWEST_INT_MODE macro, which has type scalar_int_mode.

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

gcc/
	* machmode.h (NARROWEST_INT_MODE): New macro.
	* expr.c (alignment_for_piecewise_move): Use it instead of
	GET_CLASS_NARROWEST_MODE (MODE_INT).
	(push_block): Likewise.
	* stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator):
	Likewise.
	* tree-vrp.c (simplify_float_conversion_using_ranges): Likewise.

gcc/ada/
	* gcc-interface/decl.c (validate_size): Use NARROWEST_INT_MODE
	instead of GET_CLASS_NARROWEST_MODE (MODE_INT).

Patch hide | download patch | download mbox

Index: gcc/machmode.h
===================================================================
--- gcc/machmode.h	2017-07-13 09:18:31.699428322 +0100
+++ gcc/machmode.h	2017-07-13 09:18:38.043865449 +0100
@@ -656,6 +656,12 @@  #define GET_MODE_ALIGNMENT(MODE) get_mod
 #define GET_CLASS_NARROWEST_MODE(CLASS) \
   ((machine_mode) class_narrowest_mode[CLASS])
 
+/* The narrowest full integer mode available on the target.  */
+
+#define NARROWEST_INT_MODE \
+  (scalar_int_mode \
+   (scalar_int_mode::from_int (class_narrowest_mode[MODE_INT])))
+
 /* Return the narrowest mode in T's class.  */
 
 template<typename T>
Index: gcc/expr.c
===================================================================
--- gcc/expr.c	2017-07-13 09:18:36.841969327 +0100
+++ gcc/expr.c	2017-07-13 09:18:38.043865449 +0100
@@ -707,7 +707,7 @@  alignment_for_piecewise_move (unsigned i
     {
       machine_mode tmode, xmode;
 
-      xmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
+      xmode = NARROWEST_INT_MODE;
       FOR_EACH_MODE_IN_CLASS (tmode, MODE_INT)
 	{
 	  if (GET_MODE_SIZE (tmode) > max_pieces
@@ -3910,7 +3910,7 @@  push_block (rtx size, int extra, int bel
 			     negate_rtx (Pmode, size));
     }
 
-  return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp);
+  return memory_address (NARROWEST_INT_MODE, temp);
 }
 
 /* A utility routine that returns the base of an auto-inc memory, or NULL.  */
Index: gcc/stor-layout.c
===================================================================
--- gcc/stor-layout.c	2017-07-13 09:18:32.529352614 +0100
+++ gcc/stor-layout.c	2017-07-13 09:18:38.044865363 +0100
@@ -2697,7 +2697,7 @@  fixup_unsigned_type (tree type)
 			   HOST_WIDE_INT bitregion_start,
 			   HOST_WIDE_INT bitregion_end,
 			   unsigned int align, bool volatilep)
-: m_mode (GET_CLASS_NARROWEST_MODE (MODE_INT)), m_bitsize (bitsize),
+: m_mode (NARROWEST_INT_MODE), m_bitsize (bitsize),
   m_bitpos (bitpos), m_bitregion_start (bitregion_start),
   m_bitregion_end (bitregion_end), m_align (align),
   m_volatilep (volatilep), m_count (0)
Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	2017-07-13 09:18:24.776086502 +0100
+++ gcc/tree-vrp.c	2017-07-13 09:18:38.045865278 +0100
@@ -10115,7 +10115,7 @@  simplify_float_conversion_using_ranges (
      integer mode available.  */
   else
     {
-      mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
+      mode = NARROWEST_INT_MODE;
       for (;;)
 	{
 	  /* If we cannot do a signed conversion to float from mode
Index: gcc/ada/gcc-interface/decl.c
===================================================================
--- gcc/ada/gcc-interface/decl.c	2017-07-13 09:18:32.518353613 +0100
+++ gcc/ada/gcc-interface/decl.c	2017-07-13 09:18:38.042865534 +0100
@@ -8574,7 +8574,7 @@  validate_size (Uint uint_size, tree gnu_
      by the smallest integral mode that's valid for pointers.  */
   if (TREE_CODE (gnu_type) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (gnu_type))
     {
-      machine_mode p_mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
+      scalar_int_mode p_mode = NARROWEST_INT_MODE;
       while (!targetm.valid_pointer_mode (p_mode))
 	p_mode = *GET_MODE_WIDER_MODE (p_mode);
       type_size = bitsize_int (GET_MODE_BITSIZE (p_mode));