diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eddcd1ce251..8cf366c45dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2011-10-04 Jan Hubicka + + * lto-streamer.h (lto_input_toplevel_asms): Add order_base parameter. + * lto-streamer-in.c (lto_input_toplevel_asms): Stream in order. + * lto-streamer-out.c (lto_output_toplevel_asms): Stream out order. + * lto-cgraph.c (order_base): New static var. + (lto_output_node): Stream in order. + (lto_output_varpool_node): Stream out order. + (input_node): Stream in order. + (input_varpool_node): Stream out order. + (input_cgraph_1): Initialize order base; update call of + lto_input_toplevel_asms. + 2011-10-04 Georg-Johann Lay PR target/50566 diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 9254b8f9014..833bf84743b 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -54,6 +54,9 @@ static void input_cgraph_opt_summary (VEC (cgraph_node_ptr, heap) * nodes); /* Number of LDPR values known to GCC. */ #define LDPR_NUM_KNOWN (LDPR_PREVAILING_DEF_IRONLY_EXP + 1) +/* All node orders are ofsetted by ORDER_BASE. */ +static int order_base; + /* Cgraph streaming is organized as set of record whose type is indicated by a tag. */ enum LTO_cgraph_tags @@ -425,6 +428,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node, streamer_write_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag, tag); + streamer_write_hwi_stream (ob->main_stream, node->order); /* In WPA mode, we only output part of the call-graph. Also, we fake cgraph node attributes. There are two cases that we care. @@ -548,6 +552,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node struct bitpack_d bp; int ref; + streamer_write_hwi_stream (ob->main_stream, node->order); lto_output_var_decl_index (ob->decl_state, ob->main_stream, node->decl); bp = bitpack_create (ob->main_stream); bp_pack_value (&bp, node->externally_visible, 1); @@ -960,7 +965,9 @@ input_node (struct lto_file_decl_data *file_data, unsigned decl_index; int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND; int clone_ref; + int order; + order = streamer_read_hwi (ib) + order_base; clone_ref = streamer_read_hwi (ib); decl_index = streamer_read_uhwi (ib); @@ -974,6 +981,10 @@ input_node (struct lto_file_decl_data *file_data, else node = cgraph_get_create_node (fn_decl); + node->order = order; + if (order >= cgraph_order) + cgraph_order = order + 1; + node->count = streamer_read_hwi (ib); node->count_materialization_scale = streamer_read_hwi (ib); @@ -1035,10 +1046,15 @@ input_varpool_node (struct lto_file_decl_data *file_data, struct bitpack_d bp; int ref = LCC_NOT_FOUND; bool non_null_aliasof; + int order; + order = streamer_read_hwi (ib) + order_base; decl_index = streamer_read_uhwi (ib); var_decl = lto_file_decl_data_get_var_decl (file_data, decl_index); node = varpool_node (var_decl); + node->order = order; + if (order >= cgraph_order) + cgraph_order = order + 1; node->lto_file_data = file_data; bp = streamer_read_bitpack (ib); @@ -1178,6 +1194,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, unsigned i; tag = streamer_read_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag); + order_base = cgraph_order; while (tag) { if (tag == LTO_cgraph_edge) @@ -1196,7 +1213,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, tag = streamer_read_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag); } - lto_input_toplevel_asms (file_data); + lto_input_toplevel_asms (file_data, order_base); /* AUX pointers should be all non-zero for nodes read from the stream. */ #ifdef ENABLE_CHECKING diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index ef972cab1d0..d4e80c79573 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1144,7 +1144,7 @@ lto_input_tree (struct lto_input_block *ib, struct data_in *data_in) /* Input toplevel asms. */ void -lto_input_toplevel_asms (struct lto_file_decl_data *file_data) +lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base) { size_t len; const char *data = lto_get_section_data (file_data, LTO_section_asm, @@ -1173,7 +1173,12 @@ lto_input_toplevel_asms (struct lto_file_decl_data *file_data) header->lto_header.minor_version); while ((str = streamer_read_string_cst (data_in, &ib))) - cgraph_add_asm_node (str); + { + struct cgraph_asm_node *node = cgraph_add_asm_node (str); + node->order = streamer_read_hwi (&ib) + order_base; + if (node->order >= cgraph_order) + cgraph_order = node->order + 1; + } clear_line_info (data_in); lto_data_in_delete (data_in); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index d107b916e56..c14b3a98df6 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -954,7 +954,10 @@ lto_output_toplevel_asms (void) streamer_write_char_stream (ob->string_stream, 0); for (can = cgraph_asm_nodes; can; can = can->next) - streamer_write_string_cst (ob, ob->main_stream, can->asm_str); + { + streamer_write_string_cst (ob, ob->main_stream, can->asm_str); + streamer_write_hwi (ob, can->order); + } streamer_write_string_cst (ob, ob->main_stream, NULL_TREE); diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index ee818429328..f3c93682633 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -807,7 +807,7 @@ extern void lto_input_function_body (struct lto_file_decl_data *, tree, const char *); extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, const char *); -extern void lto_input_toplevel_asms (struct lto_file_decl_data *); +extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, const char *, unsigned, VEC(ld_plugin_symbol_resolution_t,heap) *);