]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
genmodes.c (emit_max_int): New function.
authorKenneth Zadeck <zadeck@naturalbridge.com>
Thu, 28 Mar 2013 14:46:31 +0000 (14:46 +0000)
committerKenneth Zadeck <zadeck@gcc.gnu.org>
Thu, 28 Mar 2013 14:46:31 +0000 (14:46 +0000)
2013-03-28  Kenneth Zadeck <zadeck@naturalbridge.com>

    * genmodes.c (emit_max_int): New function.
(emit_insn_modes_h): Added call to emit_max_function.
* doc/rtl.texi (MAX_BITSIZE_MODE_ANY_INT, MAX_BITSIZE_MODE_ANY_MODE): Added doc.
* machmode.def: Fixed comment.

From-SVN: r197200

gcc/ChangeLog
gcc/doc/rtl.texi
gcc/genmodes.c
gcc/machmode.def

index 998fb0415f50fa9daf56411afed99ce570e02c67..84245d54a5721915f3d0e5eab6955162615ddf4a 100644 (file)
@@ -1,6 +1,12 @@
 2013-03-28  Kenneth Zadeck <zadeck@naturalbridge.com>
 
-       * combine.c (try_combine): Removed useless assert. 
+       * genmodes.c (emit_max_int): New function.
+       (emit_insn_modes_h): Added call to emit_max_function.
+       * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_INT, MAX_BITSIZE_MODE_ANY_MODE): Added doc.
+       * machmode.def: Fixed comment.
+2013-03-28  Kenneth Zadeck <zadeck@naturalbridge.com>
+
+       * combine.c (try_combine): Removed useless assert.
        * cselib.c (rtx_equal_for_cselib_1): Removed unnecessary parens.
 
 2013-03-28  Marek Polacek  <polacek@redhat.com>
index aa33d1cd80d1c2ede1ad691d1ed84b400d20d290..d82c72c723e04d952aae331f66bd5b1f41008f7e 100644 (file)
@@ -1456,6 +1456,20 @@ Returns the number of units contained in a mode, i.e.,
 Returns the narrowest mode in mode class @var{c}.
 @end table
 
+The following 4 variables are defined on every target.   They can be
+used to allocate buffers that are guaranteed to be large enough to
+hold any value that can be represented on the target.   
+
+@table @code
+@findex MAX_BITSIZE_MODE_ANY_INT
+@item MAX_BITSIZE_MODE_ANY_INT
+The maximum of MAX_BITSIZE_MODE_INT and MAX_BITSIZE_MODE_PARTIAL_INT.
+
+@findex MAX_BITSIZE_MODE_ANY_MODE
+@item MAX_BITSIZE_MODE_ANY_MODE
+The bitsize of the largest mode on the target.   
+@end table
+
 @findex byte_mode
 @findex word_mode
 The global variables @code{byte_mode} and @code{word_mode} contain modes
index 9907d6997616d1837e924fe647cd2d5192f10602..dc384833871b748a8d37bc106efc7d911e1c0125 100644 (file)
@@ -848,6 +848,36 @@ calc_wider_mode (void)
 
 #define print_closer() puts ("};")
 
+/* Compute the max bitsize of some of the classes of integers.  It may
+   be that there are needs for the other integer classes, and this
+   code is easy to extend.  */
+static void
+emit_max_int (void)
+{
+  unsigned int max, mmax;
+  struct mode_data *i;
+  int j;
+
+  puts ("");
+  for (max = 1, i = modes[MODE_INT]; i; i = i->next)
+    if (max < i->bytesize)
+       max = i->bytesize;
+  mmax = max;
+  for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next)
+    if (max < i->bytesize)
+       max = i->bytesize;
+  if (max > mmax)
+    mmax = max;
+  printf ("#define MAX_BITSIZE_MODE_ANY_INT %d*BITS_PER_UNIT\n", mmax);
+
+  mmax = 0;
+  for (j = 0; j < MAX_MODE_CLASS; j++)
+    for (i = modes[j]; i; i = i->next)
+      if (mmax < i->bytesize)
+       mmax = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d*BITS_PER_UNIT\n", mmax);
+}
+
 static void
 emit_insn_modes_h (void)
 {
@@ -912,6 +942,7 @@ enum machine_mode\n{");
 #endif
   printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
   printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
+  emit_max_int ();
   puts ("\
 \n\
 #endif /* insn-modes.h */");
index 4b581505e43336bdde98c02e40c0d9dadd583f98..1062f186e8aab98c44324ce13be76dbde38272a7 100644 (file)
@@ -179,8 +179,11 @@ RANDOM_MODE (BLK);
 FRACTIONAL_INT_MODE (BI, 1, 1);
 
 /* Basic integer modes.  We go up to TI in generic code (128 bits).
-   The name OI is reserved for a 256-bit type (needed by some back ends).
-   FIXME TI shouldn't be generically available either.  */
+   TImode is needed here because the some front ends now genericly
+   support __int128.  If the front ends decide to generically support
+   larger types, then corresponding modes must be added here.  The
+   name OI is reserved for a 256-bit type (needed by some back ends).
+    */
 INT_MODE (QI, 1);
 INT_MODE (HI, 2);
 INT_MODE (SI, 4);