+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>
* config/rs6000/rs6000.c (altivec_expand_dst_builtin): Fix signed
{
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);
+ 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;
stmt->gsbase.subcode = bp_unpack_var_len_unsigned (&bp);
/* 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. */
gimple_set_block (stmt, stream_read_tree (ib, data_in));
{
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));
+ bitpack_d bp = bitpack_create (ob->main_stream);
+ stream_output_location (ob, &bp, gimple_phi_arg_location (phi, i));
+ streamer_write_bitpack (&bp);
}
}
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)));
+ 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);
/* Read a location bitpack from input block IB. */
-static location_t
-lto_input_location_bitpack (struct data_in *data_in, struct bitpack_d *bp)
+location_t
+lto_input_location (struct bitpack_d *bp, struct data_in *data_in)
{
bool file_change, line_change, column_change;
unsigned len;
}
-/* 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
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);
+ {
+ 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 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);
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);
}
/* 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);
+ streamer_read_tree_bitfields (ib, data_in, result);
/* Read all the pointer fields in RESULT. */
streamer_read_tree_body (ib, data_in, result);
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)
+void
+lto_output_location (struct output_block *ob, struct bitpack_d *bp,
+ location_t loc)
{
expanded_location xloc;
}
-/* 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. */
/* 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_pack_tree_bitfields (ob, &bp, expr);
streamer_write_bitpack (&bp);
/* Write all the pointer fields in EXPR. */
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);
+ 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)
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);
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);
}
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;
}
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 *);
+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_refs (struct output_block *,
struct lto_output_stream *,
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 */
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);
+ /* [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) \
#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;
TREE_FIXED_CST_PTR (expr) = fp;
}
-
/* Unpack all the non-pointer fields of the TS_DECL_COMMON structure
of expression EXPR from bitpack BP. */
of expression EXPR from bitpack BP. */
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_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 in EXPR into a bit pack. */
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;
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);
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 (bp, expr);
+ 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);
bitfield values that the writer may have written. */
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;
struct bitpack_d bp;
lto_tree_code_to_tag (TREE_CODE (expr)));
/* Unpack all the value fields from BP. */
- unpack_value_fields (&bp, expr);
+ unpack_value_fields (data_in, &bp, expr);
return bp;
}
{
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);
}
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));
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));
}
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. */
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. */
of expression EXPR into bitpack BP. */
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);
/* 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 bitfields in EXPR into a bit pack. */
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;
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);
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 (bp, expr);
+ 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);
{
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)));
}
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);
}
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. */
+ /* 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);
- lto_output_location (ob, BLOCK_SOURCE_LOCATION (expr));
}
else
- {
- stream_write_tree (ob, NULL_TREE, ref_p);
- lto_output_location (ob, UNKNOWN_LOCATION);
- }
+ 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. */
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);
+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 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_integer_cst (struct output_block *, tree, bool);
void streamer_write_builtin (struct output_block *, tree);