Commit 7cb7d208 by Richard Biener Committed by Richard Biener

lto-streamer-in.c (lto_input_location_bitpack): Rename to ...

2012-10-10  Richard Biener  <rguenther@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.

From-SVN: r192317
parent 8fc5b387
2012-10-10 Richard Biener <rguenther@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.
2012-10-10 Michael Meissner <meissner@linux.vnet.ibm.com> 2012-10-10 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/rs6000.c (altivec_expand_dst_builtin): Fix signed * config/rs6000/rs6000.c (altivec_expand_dst_builtin): Fix signed
......
...@@ -53,7 +53,8 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in, ...@@ -53,7 +53,8 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
{ {
tree def = stream_read_tree (ib, data_in); tree def = stream_read_tree (ib, data_in);
int src_index = streamer_read_uhwi (ib); int src_index = streamer_read_uhwi (ib);
location_t arg_loc = lto_input_location (ib, data_in); 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); basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
edge e = NULL; edge e = NULL;
...@@ -99,7 +100,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, ...@@ -99,7 +100,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
stmt->gsbase.subcode = bp_unpack_var_len_unsigned (&bp); stmt->gsbase.subcode = bp_unpack_var_len_unsigned (&bp);
/* Read location information. */ /* Read location information. */
gimple_set_location (stmt, lto_input_location (ib, data_in)); gimple_set_location (stmt, stream_input_location (&bp, data_in));
/* Read lexical block reference. */ /* Read lexical block reference. */
gimple_set_block (stmt, stream_read_tree (ib, data_in)); gimple_set_block (stmt, stream_read_tree (ib, data_in));
......
...@@ -43,7 +43,9 @@ output_phi (struct output_block *ob, gimple phi) ...@@ -43,7 +43,9 @@ output_phi (struct output_block *ob, gimple phi)
{ {
stream_write_tree (ob, gimple_phi_arg_def (phi, i), true); stream_write_tree (ob, gimple_phi_arg_def (phi, i), true);
streamer_write_uhwi (ob, gimple_phi_arg_edge (phi, i)->src->index); streamer_write_uhwi (ob, gimple_phi_arg_edge (phi, i)->src->index);
lto_output_location (ob, gimple_phi_arg_location (phi, i)); bitpack_d bp = bitpack_create (ob->main_stream);
stream_output_location (ob, &bp, gimple_phi_arg_location (phi, i));
streamer_write_bitpack (&bp);
} }
} }
...@@ -71,10 +73,10 @@ output_gimple_stmt (struct output_block *ob, gimple stmt) ...@@ -71,10 +73,10 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1); bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1); bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
bp_pack_var_len_unsigned (&bp, stmt->gsbase.subcode); bp_pack_var_len_unsigned (&bp, stmt->gsbase.subcode);
streamer_write_bitpack (&bp);
/* Emit location information for the statement. */ /* Emit location information for the statement. */
lto_output_location (ob, LOCATION_LOCUS (gimple_location (stmt))); stream_output_location (ob, &bp, LOCATION_LOCUS (gimple_location (stmt)));
streamer_write_bitpack (&bp);
/* Emit the lexical block holding STMT. */ /* Emit the lexical block holding STMT. */
stream_write_tree (ob, gimple_block (stmt), true); stream_write_tree (ob, gimple_block (stmt), true);
......
...@@ -138,8 +138,8 @@ clear_line_info (struct data_in *data_in) ...@@ -138,8 +138,8 @@ clear_line_info (struct data_in *data_in)
/* Read a location bitpack from input block IB. */ /* Read a location bitpack from input block IB. */
static location_t location_t
lto_input_location_bitpack (struct data_in *data_in, struct bitpack_d *bp) lto_input_location (struct bitpack_d *bp, struct data_in *data_in)
{ {
bool file_change, line_change, column_change; bool file_change, line_change, column_change;
unsigned len; unsigned len;
...@@ -178,26 +178,6 @@ lto_input_location_bitpack (struct data_in *data_in, struct bitpack_d *bp) ...@@ -178,26 +178,6 @@ lto_input_location_bitpack (struct data_in *data_in, struct bitpack_d *bp)
} }
/* 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. /* 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 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 to one of the indexable trees, expect to read a reference index to
...@@ -368,9 +348,13 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix) ...@@ -368,9 +348,13 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
break; break;
case LTO_ert_must_not_throw: 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->type = ERT_MUST_NOT_THROW;
r->u.must_not_throw.failure_loc = lto_input_location (ib, data_in); 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; break;
default: default:
...@@ -786,10 +770,6 @@ input_struct_function_base (struct function *fn, struct data_in *data_in, ...@@ -786,10 +770,6 @@ input_struct_function_base (struct function *fn, struct data_in *data_in,
} }
} }
/* 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. */ /* Input the current IL state of the function. */
fn->curr_properties = streamer_read_uhwi (ib); fn->curr_properties = streamer_read_uhwi (ib);
...@@ -809,6 +789,10 @@ input_struct_function_base (struct function *fn, struct data_in *data_in, ...@@ -809,6 +789,10 @@ input_struct_function_base (struct function *fn, struct data_in *data_in,
fn->calls_setjmp = bp_unpack_value (&bp, 1); fn->calls_setjmp = bp_unpack_value (&bp, 1);
fn->va_list_fpr_size = bp_unpack_value (&bp, 8); fn->va_list_fpr_size = bp_unpack_value (&bp, 8);
fn->va_list_gpr_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);
} }
...@@ -1041,7 +1025,7 @@ lto_read_tree (struct lto_input_block *ib, struct data_in *data_in, ...@@ -1041,7 +1025,7 @@ lto_read_tree (struct lto_input_block *ib, struct data_in *data_in,
/* Read all the bitfield values in RESULT. Note that for LTO, we /* Read all the bitfield values in RESULT. Note that for LTO, we
only write language-independent bitfields, so no more unpacking is only write language-independent bitfields, so no more unpacking is
needed. */ needed. */
streamer_read_tree_bitfields (ib, result); streamer_read_tree_bitfields (ib, data_in, result);
/* Read all the pointer fields in RESULT. */ /* Read all the pointer fields in RESULT. */
streamer_read_tree_body (ib, data_in, result); streamer_read_tree_body (ib, data_in, result);
......
...@@ -148,10 +148,9 @@ tree_is_indexable (tree t) ...@@ -148,10 +148,9 @@ tree_is_indexable (tree t)
After outputting bitpack, lto_output_location_data has After outputting bitpack, lto_output_location_data has
to be done to output actual data. */ to be done to output actual data. */
static inline void void
lto_output_location_bitpack (struct bitpack_d *bp, lto_output_location (struct output_block *ob, struct bitpack_d *bp,
struct output_block *ob, location_t loc)
location_t loc)
{ {
expanded_location xloc; expanded_location xloc;
...@@ -182,25 +181,6 @@ lto_output_location_bitpack (struct bitpack_d *bp, ...@@ -182,25 +181,6 @@ lto_output_location_bitpack (struct bitpack_d *bp,
} }
/* 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 /* If EXPR is an indexable tree node, output a reference to it to
output block OB. Otherwise, output the physical representation of output block OB. Otherwise, output the physical representation of
EXPR to OB. */ EXPR to OB. */
...@@ -333,7 +313,7 @@ lto_write_tree (struct output_block *ob, tree expr, bool ref_p) ...@@ -333,7 +313,7 @@ lto_write_tree (struct output_block *ob, tree expr, bool ref_p)
/* Pack all the non-pointer fields in EXPR into a bitpack and write /* Pack all the non-pointer fields in EXPR into a bitpack and write
the resulting bitpack. */ the resulting bitpack. */
bp = bitpack_create (ob->main_stream); bp = bitpack_create (ob->main_stream);
streamer_pack_tree_bitfields (&bp, expr); streamer_pack_tree_bitfields (ob, &bp, expr);
streamer_write_bitpack (&bp); streamer_write_bitpack (&bp);
/* Write all the pointer fields in EXPR. */ /* Write all the pointer fields in EXPR. */
...@@ -505,7 +485,9 @@ output_eh_region (struct output_block *ob, eh_region r) ...@@ -505,7 +485,9 @@ output_eh_region (struct output_block *ob, eh_region r)
else if (r->type == ERT_MUST_NOT_THROW) else if (r->type == ERT_MUST_NOT_THROW)
{ {
stream_write_tree (ob, r->u.must_not_throw.failure_decl, true); stream_write_tree (ob, r->u.must_not_throw.failure_decl, true);
lto_output_location (ob, r->u.must_not_throw.failure_loc); 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) if (r->landing_pads)
...@@ -751,10 +733,6 @@ output_struct_function_base (struct output_block *ob, struct function *fn) ...@@ -751,10 +733,6 @@ output_struct_function_base (struct output_block *ob, struct function *fn)
FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t) FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t)
stream_write_tree (ob, t, true); 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. */ /* Output current IL state of the function. */
streamer_write_uhwi (ob, fn->curr_properties); streamer_write_uhwi (ob, fn->curr_properties);
...@@ -774,6 +752,11 @@ output_struct_function_base (struct output_block *ob, struct function *fn) ...@@ -774,6 +752,11 @@ output_struct_function_base (struct output_block *ob, struct function *fn)
bp_pack_value (&bp, fn->calls_setjmp, 1); 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_fpr_size, 8);
bp_pack_value (&bp, fn->va_list_gpr_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); streamer_write_bitpack (&bp);
} }
......
...@@ -387,4 +387,6 @@ lto_streamer_hooks_init (void) ...@@ -387,4 +387,6 @@ lto_streamer_hooks_init (void)
streamer_hooks_init (); streamer_hooks_init ();
streamer_hooks.write_tree = lto_output_tree; streamer_hooks.write_tree = lto_output_tree;
streamer_hooks.read_tree = lto_input_tree; streamer_hooks.read_tree = lto_input_tree;
streamer_hooks.input_location = lto_input_location;
streamer_hooks.output_location = lto_output_location;
} }
...@@ -809,7 +809,7 @@ extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, ...@@ -809,7 +809,7 @@ extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
VEC(ld_plugin_symbol_resolution_t,heap) *); VEC(ld_plugin_symbol_resolution_t,heap) *);
extern void lto_data_in_delete (struct data_in *); extern void lto_data_in_delete (struct data_in *);
extern void lto_input_data_block (struct lto_input_block *, void *, size_t); 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 *); location_t lto_input_location (struct bitpack_d *, struct data_in *);
tree lto_input_tree_ref (struct lto_input_block *, struct data_in *, tree lto_input_tree_ref (struct lto_input_block *, struct data_in *,
struct function *, enum LTO_tags); struct function *, enum LTO_tags);
void lto_tag_check_set (enum LTO_tags, int, ...); void lto_tag_check_set (enum LTO_tags, int, ...);
...@@ -829,7 +829,7 @@ void lto_output_decl_state_streams (struct output_block *, ...@@ -829,7 +829,7 @@ void lto_output_decl_state_streams (struct output_block *,
void lto_output_decl_state_refs (struct output_block *, void lto_output_decl_state_refs (struct output_block *,
struct lto_output_stream *, struct lto_output_stream *,
struct lto_out_decl_state *); struct lto_out_decl_state *);
void lto_output_location (struct output_block *, location_t); void lto_output_location (struct output_block *, struct bitpack_d *, location_t);
/* In lto-cgraph.c */ /* In lto-cgraph.c */
......
...@@ -53,15 +53,11 @@ struct streamer_hooks { ...@@ -53,15 +53,11 @@ struct streamer_hooks {
tree instantiated from the stream. */ tree instantiated from the stream. */
tree (*read_tree) (struct lto_input_block *, struct data_in *); tree (*read_tree) (struct lto_input_block *, struct data_in *);
/* [OPT] Called by lto_input_location to retrieve the source location of the /* [REQ] Called by every streaming routine that needs to read a location. */
tree currently being read. If this hook returns NULL, lto_input_location location_t (*input_location) (struct bitpack_d *, struct data_in *);
defaults to calling lto_input_location_bitpack. */
location_t (*input_location) (struct lto_input_block *, 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);
/* [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) \ #define stream_write_tree(OB, EXPR, REF_P) \
...@@ -73,6 +69,12 @@ struct streamer_hooks { ...@@ -73,6 +69,12 @@ struct streamer_hooks {
#define stream_read_tree(IB, DATA_IN) \ #define stream_read_tree(IB, DATA_IN) \
streamer_hooks.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. */ /* Streamer hooks. */
extern struct streamer_hooks streamer_hooks; extern struct streamer_hooks streamer_hooks;
......
...@@ -179,7 +179,6 @@ unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) ...@@ -179,7 +179,6 @@ unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr)
TREE_FIXED_CST_PTR (expr) = fp; TREE_FIXED_CST_PTR (expr) = fp;
} }
/* Unpack all the non-pointer fields of the TS_DECL_COMMON structure /* Unpack all the non-pointer fields of the TS_DECL_COMMON structure
of expression EXPR from bitpack BP. */ of expression EXPR from bitpack BP. */
...@@ -355,10 +354,12 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) ...@@ -355,10 +354,12 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
of expression EXPR from bitpack BP. */ of expression EXPR from bitpack BP. */
static void static void
unpack_ts_block_value_fields (struct bitpack_d *bp, tree expr) 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_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1);
/* BLOCK_NUMBER is recomputed. */ /* 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 all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
...@@ -372,7 +373,7 @@ unpack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNU ...@@ -372,7 +373,7 @@ unpack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNU
/* Unpack all the non-pointer fields in EXPR into a bit pack. */ /* Unpack all the non-pointer fields in EXPR into a bit pack. */
static void static void
unpack_value_fields (struct bitpack_d *bp, tree expr) unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
{ {
enum tree_code code; enum tree_code code;
...@@ -388,6 +389,9 @@ unpack_value_fields (struct bitpack_d *bp, tree expr) ...@@ -388,6 +389,9 @@ unpack_value_fields (struct bitpack_d *bp, tree expr)
if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST)) if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST))
unpack_ts_fixed_cst_value_fields (bp, expr); 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)) if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
unpack_ts_decl_common_value_fields (bp, expr); unpack_ts_decl_common_value_fields (bp, expr);
...@@ -403,8 +407,11 @@ unpack_value_fields (struct bitpack_d *bp, tree expr) ...@@ -403,8 +407,11 @@ unpack_value_fields (struct bitpack_d *bp, tree expr)
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON)) if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
unpack_ts_type_common_value_fields (bp, expr); 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)) if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
unpack_ts_block_value_fields (bp, expr); unpack_ts_block_value_fields (data_in, bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL)) if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
unpack_ts_translation_unit_decl_value_fields (bp, expr); unpack_ts_translation_unit_decl_value_fields (bp, expr);
...@@ -416,7 +423,8 @@ unpack_value_fields (struct bitpack_d *bp, tree expr) ...@@ -416,7 +423,8 @@ unpack_value_fields (struct bitpack_d *bp, tree expr)
bitfield values that the writer may have written. */ bitfield values that the writer may have written. */
struct bitpack_d struct bitpack_d
streamer_read_tree_bitfields (struct lto_input_block *ib, tree expr) streamer_read_tree_bitfields (struct lto_input_block *ib,
struct data_in *data_in, tree expr)
{ {
enum tree_code code; enum tree_code code;
struct bitpack_d bp; struct bitpack_d bp;
...@@ -431,7 +439,7 @@ streamer_read_tree_bitfields (struct lto_input_block *ib, tree expr) ...@@ -431,7 +439,7 @@ streamer_read_tree_bitfields (struct lto_input_block *ib, tree expr)
lto_tree_code_to_tag (TREE_CODE (expr))); lto_tree_code_to_tag (TREE_CODE (expr)));
/* Unpack all the value fields from BP. */ /* Unpack all the value fields from BP. */
unpack_value_fields (&bp, expr); unpack_value_fields (data_in, &bp, expr);
return bp; return bp;
} }
...@@ -563,7 +571,6 @@ lto_input_ts_decl_minimal_tree_pointers (struct lto_input_block *ib, ...@@ -563,7 +571,6 @@ lto_input_ts_decl_minimal_tree_pointers (struct lto_input_block *ib,
{ {
DECL_NAME (expr) = stream_read_tree (ib, data_in); DECL_NAME (expr) = stream_read_tree (ib, data_in);
DECL_CONTEXT (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);
} }
...@@ -770,7 +777,6 @@ lto_input_ts_exp_tree_pointers (struct lto_input_block *ib, ...@@ -770,7 +777,6 @@ lto_input_ts_exp_tree_pointers (struct lto_input_block *ib,
struct data_in *data_in, tree expr) struct data_in *data_in, tree expr)
{ {
int i, length; int i, length;
location_t loc;
length = streamer_read_hwi (ib); length = streamer_read_hwi (ib);
gcc_assert (length == TREE_OPERAND_LENGTH (expr)); gcc_assert (length == TREE_OPERAND_LENGTH (expr));
...@@ -778,8 +784,6 @@ lto_input_ts_exp_tree_pointers (struct lto_input_block *ib, ...@@ -778,8 +784,6 @@ lto_input_ts_exp_tree_pointers (struct lto_input_block *ib,
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
TREE_OPERAND (expr, i) = stream_read_tree (ib, data_in); 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)); TREE_SET_BLOCK (expr, stream_read_tree (ib, data_in));
} }
...@@ -801,7 +805,6 @@ lto_input_ts_block_tree_pointers (struct lto_input_block *ib, ...@@ -801,7 +805,6 @@ lto_input_ts_block_tree_pointers (struct lto_input_block *ib,
function scopes. For the rest them on the floor instead of ICEing in function scopes. For the rest them on the floor instead of ICEing in
dwarf2out.c. */ dwarf2out.c. */
BLOCK_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in); 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 /* 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 for early inlined BLOCKs so drop it on the floor instead of ICEing in
dwarf2out.c. */ dwarf2out.c. */
......
...@@ -145,7 +145,6 @@ pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) ...@@ -145,7 +145,6 @@ pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_var_len_int (bp, fv.data.high); bp_pack_var_len_int (bp, fv.data.high);
} }
/* Pack all the non-pointer fields of the TS_DECL_COMMON structure /* Pack all the non-pointer fields of the TS_DECL_COMMON structure
of expression EXPR into bitpack BP. */ of expression EXPR into bitpack BP. */
...@@ -299,10 +298,18 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) ...@@ -299,10 +298,18 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
of expression EXPR into bitpack BP. */ of expression EXPR into bitpack BP. */
static void static void
pack_ts_block_value_fields (struct bitpack_d *bp, tree expr) pack_ts_block_value_fields (struct output_block *ob,
struct bitpack_d *bp, tree expr)
{ {
bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1); bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1);
/* BLOCK_NUMBER is recomputed. */ /* 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 all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL structure
...@@ -317,7 +324,8 @@ pack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSE ...@@ -317,7 +324,8 @@ pack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSE
/* Pack all the bitfields in EXPR into a bit pack. */ /* Pack all the bitfields in EXPR into a bit pack. */
void void
streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr) streamer_pack_tree_bitfields (struct output_block *ob,
struct bitpack_d *bp, tree expr)
{ {
enum tree_code code; enum tree_code code;
...@@ -333,6 +341,9 @@ streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr) ...@@ -333,6 +341,9 @@ streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr)
if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST)) if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST))
pack_ts_fixed_cst_value_fields (bp, expr); 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)) if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
pack_ts_decl_common_value_fields (bp, expr); pack_ts_decl_common_value_fields (bp, expr);
...@@ -348,8 +359,11 @@ streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr) ...@@ -348,8 +359,11 @@ streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr)
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON)) if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
pack_ts_type_common_value_fields (bp, expr); 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)) if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
pack_ts_block_value_fields (bp, expr); pack_ts_block_value_fields (ob, bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL)) if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
pack_ts_translation_unit_decl_value_fields (bp, expr); pack_ts_translation_unit_decl_value_fields (bp, expr);
...@@ -476,7 +490,6 @@ write_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr, ...@@ -476,7 +490,6 @@ write_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr,
{ {
stream_write_tree (ob, DECL_NAME (expr), ref_p); stream_write_tree (ob, DECL_NAME (expr), ref_p);
stream_write_tree (ob, DECL_CONTEXT (expr), ref_p); stream_write_tree (ob, DECL_CONTEXT (expr), ref_p);
lto_output_location (ob, LOCATION_LOCUS (DECL_SOURCE_LOCATION (expr)));
} }
...@@ -673,7 +686,6 @@ write_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p) ...@@ -673,7 +686,6 @@ write_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
streamer_write_hwi (ob, TREE_OPERAND_LENGTH (expr)); streamer_write_hwi (ob, TREE_OPERAND_LENGTH (expr));
for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++) for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
stream_write_tree (ob, TREE_OPERAND (expr, i), ref_p); 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); stream_write_tree (ob, TREE_BLOCK (expr), ref_p);
} }
...@@ -689,21 +701,16 @@ write_ts_block_tree_pointers (struct output_block *ob, tree expr, bool ref_p) ...@@ -689,21 +701,16 @@ write_ts_block_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
stream_write_tree (ob, BLOCK_SUPERCONTEXT (expr), ref_p); stream_write_tree (ob, BLOCK_SUPERCONTEXT (expr), ref_p);
/* Stream BLOCK_ABSTRACT_ORIGIN and BLOCK_SOURCE_LOCATION for /* Stream BLOCK_ABSTRACT_ORIGIN for the limited cases we can handle - those
the limited cases we can handle - those that represent inlined that represent inlined function scopes.
function scopes. For the rest them on the floor instead of ICEing in For the rest them on the floor instead of ICEing in dwarf2out.c. */
dwarf2out.c. */
if (inlined_function_outer_scope_p (expr)) if (inlined_function_outer_scope_p (expr))
{ {
tree ultimate_origin = block_ultimate_origin (expr); tree ultimate_origin = block_ultimate_origin (expr);
stream_write_tree (ob, ultimate_origin, ref_p); stream_write_tree (ob, ultimate_origin, ref_p);
lto_output_location (ob, BLOCK_SOURCE_LOCATION (expr));
} }
else else
{ stream_write_tree (ob, NULL_TREE, ref_p);
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 /* 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 for early inlined BLOCKs so drop it on the floor instead of ICEing in
dwarf2out.c. */ dwarf2out.c. */
......
...@@ -72,14 +72,16 @@ void streamer_read_tree_body (struct lto_input_block *, struct data_in *, tree); ...@@ -72,14 +72,16 @@ void streamer_read_tree_body (struct lto_input_block *, struct data_in *, tree);
tree streamer_get_pickled_tree (struct lto_input_block *, struct data_in *); 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_get_builtin_tree (struct lto_input_block *, struct data_in *);
tree streamer_read_integer_cst (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); struct bitpack_d streamer_read_tree_bitfields (struct lto_input_block *,
struct data_in *, tree);
/* In tree-streamer-out.c. */ /* In tree-streamer-out.c. */
void streamer_write_string_cst (struct output_block *, void streamer_write_string_cst (struct output_block *,
struct lto_output_stream *, tree); struct lto_output_stream *, tree);
void streamer_write_chain (struct output_block *, tree, bool); void streamer_write_chain (struct output_block *, tree, bool);
void streamer_write_tree_header (struct output_block *, tree); void streamer_write_tree_header (struct output_block *, tree);
void streamer_pack_tree_bitfields (struct bitpack_d *, 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_tree_body (struct output_block *, tree, bool);
void streamer_write_integer_cst (struct output_block *, tree, bool); void streamer_write_integer_cst (struct output_block *, tree, bool);
void streamer_write_builtin (struct output_block *, tree); void streamer_write_builtin (struct output_block *, tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment