aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-09-30 14:56:01 +0000
committerJan Beulich <jbeulich@gcc.gnu.org>2011-09-30 14:56:01 +0000
commit49f836ba6fdf80354f675af50837fbdb7144e081 (patch)
tree088e41e292b4cc3059b11b7ac23f10733b2a3912 /gcc/lto-cgraph.c
parent7043b893da32a14fc2000b00315437bb9b1e80d6 (diff)
downloadgcc-49f836ba6fdf80354f675af50837fbdb7144e081.zip
gcc-49f836ba6fdf80354f675af50837fbdb7144e081.tar.gz
gcc-49f836ba6fdf80354f675af50837fbdb7144e081.tar.bz2
Split out LTO's writing of top level asm nodes in preparation of extending what...
Split out LTO's writing of top level asm nodes in preparation of extending what needs to be written out when top level asm-s get enhanced to accept a limited set of input operands. gcc/ 2011-09-30 Jan Beulich <jbeulich@suse.com> * lto-cgraph.c (output_cgraph): Remove processing of 'cgraph_asm_nodes', call lto_output_toplevel_asms() instead. (input_cgraph_1): Remove loop calling cgraph_add_asm_node(), call lto_input_toplevel_asms() instead. * lto-section-in.c (lto_section_name): Add "asm" entry. * lto-streamer-in.c (lto_input_toplevel_asms): New. * lto-streamer-out.c (lto_output_toplevel_asms): New. * lto-streamer.h (LTO_minor_version): Bump. (enum lto_section_type): Add LTO_section_asm. (struct lto_asm_header): New. (lto_input_toplevel_asms, lto_output_toplevel_asms): Declare. * tree-streamer.h (streamer_write_string_cst): Declare. * tree-streamer-out.c (write_string_cst): Rename to streamer_write_string_cst and make global. Handle incoming string being NULL. (streamer_write_tree_header): Adjust call to renamed function. From-SVN: r179386
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index edc3ad7..0f1a8c5 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -817,7 +817,6 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
int i, n_nodes;
lto_cgraph_encoder_t encoder;
lto_varpool_encoder_t varpool_encoder;
- struct cgraph_asm_node *can;
static bool asm_nodes_output = false;
if (flag_wpa)
@@ -854,6 +853,8 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
streamer_write_uhwi_stream (ob->main_stream, 0);
+ lto_destroy_simple_output_block (ob);
+
/* Emit toplevel asms.
When doing WPA we must output every asm just once. Since we do not partition asm
nodes at all, output them to first output. This is kind of hack, but should work
@@ -861,19 +862,9 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
if (!asm_nodes_output)
{
asm_nodes_output = true;
- for (can = cgraph_asm_nodes; can; can = can->next)
- {
- int len = TREE_STRING_LENGTH (can->asm_str);
- streamer_write_uhwi_stream (ob->main_stream, len);
- for (i = 0; i < len; ++i)
- streamer_write_char_stream (ob->main_stream,
- TREE_STRING_POINTER (can->asm_str)[i]);
- }
+ lto_output_toplevel_asms ();
}
- streamer_write_uhwi_stream (ob->main_stream, 0);
-
- lto_destroy_simple_output_block (ob);
output_varpool (set, vset);
output_refs (set, vset, encoder, varpool_encoder);
}
@@ -1185,7 +1176,6 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
VEC(cgraph_node_ptr, heap) *nodes = NULL;
struct cgraph_node *node;
unsigned i;
- unsigned HOST_WIDE_INT len;
tag = streamer_read_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
while (tag)
@@ -1206,18 +1196,8 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
tag = streamer_read_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
}
- /* Input toplevel asms. */
- len = streamer_read_uhwi (ib);
- while (len)
- {
- char *str = (char *)xmalloc (len + 1);
- for (i = 0; i < len; ++i)
- str[i] = streamer_read_uchar (ib);
- cgraph_add_asm_node (build_string (len, str));
- free (str);
+ lto_input_toplevel_asms (file_data);
- len = streamer_read_uhwi (ib);
- }
/* AUX pointers should be all non-zero for nodes read from the stream. */
#ifdef ENABLE_CHECKING
FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)