This moves the location bitpacks to the bitpack pieces and adjust
the weird hooking that is in place currently.

I need to separate tree reference writers from data writers
for some major reorg.

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

Richard.

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

        * lto-streamer-in.c (lto_input_location_bitpack): Rename to ...
        (lto_input_location): ... this.  Kill original.
        (input_eh_region): Adjust.
        (input_struct_function_base): Likewise.
        (lto_read_tree): Likewise.
        * lto-streamer-out.c (lto_output_location_bitpack): Rename to ...
        (lto_output_location): ... this.  Kill original.
        (lto_write_tree): Adjust.
        (output_eh_region): Likewise.
        (output_struct_function_base): Likewise.
        * lto-streamer.c (lto_streamer_hooks_init): Initialize location
        hooks.
        * lto-streamer.h (lto_input_location): Adjust prototype.
        (lto_output_location): Likewise.
        * streamer-hooks.h (struct streamer_hooks): Adjust prototype
        of input_location and output_location hooks.
        (stream_input_location): New define.
        (stream_output_location): Likewise.
        * tree-streamer-in.c (unpack_ts_block_value_fields): Adjust.
        (unpack_value_fields): Likewise.
        (streamer_read_tree_bitfields): Likewise.
        (lto_input_ts_decl_minimal_tree_pointers): Likewise.
        (lto_input_ts_exp_tree_pointers): Likewise.
        (lto_input_ts_block_tree_pointers): Likewise.
        * tree-streamer-out.c (pack_ts_block_value_fields): Adjust.
        (streamer_pack_tree_bitfields): Likewise.
        (write_ts_decl_minimal_tree_pointers): Likewise.
        (write_ts_exp_tree_pointers): Likewise.
        (write_ts_block_tree_pointers): Likewise.
        * gimple-streamer-in.c (input_phi): Adjust.
        (input_gimple_stmt): Likewise.
        * gimple-streamer-out.c (output_phi): Adjust.
        (output_gimple_stmt): Likewise.
        * tree-streamer.h (streamer_read_tree_bitfields): Adjust prototype.
        (streamer_pack_tree_bitfields): Likewise.

Index: trunk/gcc/lto-streamer-in.c
===================================================================
*** trunk.orig/gcc/lto-streamer-in.c    2012-10-10 12:58:53.000000000 +0200
--- trunk/gcc/lto-streamer-in.c 2012-10-10 13:39:44.542642629 +0200
*************** clear_line_info (struct data_in *data_in
*** 138,145 ****
  
  /* Read a location bitpack from input block IB.  */
  
! static location_t
! lto_input_location_bitpack (struct data_in *data_in, struct bitpack_d *bp)
  {
    bool file_change, line_change, column_change;
    unsigned len;
--- 138,145 ----
  
  /* Read a location bitpack from input block IB.  */
  
! location_t
! lto_input_location (struct bitpack_d *bp, struct data_in *data_in)
  {
    bool file_change, line_change, column_change;
    unsigned len;
*************** lto_input_location_bitpack (struct data_
*** 178,203 ****
  }
  
  
- /* Read a location from input block IB.
-    If the input_location streamer hook exists, call it.
-    Otherwise, proceed with reading the location from the
-    expanded location bitpack.  */
- 
- location_t
- lto_input_location (struct lto_input_block *ib, struct data_in *data_in)
- {
-   if (streamer_hooks.input_location)
-     return streamer_hooks.input_location (ib, data_in);
-   else
-     {
-       struct bitpack_d bp;
- 
-       bp = streamer_read_bitpack (ib);
-       return lto_input_location_bitpack (data_in, &bp);
-     }
- }
- 
- 
  /* Read a reference to a tree node from DATA_IN using input block IB.
     TAG is the expected node that should be found in IB, if TAG belongs
     to one of the indexable trees, expect to read a reference index to
--- 178,183 ----
*************** input_eh_region (struct lto_input_block
*** 368,376 ****
        break;
  
        case LTO_ert_must_not_throw:
!       r->type = ERT_MUST_NOT_THROW;
!       r->u.must_not_throw.failure_decl = stream_read_tree (ib, data_in);
!       r->u.must_not_throw.failure_loc = lto_input_location (ib, data_in);
        break;
  
        default:
--- 348,360 ----
        break;
  
        case LTO_ert_must_not_throw:
!       {
!         r->type = ERT_MUST_NOT_THROW;
!         r->u.must_not_throw.failure_decl = stream_read_tree (ib, data_in);
!         bitpack_d bp = streamer_read_bitpack (ib);
!         r->u.must_not_throw.failure_loc
!          = stream_input_location (&bp, data_in);
!       }
        break;
  
        default:
*************** input_struct_function_base (struct funct
*** 786,795 ****
        }
      }
  
-   /* Input the function start and end loci.  */
-   fn->function_start_locus = lto_input_location (ib, data_in);
-   fn->function_end_locus = lto_input_location (ib, data_in);
- 
    /* Input the current IL state of the function.  */
    fn->curr_properties = streamer_read_uhwi (ib);
  
--- 770,775 ----
*************** input_struct_function_base (struct funct
*** 809,814 ****
--- 789,798 ----
    fn->calls_setjmp = bp_unpack_value (&bp, 1);
    fn->va_list_fpr_size = bp_unpack_value (&bp, 8);
    fn->va_list_gpr_size = bp_unpack_value (&bp, 8);
+ 
+   /* Input the function start and end loci.  */
+   fn->function_start_locus = stream_input_location (&bp, data_in);
+   fn->function_end_locus = stream_input_location (&bp, data_in);
  }
  
  
*************** lto_read_tree (struct lto_input_block *i
*** 1041,1047 ****
    /* Read all the bitfield values in RESULT.  Note that for LTO, we
       only write language-independent bitfields, so no more unpacking is
       needed.  */
!   streamer_read_tree_bitfields (ib, result);
  
    /* Read all the pointer fields in RESULT.  */
    streamer_read_tree_body (ib, data_in, result);
--- 1025,1031 ----
    /* Read all the bitfield values in RESULT.  Note that for LTO, we
       only write language-independent bitfields, so no more unpacking is
       needed.  */
!   streamer_read_tree_bitfields (ib, data_in, result);
  
    /* Read all the pointer fields in RESULT.  */
    streamer_read_tree_body (ib, data_in, result);
Index: trunk/gcc/lto-streamer-out.c
===================================================================
*** trunk.orig/gcc/lto-streamer-out.c   2012-10-10 13:00:44.000000000 +0200
--- trunk/gcc/lto-streamer-out.c        2012-10-10 13:38:11.073647731 +0200
*************** tree_is_indexable (tree t)
*** 148,157 ****
     After outputting bitpack, lto_output_location_data has
     to be done to output actual data.  */
  
! static inline void
! lto_output_location_bitpack (struct bitpack_d *bp,
!                            struct output_block *ob,
!                            location_t loc)
  {
    expanded_location xloc;
  
--- 148,156 ----
     After outputting bitpack, lto_output_location_data has
     to be done to output actual data.  */
  
! void
! lto_output_location (struct output_block *ob, struct bitpack_d *bp,
!                    location_t loc)
  {
    expanded_location xloc;
  
*************** lto_output_location_bitpack (struct bitp
*** 182,206 ****
  }
  
  
- /* Emit location LOC to output block OB.
-    If the output_location streamer hook exists, call it.
-    Otherwise, when bitpack is handy, it is more space efficient to call
-    lto_output_location_bitpack with existing bitpack.  */
- 
- void
- lto_output_location (struct output_block *ob, location_t loc)
- {
-   if (streamer_hooks.output_location)
-     streamer_hooks.output_location (ob, loc);
-   else
-     {
-       struct bitpack_d bp = bitpack_create (ob->main_stream);
-       lto_output_location_bitpack (&bp, ob, loc);
-       streamer_write_bitpack (&bp);
-     }
- }
- 
- 
  /* If EXPR is an indexable tree node, output a reference to it to
     output block OB.  Otherwise, output the physical representation of
     EXPR to OB.  */
--- 181,186 ----
*************** lto_write_tree (struct output_block *ob,
*** 333,339 ****
    /* Pack all the non-pointer fields in EXPR into a bitpack and write
       the resulting bitpack.  */
    bp = bitpack_create (ob->main_stream);
!   streamer_pack_tree_bitfields (&bp, expr);
    streamer_write_bitpack (&bp);
  
    /* Write all the pointer fields in EXPR.  */
--- 313,319 ----
    /* Pack all the non-pointer fields in EXPR into a bitpack and write
       the resulting bitpack.  */
    bp = bitpack_create (ob->main_stream);
!   streamer_pack_tree_bitfields (ob, &bp, expr);
    streamer_write_bitpack (&bp);
  
    /* Write all the pointer fields in EXPR.  */
*************** output_eh_region (struct output_block *o
*** 505,511 ****
    else if (r->type == ERT_MUST_NOT_THROW)
      {
        stream_write_tree (ob, r->u.must_not_throw.failure_decl, true);
!       lto_output_location (ob, r->u.must_not_throw.failure_loc);
      }
  
    if (r->landing_pads)
--- 485,493 ----
    else if (r->type == ERT_MUST_NOT_THROW)
      {
        stream_write_tree (ob, r->u.must_not_throw.failure_decl, true);
!       bitpack_d bp = bitpack_create (ob->main_stream);
!       stream_output_location (ob, &bp, r->u.must_not_throw.failure_loc);
!       streamer_write_bitpack (&bp);
      }
  
    if (r->landing_pads)
*************** output_struct_function_base (struct outp
*** 751,760 ****
    FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t)
      stream_write_tree (ob, t, true);
  
-   /* Output the function start and end loci.  */
-   lto_output_location (ob, fn->function_start_locus);
-   lto_output_location (ob, fn->function_end_locus);
- 
    /* Output current IL state of the function.  */
    streamer_write_uhwi (ob, fn->curr_properties);
  
--- 733,738 ----
*************** output_struct_function_base (struct outp
*** 774,779 ****
--- 752,762 ----
    bp_pack_value (&bp, fn->calls_setjmp, 1);
    bp_pack_value (&bp, fn->va_list_fpr_size, 8);
    bp_pack_value (&bp, fn->va_list_gpr_size, 8);
+ 
+   /* Output the function start and end loci.  */
+   stream_output_location (ob, &bp, fn->function_start_locus);
+   stream_output_location (ob, &bp, fn->function_end_locus);
+ 
    streamer_write_bitpack (&bp);
  }
  
Index: trunk/gcc/lto-streamer.c
===================================================================
*** trunk.orig/gcc/lto-streamer.c       2012-10-10 12:58:53.000000000 +0200
--- trunk/gcc/lto-streamer.c    2012-10-10 13:18:55.600716695 +0200
*************** lto_streamer_hooks_init (void)
*** 387,390 ****
--- 387,392 ----
    streamer_hooks_init ();
    streamer_hooks.write_tree = lto_output_tree;
    streamer_hooks.read_tree = lto_input_tree;
+   streamer_hooks.input_location = lto_input_location;
+   streamer_hooks.output_location = lto_output_location;
  }
Index: trunk/gcc/lto-streamer.h
===================================================================
*** trunk.orig/gcc/lto-streamer.h       2012-10-10 12:58:53.000000000 +0200
--- trunk/gcc/lto-streamer.h    2012-10-10 13:20:39.429710541 +0200
*************** extern struct data_in *lto_data_in_creat
*** 809,815 ****
                                    VEC(ld_plugin_symbol_resolution_t,heap) *);
  extern void lto_data_in_delete (struct data_in *);
  extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
! location_t lto_input_location (struct lto_input_block *, struct data_in *);
  tree lto_input_tree_ref (struct lto_input_block *, struct data_in *,
                         struct function *, enum LTO_tags);
  void lto_tag_check_set (enum LTO_tags, int, ...);
--- 809,815 ----
                                    VEC(ld_plugin_symbol_resolution_t,heap) *);
  extern void lto_data_in_delete (struct data_in *);
  extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
! location_t lto_input_location (struct bitpack_d *, struct data_in *);
  tree lto_input_tree_ref (struct lto_input_block *, struct data_in *,
                         struct function *, enum LTO_tags);
  void lto_tag_check_set (enum LTO_tags, int, ...);
*************** void lto_output_decl_state_streams (stru
*** 829,835 ****
  void lto_output_decl_state_refs (struct output_block *,
                                 struct lto_output_stream *,
                                 struct lto_out_decl_state *);
! void lto_output_location (struct output_block *, location_t);
  
  
  /* In lto-cgraph.c  */
--- 829,835 ----
  void lto_output_decl_state_refs (struct output_block *,
                                 struct lto_output_stream *,
                                 struct lto_out_decl_state *);
! void lto_output_location (struct output_block *, struct bitpack_d *, 
location_t);
  
  
  /* In lto-cgraph.c  */
Index: trunk/gcc/streamer-hooks.h
===================================================================
*** trunk.orig/gcc/streamer-hooks.h     2012-10-10 12:58:53.000000000 +0200
--- trunk/gcc/streamer-hooks.h  2012-10-10 13:01:23.711779531 +0200
*************** struct streamer_hooks {
*** 53,67 ****
       tree instantiated from the stream.  */
    tree (*read_tree) (struct lto_input_block *, struct data_in *);
  
!   /* [OPT] Called by lto_input_location to retrieve the source location of the
!      tree currently being read. If this hook returns NULL, lto_input_location
!      defaults to calling lto_input_location_bitpack.  */
!   location_t (*input_location) (struct lto_input_block *, struct data_in *);
! 
!   /* [OPT] Called by lto_output_location to write the source_location of the
!      tree currently being written. If this hook returns NULL,
!      lto_output_location defaults to calling lto_output_location_bitpack.  */
!   void (*output_location) (struct output_block *, location_t);
  };
  
  #define stream_write_tree(OB, EXPR, REF_P) \
--- 53,63 ----
       tree instantiated from the stream.  */
    tree (*read_tree) (struct lto_input_block *, struct data_in *);
  
!   /* [REQ] Called by every streaming routine that needs to read a location.  
*/
!   location_t (*input_location) (struct bitpack_d *, struct data_in *);
! 
!   /* [REQ] Called by every streaming routine that needs to write a location.  
*/
!   void (*output_location) (struct output_block *, struct bitpack_d *, 
location_t);
  };
  
  #define stream_write_tree(OB, EXPR, REF_P) \
*************** struct streamer_hooks {
*** 73,78 ****
--- 69,80 ----
  #define stream_read_tree(IB, DATA_IN) \
      streamer_hooks.read_tree(IB, DATA_IN)
  
+ #define stream_input_location(BP, DATA_IN) \
+     streamer_hooks.input_location(BP, DATA_IN)
+ 
+ #define stream_output_location(OB, BP, LOC) \
+     streamer_hooks.output_location(OB, BP, LOC)
+ 
  /* Streamer hooks.  */
  extern struct streamer_hooks streamer_hooks;
  
Index: trunk/gcc/tree-streamer-in.c
===================================================================
*** trunk.orig/gcc/tree-streamer-in.c   2012-10-10 12:58:53.000000000 +0200
--- trunk/gcc/tree-streamer-in.c        2012-10-10 14:13:32.199521621 +0200
*************** unpack_ts_fixed_cst_value_fields (struct
*** 179,185 ****
    TREE_FIXED_CST_PTR (expr) = fp;
  }
  
- 
  /* Unpack all the non-pointer fields of the TS_DECL_COMMON structure
     of expression EXPR from bitpack BP.  */
  
--- 179,184 ----
*************** unpack_ts_type_common_value_fields (stru
*** 355,364 ****
     of expression EXPR from bitpack BP.  */
  
  static void
! unpack_ts_block_value_fields (struct bitpack_d *bp, tree expr)
  {
    BLOCK_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1);
    /* BLOCK_NUMBER is recomputed.  */
  }
  
  /* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
--- 354,365 ----
     of expression EXPR from bitpack BP.  */
  
  static void
! unpack_ts_block_value_fields (struct data_in *data_in,
!                             struct bitpack_d *bp, tree expr)
  {
    BLOCK_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1);
    /* BLOCK_NUMBER is recomputed.  */
+   BLOCK_SOURCE_LOCATION (expr) = stream_input_location (bp, data_in);
  }
  
  /* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
*************** unpack_ts_translation_unit_decl_value_fi
*** 372,378 ****
  /* Unpack all the non-pointer fields in EXPR into a bit pack.  */
  
  static void
! unpack_value_fields (struct bitpack_d *bp, tree expr)
  {
    enum tree_code code;
  
--- 373,379 ----
  /* Unpack all the non-pointer fields in EXPR into a bit pack.  */
  
  static void
! unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
  {
    enum tree_code code;
  
*************** unpack_value_fields (struct bitpack_d *b
*** 388,393 ****
--- 389,397 ----
    if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST))
      unpack_ts_fixed_cst_value_fields (bp, expr);
  
+   if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL))
+     DECL_SOURCE_LOCATION (expr) = stream_input_location (bp, data_in);
+ 
    if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
      unpack_ts_decl_common_value_fields (bp, expr);
  
*************** unpack_value_fields (struct bitpack_d *b
*** 403,410 ****
    if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
      unpack_ts_type_common_value_fields (bp, expr);
  
    if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
!     unpack_ts_block_value_fields (bp, expr);
  
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      unpack_ts_translation_unit_decl_value_fields (bp, expr);
--- 407,417 ----
    if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
      unpack_ts_type_common_value_fields (bp, expr);
  
+   if (CODE_CONTAINS_STRUCT (code, TS_EXP))
+     SET_EXPR_LOCATION (expr, stream_input_location (bp, data_in));
+ 
    if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
!     unpack_ts_block_value_fields (data_in, bp, expr);
  
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      unpack_ts_translation_unit_decl_value_fields (bp, expr);
*************** unpack_value_fields (struct bitpack_d *b
*** 416,422 ****
     bitfield values that the writer may have written.  */
  
  struct bitpack_d
! streamer_read_tree_bitfields (struct lto_input_block *ib, tree expr)
  {
    enum tree_code code;
    struct bitpack_d bp;
--- 423,430 ----
     bitfield values that the writer may have written.  */
  
  struct bitpack_d
! streamer_read_tree_bitfields (struct lto_input_block *ib,
!                             struct data_in *data_in, tree expr)
  {
    enum tree_code code;
    struct bitpack_d bp;
*************** streamer_read_tree_bitfields (struct lto
*** 431,437 ****
                 lto_tree_code_to_tag (TREE_CODE (expr)));
  
    /* Unpack all the value fields from BP.  */
!   unpack_value_fields (&bp, expr);
  
    return bp;
  }
--- 439,445 ----
                 lto_tree_code_to_tag (TREE_CODE (expr)));
  
    /* Unpack all the value fields from BP.  */
!   unpack_value_fields (data_in, &bp, expr);
  
    return bp;
  }
*************** lto_input_ts_decl_minimal_tree_pointers
*** 563,569 ****
  {
    DECL_NAME (expr) = stream_read_tree (ib, data_in);
    DECL_CONTEXT (expr) = stream_read_tree (ib, data_in);
-   DECL_SOURCE_LOCATION (expr) = lto_input_location (ib, data_in);
  }
  
  
--- 571,576 ----
*************** lto_input_ts_exp_tree_pointers (struct l
*** 770,776 ****
                                struct data_in *data_in, tree expr)
  {
    int i, length;
-   location_t loc;
  
    length = streamer_read_hwi (ib);
    gcc_assert (length == TREE_OPERAND_LENGTH (expr));
--- 777,782 ----
*************** lto_input_ts_exp_tree_pointers (struct l
*** 778,785 ****
    for (i = 0; i < length; i++)
      TREE_OPERAND (expr, i) = stream_read_tree (ib, data_in);
  
-   loc = lto_input_location (ib, data_in);
-   SET_EXPR_LOCATION (expr, loc);
    TREE_SET_BLOCK (expr, stream_read_tree (ib, data_in));
  }
  
--- 784,789 ----
*************** lto_input_ts_block_tree_pointers (struct
*** 801,807 ****
       function scopes.  For the rest them on the floor instead of ICEing in
       dwarf2out.c.  */
    BLOCK_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in);
-   BLOCK_SOURCE_LOCATION (expr) = lto_input_location (ib, data_in);
    /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug 
information
       for early inlined BLOCKs so drop it on the floor instead of ICEing in
       dwarf2out.c.  */
--- 805,810 ----
Index: trunk/gcc/tree-streamer-out.c
===================================================================
*** trunk.orig/gcc/tree-streamer-out.c  2012-10-10 12:58:53.000000000 +0200
--- trunk/gcc/tree-streamer-out.c       2012-10-10 14:27:52.761469718 +0200
*************** pack_ts_fixed_cst_value_fields (struct b
*** 145,151 ****
    bp_pack_var_len_int (bp, fv.data.high);
  }
  
- 
  /* Pack all the non-pointer fields of the TS_DECL_COMMON structure
     of expression EXPR into bitpack BP.  */
  
--- 145,150 ----
*************** pack_ts_type_common_value_fields (struct
*** 299,308 ****
     of expression EXPR into bitpack BP.  */
  
  static void
! pack_ts_block_value_fields (struct bitpack_d *bp, tree expr)
  {
    bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1);
    /* BLOCK_NUMBER is recomputed.  */
  }
  
  /* Pack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL structure
--- 298,315 ----
     of expression EXPR into bitpack BP.  */
  
  static void
! pack_ts_block_value_fields (struct output_block *ob,
!                           struct bitpack_d *bp, tree expr)
  {
    bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1);
    /* BLOCK_NUMBER is recomputed.  */
+   /* Stream BLOCK_SOURCE_LOCATION for the limited cases we can handle - those
+      that represent inlined function scopes.
+      For the rest them on the floor instead of ICEing in dwarf2out.c.  */
+   if (inlined_function_outer_scope_p (expr))
+     stream_output_location (ob, bp, BLOCK_SOURCE_LOCATION (expr));
+   else
+     stream_output_location (ob, bp, UNKNOWN_LOCATION);
  }
  
  /* Pack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL structure
*************** pack_ts_translation_unit_decl_value_fiel
*** 317,323 ****
  /* Pack all the bitfields in EXPR into a bit pack.  */
  
  void
! streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr)
  {
    enum tree_code code;
  
--- 324,331 ----
  /* Pack all the bitfields in EXPR into a bit pack.  */
  
  void
! streamer_pack_tree_bitfields (struct output_block *ob,
!                             struct bitpack_d *bp, tree expr)
  {
    enum tree_code code;
  
*************** streamer_pack_tree_bitfields (struct bit
*** 333,338 ****
--- 341,349 ----
    if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST))
      pack_ts_fixed_cst_value_fields (bp, expr);
  
+   if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL))
+     stream_output_location (ob, bp, DECL_SOURCE_LOCATION (expr));
+ 
    if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
      pack_ts_decl_common_value_fields (bp, expr);
  
*************** streamer_pack_tree_bitfields (struct bit
*** 348,355 ****
    if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
      pack_ts_type_common_value_fields (bp, expr);
  
    if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
!     pack_ts_block_value_fields (bp, expr);
  
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      pack_ts_translation_unit_decl_value_fields (bp, expr);
--- 359,369 ----
    if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
      pack_ts_type_common_value_fields (bp, expr);
  
+   if (CODE_CONTAINS_STRUCT (code, TS_EXP))
+     stream_output_location (ob, bp, EXPR_LOCATION (expr));
+ 
    if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
!     pack_ts_block_value_fields (ob, bp, expr);
  
    if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
      pack_ts_translation_unit_decl_value_fields (bp, expr);
*************** write_ts_decl_minimal_tree_pointers (str
*** 476,482 ****
  {
    stream_write_tree (ob, DECL_NAME (expr), ref_p);
    stream_write_tree (ob, DECL_CONTEXT (expr), ref_p);
-   lto_output_location (ob, LOCATION_LOCUS (DECL_SOURCE_LOCATION (expr)));
  }
  
  
--- 490,495 ----
*************** write_ts_exp_tree_pointers (struct outpu
*** 673,679 ****
    streamer_write_hwi (ob, TREE_OPERAND_LENGTH (expr));
    for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
      stream_write_tree (ob, TREE_OPERAND (expr, i), ref_p);
-   lto_output_location (ob, LOCATION_LOCUS (EXPR_LOCATION (expr)));
    stream_write_tree (ob, TREE_BLOCK (expr), ref_p);
  }
  
--- 686,691 ----
*************** write_ts_block_tree_pointers (struct out
*** 689,709 ****
  
    stream_write_tree (ob, BLOCK_SUPERCONTEXT (expr), ref_p);
  
!   /* Stream BLOCK_ABSTRACT_ORIGIN and BLOCK_SOURCE_LOCATION for
!      the limited cases we can handle - those that represent inlined
!      function scopes.  For the rest them on the floor instead of ICEing in
!      dwarf2out.c.  */
    if (inlined_function_outer_scope_p (expr))
      {
        tree ultimate_origin = block_ultimate_origin (expr);
        stream_write_tree (ob, ultimate_origin, ref_p);
-       lto_output_location (ob, BLOCK_SOURCE_LOCATION (expr));
      }
    else
!     {
!       stream_write_tree (ob, NULL_TREE, ref_p);
!       lto_output_location (ob, UNKNOWN_LOCATION);
!     }
    /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug 
information
       for early inlined BLOCKs so drop it on the floor instead of ICEing in
       dwarf2out.c.  */
--- 701,716 ----
  
    stream_write_tree (ob, BLOCK_SUPERCONTEXT (expr), ref_p);
  
!   /* Stream BLOCK_ABSTRACT_ORIGIN for the limited cases we can handle - those
!      that represent inlined function scopes.
!      For the rest them on the floor instead of ICEing in dwarf2out.c.  */
    if (inlined_function_outer_scope_p (expr))
      {
        tree ultimate_origin = block_ultimate_origin (expr);
        stream_write_tree (ob, ultimate_origin, ref_p);
      }
    else
!     stream_write_tree (ob, NULL_TREE, ref_p);
    /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug 
information
       for early inlined BLOCKs so drop it on the floor instead of ICEing in
       dwarf2out.c.  */
Index: trunk/gcc/gimple-streamer-in.c
===================================================================
*** trunk.orig/gcc/gimple-streamer-in.c 2012-08-20 13:56:21.000000000 +0200
--- trunk/gcc/gimple-streamer-in.c      2012-10-10 13:09:46.772749488 +0200
*************** input_phi (struct lto_input_block *ib, b
*** 53,59 ****
      {
        tree def = stream_read_tree (ib, data_in);
        int src_index = streamer_read_uhwi (ib);
!       location_t arg_loc = lto_input_location (ib, data_in);
        basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
  
        edge e = NULL;
--- 53,60 ----
      {
        tree def = stream_read_tree (ib, data_in);
        int src_index = streamer_read_uhwi (ib);
!       bitpack_d bp = streamer_read_bitpack (ib);
!       location_t arg_loc = stream_input_location (&bp, data_in);
        basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
  
        edge e = NULL;
*************** input_gimple_stmt (struct lto_input_bloc
*** 99,105 ****
    stmt->gsbase.subcode = bp_unpack_var_len_unsigned (&bp);
  
    /* Read location information.  */
!   gimple_set_location (stmt, lto_input_location (ib, data_in));
  
    /* Read lexical block reference.  */
    gimple_set_block (stmt, stream_read_tree (ib, data_in));
--- 100,106 ----
    stmt->gsbase.subcode = bp_unpack_var_len_unsigned (&bp);
  
    /* Read location information.  */
!   gimple_set_location (stmt, stream_input_location (&bp, data_in));
  
    /* Read lexical block reference.  */
    gimple_set_block (stmt, stream_read_tree (ib, data_in));
Index: trunk/gcc/gimple-streamer-out.c
===================================================================
*** trunk.orig/gcc/gimple-streamer-out.c        2012-09-20 13:24:48.000000000 
+0200
--- trunk/gcc/gimple-streamer-out.c     2012-10-10 13:09:33.310750325 +0200
*************** output_phi (struct output_block *ob, gim
*** 43,49 ****
      {
        stream_write_tree (ob, gimple_phi_arg_def (phi, i), true);
        streamer_write_uhwi (ob, gimple_phi_arg_edge (phi, i)->src->index);
!       lto_output_location (ob, gimple_phi_arg_location (phi, i));
      }
  }
  
--- 43,51 ----
      {
        stream_write_tree (ob, gimple_phi_arg_def (phi, i), true);
        streamer_write_uhwi (ob, gimple_phi_arg_edge (phi, i)->src->index);
!       bitpack_d bp = bitpack_create (ob->main_stream);
!       stream_output_location (ob, &bp, gimple_phi_arg_location (phi, i));
!       streamer_write_bitpack (&bp);
      }
  }
  
*************** output_gimple_stmt (struct output_block
*** 71,80 ****
      bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
    bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
    bp_pack_var_len_unsigned (&bp, stmt->gsbase.subcode);
-   streamer_write_bitpack (&bp);
  
    /* Emit location information for the statement.  */
!   lto_output_location (ob, LOCATION_LOCUS (gimple_location (stmt)));
  
    /* Emit the lexical block holding STMT.  */
    stream_write_tree (ob, gimple_block (stmt), true);
--- 73,82 ----
      bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
    bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
    bp_pack_var_len_unsigned (&bp, stmt->gsbase.subcode);
  
    /* Emit location information for the statement.  */
!   stream_output_location (ob, &bp, LOCATION_LOCUS (gimple_location (stmt)));
!   streamer_write_bitpack (&bp);
  
    /* Emit the lexical block holding STMT.  */
    stream_write_tree (ob, gimple_block (stmt), true);
Index: trunk/gcc/tree-streamer.h
===================================================================
*** trunk.orig/gcc/tree-streamer.h      2012-10-10 13:01:19.000000000 +0200
--- trunk/gcc/tree-streamer.h   2012-10-10 14:54:37.837373887 +0200
*************** void streamer_read_tree_body (struct lto
*** 72,85 ****
  tree streamer_get_pickled_tree (struct lto_input_block *, struct data_in *);
  tree streamer_get_builtin_tree (struct lto_input_block *, struct data_in *);
  tree streamer_read_integer_cst (struct lto_input_block *, struct data_in *);
! struct bitpack_d streamer_read_tree_bitfields (struct lto_input_block *, 
tree);
  
  /* In tree-streamer-out.c.  */
  void streamer_write_string_cst (struct output_block *,
                                struct lto_output_stream *, tree);
  void streamer_write_chain (struct output_block *, tree, bool);
  void streamer_write_tree_header (struct output_block *, tree);
! void streamer_pack_tree_bitfields (struct bitpack_d *, tree);
  void streamer_write_tree_body (struct output_block *, tree, bool);
  void streamer_write_integer_cst (struct output_block *, tree, bool);
  void streamer_write_builtin (struct output_block *, tree);
--- 72,87 ----
  tree streamer_get_pickled_tree (struct lto_input_block *, struct data_in *);
  tree streamer_get_builtin_tree (struct lto_input_block *, struct data_in *);
  tree streamer_read_integer_cst (struct lto_input_block *, struct data_in *);
! struct bitpack_d streamer_read_tree_bitfields (struct lto_input_block *,
!                                              struct data_in *, tree);
  
  /* In tree-streamer-out.c.  */
  void streamer_write_string_cst (struct output_block *,
                                struct lto_output_stream *, tree);
  void streamer_write_chain (struct output_block *, tree, bool);
  void streamer_write_tree_header (struct output_block *, tree);
! void streamer_pack_tree_bitfields (struct output_block *, struct bitpack_d *,
!                                  tree);
  void streamer_write_tree_body (struct output_block *, tree, bool);
  void streamer_write_integer_cst (struct output_block *, tree, bool);
  void streamer_write_builtin (struct output_block *, tree);

Reply via email to