diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2000-04-25 12:15:25 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2000-04-25 08:15:25 -0400 |
commit | 65e14bf592104223ad62014869b6a6795173cd8d (patch) | |
tree | 7dc227f9b6803825d296a44dddf6d3f5321d5c66 /gcc/stor-layout.c | |
parent | 05183359dab76cc72b7c149b44b79012e8234b88 (diff) | |
download | gcc-65e14bf592104223ad62014869b6a6795173cd8d.zip gcc-65e14bf592104223ad62014869b6a6795173cd8d.tar.gz gcc-65e14bf592104223ad62014869b6a6795173cd8d.tar.bz2 |
stor-layout.c (finalize_record_size): Simplify to use existing functions.
* stor-layout.c (finalize_record_size): Simplify to use existing
functions.
(compute_record_mode): No longer static.
* tree.h (compute_record_mode): New declaration.
From-SVN: r33412
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index cce030b..3336cc8 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -51,7 +51,6 @@ unsigned int maximum_field_alignment; unsigned int set_alignment = 0; static void finalize_record_size PARAMS ((record_layout_info)); -static void compute_record_mode PARAMS ((tree)); static void finalize_type_size PARAMS ((tree)); static void place_union_field PARAMS ((record_layout_info, tree)); @@ -890,13 +889,10 @@ finalize_record_size (rli) { tree unpadded_size, unpadded_size_unit; - /* Next move any full bytes of bits into the byte size. */ - rli->offset - = size_binop (PLUS_EXPR, rli->offset, - convert (sizetype, - size_binop (TRUNC_DIV_EXPR, rli->bitpos, - bitsize_unit_node))); - rli->bitpos = size_binop (TRUNC_MOD_EXPR, rli->bitpos, bitsize_unit_node); + /* Now we want just byte and bit offsets, so set the offset alignment + to be a byte and then normalize. */ + rli->offset_align = BITS_PER_UNIT; + normalize_rli (rli); /* Determine the desired alignment. */ #ifdef ROUND_TYPE_ALIGN @@ -906,16 +902,14 @@ finalize_record_size (rli) TYPE_ALIGN (rli->t) = MAX (TYPE_ALIGN (rli->t), rli->record_align); #endif - unpadded_size - = size_binop (PLUS_EXPR, rli->bitpos, - size_binop (MULT_EXPR, convert (bitsizetype, rli->offset), - bitsize_unit_node)); - - unpadded_size_unit - = size_binop (PLUS_EXPR, rli->offset, - convert (sizetype, - size_binop (CEIL_DIV_EXPR, rli->bitpos, - bitsize_unit_node))); + /* Compute the size so far. Be sure to allow for extra bits in the + size in bytes. We have guaranteed above that it will be no more + than a single byte. */ + unpadded_size = rli_size_so_far (rli); + unpadded_size_unit = rli_size_unit_so_far (rli); + if (! integer_zerop (rli->bitpos)) + unpadded_size_unit + = size_binop (PLUS_EXPR, unpadded_size_unit, size_one_node); /* Record the un-rounded size in the binfo node. But first we check the size of TYPE_BINFO to make sure that BINFO_SIZE is available. */ @@ -993,7 +987,7 @@ finalize_record_size (rli) /* Compute the TYPE_MODE for the TYPE (which is a RECORD_TYPE). */ -static void +void compute_record_mode (type) tree type; { |