This moves the target and optimize data to the bitfield blob as
appropriate.

LTO bootstrapped and tested on x86_64-unknown-linux-gnu.

Richard.

2012-10-12  Richard Biener  <rguent...@suse.de>

        * tree-streamer-out.c (pack_ts_target_option): Rename from ...
        (write_ts_target_option): ... this.
        (pack_ts_optimization): Rename from ...
        (write_ts_optimization): ... this.
        (streamer_pack_tree_bitfields): Pack them in the bitfield section ...
        (streamer_write_tree_body): ... not here.
        * tree-streamer-in.c (unpack_ts_target_option): Rename from ...
        (lto_input_ts_target_option): ... this.
        (unpack_ts_optimization): Rename from ...
        (lto_input_ts_optimization): ... this.
        (unpack_value_fields): Unpack them from the bitfield section ...
        (streamer_read_tree_body): ... not from here.

Index: gcc/tree-streamer-out.c
===================================================================
*** gcc/tree-streamer-out.c     (revision 192392)
--- gcc/tree-streamer-out.c     (working copy)
*************** pack_ts_translation_unit_decl_value_fiel
*** 320,325 ****
--- 320,361 ----
  {
  }
  
+ /* Pack a TS_TARGET_OPTION tree in EXPR to BP.  */
+ 
+ static void
+ pack_ts_target_option (struct bitpack_d *bp, tree expr)
+ {
+   struct cl_target_option *t = TREE_TARGET_OPTION (expr);
+   unsigned i, len;
+ 
+   /* The cl_target_option is target specific and generated by the options
+      awk script, so we just recreate a byte-by-byte copy here. */
+ 
+   len = sizeof (struct cl_target_option);
+   for (i = 0; i < len; i++)
+     bp_pack_value (bp, ((unsigned char *)t)[i], 8);
+   /* Catch struct size mismatches between reader and writer. */
+   bp_pack_value (bp, 0x12345678, 32);
+ }
+ 
+ /* Pack a TS_OPTIMIZATION tree in EXPR to BP.  */
+ 
+ static void
+ pack_ts_optimization (struct bitpack_d *bp, tree expr)
+ {
+   struct cl_optimization *t = TREE_OPTIMIZATION (expr);
+   unsigned i, len;
+ 
+   /* The cl_optimization is generated by the options
+      awk script, so we just recreate a byte-by-byte copy here. */
+ 
+   len = sizeof (struct cl_optimization);
+   for (i = 0; i < len; i++)
+     bp_pack_value (bp, ((unsigned char *)t)[i], 8);
+   /* Catch struct size mismatches between reader and writer. */
+   bp_pack_value (bp, 0x12345678, 32);
+ }
+ 
  
  /* Pack all the bitfields in EXPR into a bit pack.  */
  
*************** streamer_pack_tree_bitfields (struct out
*** 367,372 ****
--- 403,414 ----
  
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      pack_ts_translation_unit_decl_value_fields (bp, expr);
+ 
+   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
+     pack_ts_target_option (bp, expr);
+ 
+   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
+     pack_ts_optimization (bp, expr);
  }
  
  
*************** write_ts_constructor_tree_pointers (stru
*** 773,820 ****
      }
  }
  
- /* Write a TS_TARGET_OPTION tree in EXPR to OB.  */
- 
- static void
- write_ts_target_option (struct output_block *ob, tree expr)
- {
-   struct cl_target_option *t = TREE_TARGET_OPTION (expr);
-   struct bitpack_d bp;
-   unsigned i, len;
- 
-   /* The cl_target_option is target specific and generated by the options
-      awk script, so we just recreate a byte-by-byte copy here. */
- 
-   bp = bitpack_create (ob->main_stream);
-   len = sizeof (struct cl_target_option);
-   for (i = 0; i < len; i++)
-     bp_pack_value (&bp, ((unsigned char *)t)[i], 8);
-   /* Catch struct size mismatches between reader and writer. */
-   bp_pack_value (&bp, 0x12345678, 32);
-   streamer_write_bitpack (&bp);
- }
- 
- /* Write a TS_OPTIMIZATION tree in EXPR to OB.  */
- 
- static void
- write_ts_optimization (struct output_block *ob, tree expr)
- {
-   struct cl_optimization *t = TREE_OPTIMIZATION (expr);
-   struct bitpack_d bp;
-   unsigned i, len;
- 
-   /* The cl_optimization is generated by the options
-      awk script, so we just recreate a byte-by-byte copy here. */
- 
-   bp = bitpack_create (ob->main_stream);
-   len = sizeof (struct cl_optimization);
-   for (i = 0; i < len; i++)
-     bp_pack_value (&bp, ((unsigned char *)t)[i], 8);
-   /* Catch struct size mismatches between reader and writer. */
-   bp_pack_value (&bp, 0x12345678, 32);
-   streamer_write_bitpack (&bp);
- }
- 
  /* Write a TS_TRANSLATION_UNIT_DECL tree in EXPR to OB.  */
  
  static void
--- 816,821 ----
*************** streamer_write_tree_body (struct output_
*** 886,897 ****
    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
      write_ts_constructor_tree_pointers (ob, expr, ref_p);
  
-   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-     write_ts_target_option (ob, expr);
- 
-   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
-     write_ts_optimization (ob, expr);
- 
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      write_ts_translation_unit_decl_tree_pointers (ob, expr);
  }
--- 887,892 ----
Index: gcc/tree-streamer-in.c
===================================================================
*** gcc/tree-streamer-in.c      (revision 192392)
--- gcc/tree-streamer-in.c      (working copy)
*************** unpack_ts_translation_unit_decl_value_fi
*** 370,375 ****
--- 370,406 ----
  {
  }
  
+ /* Unpack a TS_TARGET_OPTION tree from BP into EXPR.  */
+ 
+ static void
+ unpack_ts_target_option (struct bitpack_d *bp, tree expr)
+ {
+   unsigned i, len;
+   struct cl_target_option *t = TREE_TARGET_OPTION (expr);
+ 
+   len = sizeof (struct cl_target_option);
+   for (i = 0; i < len; i++)
+     ((unsigned char *)t)[i] = bp_unpack_value (bp, 8);
+   if (bp_unpack_value (bp, 32) != 0x12345678)
+     fatal_error ("cl_target_option size mismatch in LTO reader and writer");
+ }
+ 
+ /* Unpack a TS_OPTIMIZATION tree from BP into EXPR.  */
+ 
+ static void
+ unpack_ts_optimization (struct bitpack_d *bp, tree expr)
+ {
+   unsigned i, len;
+   struct cl_optimization *t = TREE_OPTIMIZATION (expr);
+ 
+   len = sizeof (struct cl_optimization);
+   for (i = 0; i < len; i++)
+     ((unsigned char *)t)[i] = bp_unpack_value (bp, 8);
+   if (bp_unpack_value (bp, 32) != 0x12345678)
+     fatal_error ("cl_optimization size mismatch in LTO reader and writer");
+ }
+ 
+ 
  /* Unpack all the non-pointer fields in EXPR into a bit pack.  */
  
  static void
*************** unpack_value_fields (struct data_in *dat
*** 415,420 ****
--- 446,457 ----
  
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      unpack_ts_translation_unit_decl_value_fields (bp, expr);
+ 
+   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
+     unpack_ts_target_option (bp, expr);
+ 
+   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
+     unpack_ts_optimization (bp, expr);
  }
  
  
*************** lto_input_ts_constructor_tree_pointers (
*** 900,939 ****
  }
  
  
- /* Input a TS_TARGET_OPTION tree from IB into EXPR.  */
- 
- static void
- lto_input_ts_target_option (struct lto_input_block *ib, tree expr)
- {
-   unsigned i, len;
-   struct bitpack_d bp;
-   struct cl_target_option *t = TREE_TARGET_OPTION (expr);
- 
-   bp = streamer_read_bitpack (ib);
-   len = sizeof (struct cl_target_option);
-   for (i = 0; i < len; i++)
-     ((unsigned char *)t)[i] = bp_unpack_value (&bp, 8);
-   if (bp_unpack_value (&bp, 32) != 0x12345678)
-     fatal_error ("cl_target_option size mismatch in LTO reader and writer");
- }
- 
- /* Input a TS_OPTIMIZATION tree from IB into EXPR.  */
- 
- static void
- lto_input_ts_optimization (struct lto_input_block *ib, tree expr)
- {
-   unsigned i, len;
-   struct bitpack_d bp;
-   struct cl_optimization *t = TREE_OPTIMIZATION (expr);
- 
-   bp = streamer_read_bitpack (ib);
-   len = sizeof (struct cl_optimization);
-   for (i = 0; i < len; i++)
-     ((unsigned char *)t)[i] = bp_unpack_value (&bp, 8);
-   if (bp_unpack_value (&bp, 32) != 0x12345678)
-     fatal_error ("cl_optimization size mismatch in LTO reader and writer");
- }
- 
  /* Input a TS_TRANSLATION_UNIT_DECL tree from IB and DATA_IN into EXPR.  */
  
  static void
--- 938,943 ----
*************** streamer_read_tree_body (struct lto_inpu
*** 1007,1018 ****
    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
      lto_input_ts_constructor_tree_pointers (ib, data_in, expr);
  
-   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-     lto_input_ts_target_option (ib, expr);
- 
-   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
-     lto_input_ts_optimization (ib, expr);
- 
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      lto_input_ts_translation_unit_decl_tree_pointers (ib, data_in, expr);
  }
--- 1011,1016 ----

Reply via email to