diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a09d53095ff..3022208044f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Tue Apr 25 07:33:12 2000 Richard Kenner + + * stor-layout.c (finalize_record_size): Simplify to use existing + functions. + (compute_record_mode): No longer static. + * tree.h (compute_record_mode): New declaration. + 2000-04-25 Neil Booth * Revert my patch below until cause of build failures @@ -8,8 +15,6 @@ * combine.c (combine_instructions): Add missing argument to try_combine. -2000-04-25 Richard Henderson - * toplev.c (rest_of_compilation): Delay sibcall optimization until after emit_eh_context. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index cce030bd412..3336cc8691d 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; { diff --git a/gcc/tree.h b/gcc/tree.h index ef95b8e4473..189b7805c16 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1800,6 +1800,7 @@ extern tree rli_size_unit_so_far PARAMS ((record_layout_info)); extern tree rli_size_so_far PARAMS ((record_layout_info)); extern void normalize_rli PARAMS ((record_layout_info)); extern void place_field PARAMS ((record_layout_info, tree)); +extern void compute_record_mode PARAMS ((tree)); extern void finish_record_layout PARAMS ((record_layout_info)); /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),