aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-out.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2011-10-13 15:41:52 +0000
committerDiego Novillo <dnovillo@google.com>2011-10-13 15:41:52 +0000
commit9780beb655cd2e82ec6af671c326202f7dcef147 (patch)
tree8e28d4ab7fb32944612ba5b60182e18e7166269b /gcc/lto-streamer-out.c
parentd3734943e0e6369f55e34120bedd13a00c22db9f (diff)
2011-10-12 Lawrence Crowl <crowl@google.com>
Diego Novillo <dnovillo@google.com> * lto-streamer-in.c (input_struct_function_base): Factor out of ... (input_function): ... here. * lto-streamer-out.c (output_struct_function_base): Factor out of ... (output_function): ... here. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@179928 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-out.c')
-rw-r--r--gcc/lto-streamer-out.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 4d88f62d091..62cf9a1832f 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -719,36 +719,30 @@ produce_asm (struct output_block *ob, tree fn)
}
-/* Output the body of function NODE->DECL. */
+/* Output the base body of struct function FN using output block OB. */
static void
-output_function (struct cgraph_node *node)
+output_struct_function_base (struct output_block *ob, struct function *fn)
{
struct bitpack_d bp;
- tree function;
- struct function *fn;
- basic_block bb;
- struct output_block *ob;
unsigned i;
tree t;
- function = node->decl;
- fn = DECL_STRUCT_FUNCTION (function);
- ob = create_output_block (LTO_section_function_body);
-
- clear_line_info (ob);
- ob->cgraph_node = node;
-
- gcc_assert (current_function_decl == NULL_TREE && cfun == NULL);
+ /* Output the static chain and non-local goto save area. */
+ stream_write_tree (ob, fn->static_chain_decl, true);
+ stream_write_tree (ob, fn->nonlocal_goto_save_area, true);
- /* Set current_function_decl and cfun. */
- current_function_decl = function;
- push_cfun (fn);
+ /* Output all the local variables in the function. */
+ streamer_write_hwi (ob, VEC_length (tree, fn->local_decls));
+ FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t)
+ stream_write_tree (ob, t, true);
- /* Make string 0 be a NULL string. */
- streamer_write_char_stream (ob->string_stream, 0);
+ /* Output the function start and end loci. */
+ lto_output_location (ob, fn->function_start_locus);
+ lto_output_location (ob, fn->function_end_locus);
- streamer_write_record_start (ob, LTO_function);
+ /* Output current IL state of the function. */
+ streamer_write_uhwi (ob, fn->curr_properties);
/* Write all the attributes for FN. */
bp = bitpack_create (ob->main_stream);
@@ -767,22 +761,38 @@ output_function (struct cgraph_node *node)
bp_pack_value (&bp, fn->va_list_fpr_size, 8);
bp_pack_value (&bp, fn->va_list_gpr_size, 8);
streamer_write_bitpack (&bp);
+}
- /* 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);
+/* Output the body of function NODE->DECL. */
- /* Output the static chain and non-local goto save area. */
- stream_write_tree (ob, fn->static_chain_decl, true);
- stream_write_tree (ob, fn->nonlocal_goto_save_area, true);
+static void
+output_function (struct cgraph_node *node)
+{
+ tree function;
+ struct function *fn;
+ basic_block bb;
+ struct output_block *ob;
- /* Output all the local variables in the function. */
- streamer_write_hwi (ob, VEC_length (tree, fn->local_decls));
- FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t)
- stream_write_tree (ob, t, true);
+ function = node->decl;
+ fn = DECL_STRUCT_FUNCTION (function);
+ ob = create_output_block (LTO_section_function_body);
+
+ clear_line_info (ob);
+ ob->cgraph_node = node;
+
+ gcc_assert (current_function_decl == NULL_TREE && cfun == NULL);
+
+ /* Set current_function_decl and cfun. */
+ current_function_decl = function;
+ push_cfun (fn);
+
+ /* Make string 0 be a NULL string. */
+ streamer_write_char_stream (ob->string_stream, 0);
+
+ streamer_write_record_start (ob, LTO_function);
+
+ output_struct_function_base (ob, fn);
/* Output the head of the arguments list. */
stream_write_tree (ob, DECL_ARGUMENTS (function), true);