OSDN Git Service

* stor-layout.c (finalize_record_size): Simplify to use existing
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Apr 2000 12:15:25 +0000 (12:15 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Apr 2000 12:15:25 +0000 (12:15 +0000)
functions.
(compute_record_mode): No longer static.
* tree.h (compute_record_mode): New declaration.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33412 138bc75d-0d04-0410-961f-82ee72b054a4

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

index a09d530..3022208 100644 (file)
@@ -1,3 +1,10 @@
+Tue Apr 25 07:33:12 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * 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  <NeilB@earthling.net>
 
        * 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  <rth@cygnus.com>
-
        * toplev.c (rest_of_compilation): Delay sibcall optimization
        until after emit_eh_context.
 
index cce030b..3336cc8 100644 (file)
@@ -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));
 \f
@@ -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;
 {
index ef95b8e..189b780 100644 (file)
@@ -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),