(store_constructor_field): Add explanatory comment.
authorJim Wilson <wilson@gcc.gnu.org>
Fri, 8 Mar 1996 21:52:23 +0000 (13:52 -0800)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 8 Mar 1996 21:52:23 +0000 (13:52 -0800)
Call store_field if bitpos is nonzero and target is not a MEM.

From-SVN: r11503

gcc/expr.c

index 890946c51b79745f9f3831179a13224b45d9efa6..f4e2444c4cb5eb3a4eadf9fbf5b1b9b44dd94f5b 100644 (file)
@@ -3261,7 +3261,12 @@ mostly_zeros_p (exp)
 /* Helper function for store_constructor.
    TARGET, BITSIZE, BITPOS, MODE, EXP are as for store_field.
    TYPE is the type of the CONSTRUCTOR, not the element type.
-   CLEARED is as for store_constructor.  */
+   CLEARED is as for store_constructor.
+
+   This provides a recursive shortcut back to store_constructor when it isn't
+   necessary to go through store_field.  This is so that we can pass through
+   the cleared field to let store_constructor know that we may not have to
+   clear a substructure if the outer structure has already been cleared.  */
 
 static void
 store_constructor_field (target, bitsize, bitpos,
@@ -3273,7 +3278,11 @@ store_constructor_field (target, bitsize, bitpos,
      int cleared;
 {
   if (TREE_CODE (exp) == CONSTRUCTOR
-      && (bitpos % BITS_PER_UNIT) == 0)
+      && bitpos % BITS_PER_UNIT == 0
+      /* If we have a non-zero bitpos for a register target, then we just
+        let store_field do the bitfield handling.  This is unlikely to
+        generate unnecessary clear instructions anyways.  */
+      && (bitpos == 0 || GET_CODE (target) == MEM))
     {
       if (bitpos != 0)
        target = change_address (target, VOIDmode,