machmode.h (get_mode_alignment): Declare.
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 24 Feb 2000 10:07:32 +0000 (10:07 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 24 Feb 2000 10:07:32 +0000 (10:07 +0000)
* machmode.h (get_mode_alignment): Declare.
(GET_MODE_ALIGNMENT): Call it.
* stor-layout.c (get_mode_alignment): New function. Make
sure alignment is always power of 2.

From-SVN: r32134

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

index 71765abe8e08084f7dd013bbd16541126389714f..225b3bcae34360f400f48664c32fadb6ef7195b0 100644 (file)
@@ -1,3 +1,10 @@
+2000-02-24  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * machmode.h (get_mode_alignment): Declare.
+       (GET_MODE_ALIGNMENT): Call it.
+       * stor-layout.c (get_mode_alignment): New function. Make
+       sure alignment is always power of 2.
+
 2000-02-23  Zack Weinberg  <zack@wolery.cumb.org>
 
        * i386.h: Remove useless definition of "I386" and misleading
index 1f2fb2bbd09f8f977dc0b95797ec61aec2125d75..702e20967a69054ae147803b6327978e059a622b 100644 (file)
@@ -125,9 +125,9 @@ extern enum machine_mode get_best_mode PARAMS ((int, int, unsigned int,
 
 /* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT.  */
 
-#define GET_MODE_ALIGNMENT(MODE)   \
-  (unsigned int) MIN (BIGGEST_ALIGNMENT,          \
-                     MAX (1, (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)))
+extern unsigned get_mode_alignment PARAMS ((enum machine_mode));
+
+#define GET_MODE_ALIGNMENT(MODE) get_mode_alignment (MODE)
 
 /* For each class, get the narrowest mode in that class.  */
 
index be27faeb221a3770af3de1afa939a9265320b4ee..3783a2ff81486d84fee61b9bf812bd57e6ec302a 100644 (file)
@@ -1528,6 +1528,23 @@ get_best_mode (bitsize, bitpos, align, largest_mode, volatilep)
   return mode;
 }
 
+/* Return the alignment of MODE. This will be bounded by 1 and
+   BIGGEST_ALIGNMENT.  */
+
+unsigned get_mode_alignment (mode)
+     enum machine_mode mode;
+{
+  unsigned alignment = GET_MODE_UNIT_SIZE (mode);
+  
+  /* Extract the LSB of the size.  */
+  alignment = alignment & -alignment;
+  
+  alignment *= BITS_PER_UNIT;
+
+  alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
+  return alignment;
+}
+
 /* This function is run once to initialize stor-layout.c.  */
 
 void