This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada updates frozen


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

>     I realize this.  Do you think it will work (at least as a stopgap
>     measure) for Ada to use 
>     GET_MODE_BITSIZE (mode_for_precision (LONG_DOUBLE_TYPE_SIZE))
>     instead of bare LONG_DOUBLE_TYPE_SIZE?  After I change
>     GET_MODE_BITSIZE to mean what it used to mean, that is.
>
> In principle, yes, but it also needs to know the type sizes in a context where
> it doesn't have the GCC backend available (for gnatpsta), so it's a little
> harder than that.

I can't support doing anything with gnatpsta/gnatpsys except folding
them into gnat1, sorry, what you have now is flat broken and has been
since the invention of multilibs.

Here is the patch that I have been testing.  It gets me as far as

$ make gnatlib_and_tools
...
../../xgcc -B../../ -c -g -O2      -W -Wall -gnatpg  a-ncelfu.ads -o a-ncelfu.o
+===========================GNAT BUG DETECTED==============================+
| 3.4 20031102 (experimental) (i686-pc-linux-gnu) Gigi abort, Code=414     |
| Error detected at a-ngelfu.adb:237:14 [a-ngcefu.adb:38:4 [a-ncelfu.ads:19:1]]|
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases, 
so please double check that the problem can still 
be reproduced with the set of files listed.


compilation abandoned
make[2]: *** [a-ncelfu.o] Error 1
make[2]: Leaving directory `/home/zack/src/gcc/vanilla/build/gcc/ada/rts'
make[1]: *** [gnatlib] Error 2
make[1]: Leaving directory `/home/zack/src/gcc/vanilla/build/gcc/ada'
make: *** [gnatlib] Error 2

(Where's the list of files?)

zw

===================================================================
Index: genmodes.c
--- genmodes.c	29 Oct 2003 17:01:27 -0000	1.8
+++ genmodes.c	3 Nov 2003 01:37:28 -0000
@@ -56,7 +56,7 @@ struct mode_data
 
   const char *name;		/* printable mode name -- SI, not SImode */
   enum mode_class class;	/* this mode class */
-  unsigned int bitsize;		/* size in bits, equiv to TYPE_PRECISION */
+  unsigned int precision;	/* size in bits, equiv to TYPE_PRECISION */
   unsigned int bytesize;	/* storage size in addressable units */
   unsigned int ncomponents;	/* number of subunits */
   unsigned int alignment;	/* mode alignment */
@@ -262,13 +262,13 @@ enum requirement { SET, UNSET, OPTIONAL 
 
 static void
 validate_mode (struct mode_data *m,
-	       enum requirement r_bitsize,
+	       enum requirement r_precision,
 	       enum requirement r_bytesize,
 	       enum requirement r_component,
 	       enum requirement r_ncomponents,
 	       enum requirement r_format)
 {
-  validate_field (m, bitsize);
+  validate_field (m, precision);
   validate_field (m, bytesize);
   validate_field (m, component);
   validate_field (m, ncomponents);
@@ -304,7 +304,7 @@ complete_mode (struct mode_data *m)
 
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
 
-      m->bitsize = 0;
+      m->precision = 0;
       m->bytesize = 0;
       m->ncomponents = 0;
       m->component = 0;
@@ -349,8 +349,8 @@ complete_mode (struct mode_data *m)
       /* Complex modes should have a component indicated, but no more.  */
       validate_mode (m, UNSET, UNSET, SET, UNSET, UNSET);
       m->ncomponents = 2;
-      if (m->component->bitsize != (unsigned int)-1)
-	m->bitsize = 2 * m->component->bitsize;
+      if (m->component->precision != (unsigned int)-1)
+	m->precision = 2 * m->component->precision;
       m->bytesize = 2 * m->component->bytesize;
       break;
 
@@ -358,8 +358,8 @@ complete_mode (struct mode_data *m)
     case MODE_VECTOR_FLOAT:
       /* Vector modes should have a component and a number of components.  */
       validate_mode (m, UNSET, UNSET, SET, SET, UNSET);
-      if (m->component->bitsize != (unsigned int)-1)
-	m->bitsize = m->ncomponents * m->component->bitsize;
+      if (m->component->precision != (unsigned int)-1)
+	m->precision = m->ncomponents * m->component->precision;
       m->bytesize = m->ncomponents * m->component->bytesize;
       break;
 
@@ -413,7 +413,7 @@ make_complex_modes (enum mode_class clas
   for (m = modes[class]; m; m = m->next)
     {
       /* Skip BImode.  FIXME: BImode probably shouldn't be MODE_INT.  */
-      if (m->bitsize == 1)
+      if (m->precision == 1)
 	continue;
 
       if (strlen (m->name) >= sizeof buf)
@@ -479,7 +479,7 @@ make_vector_modes (enum mode_class class
 	 not be necessary.  */
       if (class == MODE_FLOAT && m->bytesize == 1)
 	continue;
-      if (class == MODE_INT && m->bitsize == 1)
+      if (class == MODE_INT && m->precision == 1)
 	continue;
 
       if ((size_t)snprintf (buf, sizeof buf, "V%u%s", ncomponents, m->name)
@@ -515,12 +515,12 @@ make_special_mode (enum mode_class class
 
 static void
 make_int_mode (const char *name,
-	       unsigned int bitsize, unsigned int bytesize,
+	       unsigned int precision, unsigned int bytesize,
 	       const char *file, unsigned int line)
 {
   struct mode_data *m = new_mode (MODE_INT, name, file, line);
   m->bytesize = bytesize;
-  m->bitsize = bitsize;
+  m->precision = precision;
 }
 
 #define FLOAT_MODE(N, Y, F)             FRACTIONAL_FLOAT_MODE (N, -1, Y, F)
@@ -529,13 +529,13 @@ make_int_mode (const char *name,
 
 static void
 make_float_mode (const char *name,
-		 unsigned int bitsize, unsigned int bytesize,
+		 unsigned int precision, unsigned int bytesize,
 		 const char *format,
 		 const char *file, unsigned int line)
 {
   struct mode_data *m = new_mode (MODE_FLOAT, name, file, line);
   m->bytesize = bytesize;
-  m->bitsize = bitsize;
+  m->precision = precision;
   m->format = format;
 }
 
@@ -565,7 +565,7 @@ reset_float_format (const char *name, co
   make_partial_integer_mode (#M, "P" #M, -1, __FILE__, __LINE__)
 static void ATTRIBUTE_UNUSED
 make_partial_integer_mode (const char *base, const char *name,
-			   unsigned int bitsize,
+			   unsigned int precision,
 			   const char *file, unsigned int line)
 {
   struct mode_data *m;
@@ -582,7 +582,7 @@ make_partial_integer_mode (const char *b
     }
   
   m = new_mode (MODE_PARTIAL_INT, name, file, line);
-  m->bitsize = bitsize;
+  m->precision = precision;
   m->component = component;
 }
 
@@ -645,18 +645,18 @@ create_modes (void)
 /* Processing.  */
 
 /* Sort a list of modes into the order needed for the WIDER field:
-   major sort by bitsize, minor sort by component bitsize.
+   major sort by precision, minor sort by component precision.
 
    For instance:
      QI < HI < SI < DI < TI
      V4QI < V2HI < V8QI < V4HI < V2SI.
 
-   If the bitsize is not set, sort by the bytesize.  A mode with
-   bitsize set gets sorted before a mode without bitsize set, if
+   If the precision is not set, sort by the bytesize.  A mode with
+   precision set gets sorted before a mode without precision set, if
    they have the same bytesize; this is the right thing because
-   the bitsize must always be smaller than the bytesize * BITS_PER_UNIT.
+   the precision must always be smaller than the bytesize * BITS_PER_UNIT.
    We don't have to do anything special to get this done -- an unset
-   bitsize shows up as (unsigned int)-1, i.e. UINT_MAX.  */
+   precision shows up as (unsigned int)-1, i.e. UINT_MAX.  */
 static int
 cmp_modes (const void *a, const void *b)
 {
@@ -668,9 +668,9 @@ cmp_modes (const void *a, const void *b)
   else if (m->bytesize < n->bytesize)
     return -1;
 
-  if (m->bitsize > n->bitsize)
+  if (m->precision > n->precision)
     return 1;
-  else if (m->bitsize < n->bitsize)
+  else if (m->precision < n->precision)
     return -1;
 
   if (!m->component && !n->component)
@@ -681,9 +681,9 @@ cmp_modes (const void *a, const void *b)
   else if (m->component->bytesize < n->component->bytesize)
     return -1;
 
-  if (m->component->bitsize > n->component->bitsize)
+  if (m->component->precision > n->component->precision)
     return 1;
-  else if (m->component->bitsize < n->component->bitsize)
+  else if (m->component->precision < n->component->precision)
     return -1;
 
   return 0;
@@ -802,7 +802,7 @@ enum machine_mode\n{");
 	 end will try to use it for bitfields in structures and the
 	 like, which we do not want.  Only the target md file should
 	 generate BImode widgets.  */
-      if (first && first->bitsize == 1)
+      if (first && first->precision == 1)
 	first = first->next;
 
       if (first && last)
@@ -892,16 +892,16 @@ emit_mode_class (void)
 }
 
 static void
-emit_mode_bitsize (void)
+emit_mode_precision (void)
 {
   enum mode_class c;
   struct mode_data *m;
 
-  print_decl ("unsigned short", "mode_bitsize", "NUM_MACHINE_MODES");
+  print_decl ("unsigned short", "mode_precision", "NUM_MACHINE_MODES");
 
   for_all_modes (c, m)
-    if (m->bitsize != (unsigned int)-1)
-      tagged_printf ("%u", m->bitsize, m->name);
+    if (m->precision != (unsigned int)-1)
+      tagged_printf ("%u", m->precision, m->name);
     else
       tagged_printf ("%u*BITS_PER_UNIT", m->bytesize, m->name);
 
@@ -968,8 +968,8 @@ emit_mode_mask (void)
    : ((unsigned HOST_WIDE_INT) 1 << (m)) - 1\n");
 
   for_all_modes (c, m)
-    if (m->bitsize != (unsigned int)-1)
-      tagged_printf ("MODE_MASK (%u)", m->bitsize, m->name);
+    if (m->precision != (unsigned int)-1)
+      tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
     else
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
 
@@ -1020,7 +1020,7 @@ emit_class_narrowest_mode (void)
     /* Bleah, all this to get the comment right for MIN_MODE_INT.  */
     tagged_printf ("MIN_%s", mode_class_names[c],
 		   modes[c]
-		   ? (modes[c]->bitsize != 1
+		   ? (modes[c]->precision != 1
 		      ? modes[c]->name
 		      : (modes[c]->next
 			 ? modes[c]->next->name
@@ -1156,7 +1156,7 @@ emit_insn_modes_c (void)
   emit_insn_modes_c_header ();
   emit_mode_name ();
   emit_mode_class ();
-  emit_mode_bitsize ();
+  emit_mode_precision ();
   emit_mode_size ();
   emit_mode_nunits ();
   emit_mode_wider ();
===================================================================
Index: machmode.def
--- machmode.def	15 Oct 2003 21:57:21 -0000	1.26
+++ machmode.def	3 Nov 2003 01:37:28 -0000
@@ -47,7 +47,7 @@ Software Foundation, 59 Temple Place - S
    A MODE argument must be the printable name of a machine mode,
    without quotation marks or trailing "mode".  For instance, SI.
 
-   A BITSIZE, BYTESIZE, or COUNT argument must be a positive integer
+   A PRECISION, BYTESIZE, or COUNT argument must be a positive integer
    constant.
 
    A FORMAT argument must be one of the real_mode_format structures
@@ -78,18 +78,18 @@ Software Foundation, 59 Temple Place - S
         declares MODE to be of class INT and BYTESIZE bytes wide.
 	All of the bits of its representation are significant.
 
-     FRACTIONAL_INT_MODE (MODE, BITSIZE, BYTESIZE);
+     FRACTIONAL_INT_MODE (MODE, PRECISION, BYTESIZE);
         declares MODE to be of class INT, BYTESIZE bytes wide in
-	storage, but with only BITSIZE significant bits.
+	storage, but with only PRECISION significant bits.
 
      FLOAT_MODE (MODE, BYTESIZE, FORMAT);
         declares MODE to be of class FLOAT and BYTESIZE bytes wide,
 	using floating point format FORMAT.
 	All of the bits of its representation are significant.
 
-     FRACTIONAL_FLOAT_MODE (MODE, BITSIZE, BYTESIZE, FORMAT);
+     FRACTIONAL_FLOAT_MODE (MODE, PRECISION, BYTESIZE, FORMAT);
         declares MODE to be of class FLOAT, BYTESIZE bytes wide in
-	storage, but with only BITSIZE significant bits, using
+	storage, but with only PRECISION significant bits, using
 	floating point format FORMAT.
 
      RESET_FLOAT_FORMAT (MODE, FORMAT);
@@ -101,7 +101,7 @@ Software Foundation, 59 Temple Place - S
         declares a mode of class PARTIAL_INT with the same size as
 	MODE (which must be an INT mode).  The name of the new mode
 	is made by prefixing a P to the name MODE.  This statement
-	may grow a BITSIZE argument in the future.
+	may grow a PRECISION argument in the future.
 
      VECTOR_MODE (CLASS, MODE, COUNT);
         Declare a vector mode whose component mode is MODE (of class
===================================================================
Index: machmode.h
--- machmode.h	25 Oct 2003 02:03:34 -0000	1.37
+++ machmode.h	3 Nov 2003 01:37:28 -0000
@@ -76,15 +76,15 @@ extern const unsigned char mode_class[NU
 #define SCALAR_FLOAT_MODE_P(MODE)		\
   (GET_MODE_CLASS (MODE) == MODE_FLOAT)
 
-/* Get the size in bytes of an object of mode MODE.  */
+/* Get the size in bytes and bits of an object of mode MODE.  */
 
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
-#define GET_MODE_SIZE(MODE)   mode_size[MODE]
+#define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
+#define GET_MODE_BITSIZE(MODE) ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
 
-/* Get the size in bits of an object of mode MODE.  */
-
-extern const unsigned short mode_bitsize[NUM_MACHINE_MODES];
-#define GET_MODE_BITSIZE(MODE)  mode_bitsize[MODE]
+/* Get the number of value bits of an object of mode MODE.  */
+extern const unsigned short mode_precision[NUM_MACHINE_MODES];
+#define GET_MODE_PRECISION(MODE)  mode_precision[MODE]
 
 /* Get a bitmask containing 1 for all bits in a word
    that fit within mode MODE.  */
===================================================================
Index: stor-layout.c
--- stor-layout.c	22 Oct 2003 02:14:36 -0000	1.172
+++ stor-layout.c	3 Nov 2003 01:37:30 -0000
@@ -203,10 +203,10 @@ variable_size (tree size)
 #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
 #endif
 
-/* Return the machine mode to use for a nonscalar of SIZE bits.
-   The mode must be in class CLASS, and have exactly that many bits.
-   If LIMIT is nonzero, modes of wider than MAX_FIXED_MODE_SIZE will not
-   be used.  */
+/* Return the machine mode to use for a nonscalar of SIZE bits.  The
+   mode must be in class CLASS, and have exactly that many value bits;
+   it may have padding as well.  If LIMIT is nonzero, modes of wider
+   than MAX_FIXED_MODE_SIZE will not be used.  */
 
 enum machine_mode
 mode_for_size (unsigned int size, enum mode_class class, int limit)
@@ -219,7 +219,7 @@ mode_for_size (unsigned int size, enum m
   /* Get the first mode which has this size, in the specified class.  */
   for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
-    if (GET_MODE_BITSIZE (mode) == size)
+    if (GET_MODE_PRECISION (mode) == size)
       return mode;
 
   return BLKmode;
@@ -242,7 +242,7 @@ mode_for_size_tree (tree size, enum mode
 }
 
 /* Similar, but never return BLKmode; return the narrowest mode that
-   contains at least the requested number of bits.  */
+   contains at least the requested number of value bits.  */
 
 enum machine_mode
 smallest_mode_for_size (unsigned int size, enum mode_class class)
@@ -253,7 +253,7 @@ smallest_mode_for_size (unsigned int siz
      specified class.  */
   for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
-    if (GET_MODE_BITSIZE (mode) >= size)
+    if (GET_MODE_PRECISION (mode) >= size)
       return mode;
 
   abort ();
===================================================================
Index: ada/targtyps.c
--- ada/targtyps.c	31 Oct 2003 01:08:43 -0000	1.7
+++ ada/targtyps.c	3 Nov 2003 01:37:30 -0000
@@ -68,6 +68,8 @@
 /* The following provide a functional interface for the front end Ada code
    to determine the sizes that are used for various C types. */
 
+#define SIZE_WITH_PADDING(X, Y) GET_MODE_BITSIZE (smallest_mode_for_size (X, Y))
+
 Pos
 get_target_bits_per_unit (void)
 {
@@ -83,62 +85,62 @@ get_target_bits_per_word (void)
 Pos
 get_target_char_size (void)
 {
-  return CHAR_TYPE_SIZE;
+  return SIZE_WITH_PADDING (CHAR_TYPE_SIZE, MODE_INT);
 }
 
 Pos
 get_target_wchar_t_size (void)
 {
   /* We never want wide chacters less than "short" in Ada.  */
-  return MAX (SHORT_TYPE_SIZE, WCHAR_TYPE_SIZE);
+  return SIZE_WITH_PADDING (MAX (SHORT_TYPE_SIZE, WCHAR_TYPE_SIZE), MODE_INT);
 }
 
 Pos
 get_target_short_size (void)
 {
-  return SHORT_TYPE_SIZE;
+  return SIZE_WITH_PADDING (SHORT_TYPE_SIZE, MODE_INT);
 }
 
 Pos
 get_target_int_size (void)
 {
-  return INT_TYPE_SIZE;
+  return SIZE_WITH_PADDING (INT_TYPE_SIZE, MODE_INT);
 }
 
 Pos
 get_target_long_size (void)
 {
-  return ADA_LONG_TYPE_SIZE;
+  return SIZE_WITH_PADDING (ADA_LONG_TYPE_SIZE, MODE_INT);
 }
 
 Pos
 get_target_long_long_size (void)
 {
-  return LONG_LONG_TYPE_SIZE;
+  return SIZE_WITH_PADDING (LONG_LONG_TYPE_SIZE, MODE_INT);
 }
 
 Pos
 get_target_float_size (void)
 {
-  return FLOAT_TYPE_SIZE;
+  return SIZE_WITH_PADDING (FLOAT_TYPE_SIZE, MODE_FLOAT);
 }
 
 Pos
 get_target_double_size (void)
 {
-  return DOUBLE_TYPE_SIZE;
+  return SIZE_WITH_PADDING (DOUBLE_TYPE_SIZE, MODE_FLOAT);
 }
 
 Pos
 get_target_long_double_size (void)
 {
-  return WIDEST_HARDWARE_FP_SIZE;
+  return SIZE_WITH_PADDING (WIDEST_HARDWARE_FP_SIZE, MODE_FLOAT);
 }
 
 Pos
 get_target_pointer_size (void)
 {
-  return POINTER_SIZE;
+  return SIZE_WITH_PADDING (POINTER_SIZE, MODE_INT);
 }
 
 Pos


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]