aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-02-24 10:07:32 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-02-24 10:07:32 +0000
commit36c265b175b63f894eb3e2e4ade8eb183a28855d (patch)
tree962fb4d7ff5222127ff66ea4b5030cebc44cda72 /gcc/stor-layout.c
parentda3a471976d248b4a54e90ffaf6f0e264b687737 (diff)
downloadgcc-36c265b175b63f894eb3e2e4ade8eb183a28855d.zip
gcc-36c265b175b63f894eb3e2e4ade8eb183a28855d.tar.gz
gcc-36c265b175b63f894eb3e2e4ade8eb183a28855d.tar.bz2
machmode.h (get_mode_alignment): Declare.
* 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
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index be27fae..3783a2f 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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