lto-streamer-in.c (input_struct_function_base): Factor out of ...
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. Co-Authored-By: Diego Novillo <dnovillo@google.com> From-SVN: r179928
This commit is contained in:
parent
a22286c349
commit
35f5b1c1b9
3 changed files with 107 additions and 76 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-10-13 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.
|
||||
|
||||
2011-10-13 Gabriel Charette <gchare@google.com>
|
||||
Diego Novillo <dnovillo@google.com>
|
||||
|
||||
|
|
|
@ -764,52 +764,17 @@ fixup_call_stmt_edges (struct cgraph_node *orig, gimple *stmts)
|
|||
}
|
||||
}
|
||||
|
||||
/* Read the body of function FN_DECL from DATA_IN using input block IB. */
|
||||
|
||||
/* Input the base body of struct function FN from DATA_IN
|
||||
using input block IB. */
|
||||
|
||||
static void
|
||||
input_function (tree fn_decl, struct data_in *data_in,
|
||||
struct lto_input_block *ib)
|
||||
input_struct_function_base (struct function *fn, struct data_in *data_in,
|
||||
struct lto_input_block *ib)
|
||||
{
|
||||
struct function *fn;
|
||||
enum LTO_tags tag;
|
||||
gimple *stmts;
|
||||
basic_block bb;
|
||||
struct bitpack_d bp;
|
||||
struct cgraph_node *node;
|
||||
tree args, narg, oarg;
|
||||
int len;
|
||||
|
||||
fn = DECL_STRUCT_FUNCTION (fn_decl);
|
||||
tag = streamer_read_record_start (ib);
|
||||
clear_line_info (data_in);
|
||||
|
||||
gimple_register_cfg_hooks ();
|
||||
lto_tag_check (tag, LTO_function);
|
||||
|
||||
/* Read all the attributes for FN. */
|
||||
bp = streamer_read_bitpack (ib);
|
||||
fn->is_thunk = bp_unpack_value (&bp, 1);
|
||||
fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
|
||||
fn->after_tree_profile = bp_unpack_value (&bp, 1);
|
||||
fn->returns_pcc_struct = bp_unpack_value (&bp, 1);
|
||||
fn->returns_struct = bp_unpack_value (&bp, 1);
|
||||
fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1);
|
||||
fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1);
|
||||
fn->after_inlining = bp_unpack_value (&bp, 1);
|
||||
fn->stdarg = bp_unpack_value (&bp, 1);
|
||||
fn->has_nonlocal_label = bp_unpack_value (&bp, 1);
|
||||
fn->calls_alloca = 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_gpr_size = bp_unpack_value (&bp, 8);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Read the static chain and non-local goto save area. */
|
||||
fn->static_chain_decl = stream_read_tree (ib, data_in);
|
||||
fn->nonlocal_goto_save_area = stream_read_tree (ib, data_in);
|
||||
|
@ -827,6 +792,54 @@ input_function (tree fn_decl, 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. */
|
||||
fn->curr_properties = streamer_read_uhwi (ib);
|
||||
|
||||
/* Read all the attributes for FN. */
|
||||
bp = streamer_read_bitpack (ib);
|
||||
fn->is_thunk = bp_unpack_value (&bp, 1);
|
||||
fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
|
||||
fn->after_tree_profile = bp_unpack_value (&bp, 1);
|
||||
fn->returns_pcc_struct = bp_unpack_value (&bp, 1);
|
||||
fn->returns_struct = bp_unpack_value (&bp, 1);
|
||||
fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1);
|
||||
fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1);
|
||||
fn->after_inlining = bp_unpack_value (&bp, 1);
|
||||
fn->stdarg = bp_unpack_value (&bp, 1);
|
||||
fn->has_nonlocal_label = bp_unpack_value (&bp, 1);
|
||||
fn->calls_alloca = 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_gpr_size = bp_unpack_value (&bp, 8);
|
||||
}
|
||||
|
||||
|
||||
/* Read the body of function FN_DECL from DATA_IN using input block IB. */
|
||||
|
||||
static void
|
||||
input_function (tree fn_decl, struct data_in *data_in,
|
||||
struct lto_input_block *ib)
|
||||
{
|
||||
struct function *fn;
|
||||
enum LTO_tags tag;
|
||||
gimple *stmts;
|
||||
basic_block bb;
|
||||
struct cgraph_node *node;
|
||||
tree args, narg, oarg;
|
||||
|
||||
fn = DECL_STRUCT_FUNCTION (fn_decl);
|
||||
tag = streamer_read_record_start (ib);
|
||||
clear_line_info (data_in);
|
||||
|
||||
gimple_register_cfg_hooks ();
|
||||
lto_tag_check (tag, LTO_function);
|
||||
|
||||
input_struct_function_base (fn, data_in, ib);
|
||||
|
||||
/* Read all function arguments. We need to re-map them here to the
|
||||
arguments of the merged function declaration. */
|
||||
args = stream_read_tree (ib, data_in);
|
||||
|
|
|
@ -719,18 +719,60 @@ produce_asm (struct output_block *ob, tree fn)
|
|||
}
|
||||
|
||||
|
||||
/* Output the base body of struct function FN using output block OB. */
|
||||
|
||||
static void
|
||||
output_struct_function_base (struct output_block *ob, struct function *fn)
|
||||
{
|
||||
struct bitpack_d bp;
|
||||
unsigned i;
|
||||
tree t;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Write all the attributes for FN. */
|
||||
bp = bitpack_create (ob->main_stream);
|
||||
bp_pack_value (&bp, fn->is_thunk, 1);
|
||||
bp_pack_value (&bp, fn->has_local_explicit_reg_vars, 1);
|
||||
bp_pack_value (&bp, fn->after_tree_profile, 1);
|
||||
bp_pack_value (&bp, fn->returns_pcc_struct, 1);
|
||||
bp_pack_value (&bp, fn->returns_struct, 1);
|
||||
bp_pack_value (&bp, fn->can_throw_non_call_exceptions, 1);
|
||||
bp_pack_value (&bp, fn->always_inline_functions_inlined, 1);
|
||||
bp_pack_value (&bp, fn->after_inlining, 1);
|
||||
bp_pack_value (&bp, fn->stdarg, 1);
|
||||
bp_pack_value (&bp, fn->has_nonlocal_label, 1);
|
||||
bp_pack_value (&bp, fn->calls_alloca, 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_gpr_size, 8);
|
||||
streamer_write_bitpack (&bp);
|
||||
}
|
||||
|
||||
|
||||
/* Output the body of function NODE->DECL. */
|
||||
|
||||
static void
|
||||
output_function (struct cgraph_node *node)
|
||||
{
|
||||
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);
|
||||
|
@ -750,39 +792,7 @@ output_function (struct cgraph_node *node)
|
|||
|
||||
streamer_write_record_start (ob, LTO_function);
|
||||
|
||||
/* Write all the attributes for FN. */
|
||||
bp = bitpack_create (ob->main_stream);
|
||||
bp_pack_value (&bp, fn->is_thunk, 1);
|
||||
bp_pack_value (&bp, fn->has_local_explicit_reg_vars, 1);
|
||||
bp_pack_value (&bp, fn->after_tree_profile, 1);
|
||||
bp_pack_value (&bp, fn->returns_pcc_struct, 1);
|
||||
bp_pack_value (&bp, fn->returns_struct, 1);
|
||||
bp_pack_value (&bp, fn->can_throw_non_call_exceptions, 1);
|
||||
bp_pack_value (&bp, fn->always_inline_functions_inlined, 1);
|
||||
bp_pack_value (&bp, fn->after_inlining, 1);
|
||||
bp_pack_value (&bp, fn->stdarg, 1);
|
||||
bp_pack_value (&bp, fn->has_nonlocal_label, 1);
|
||||
bp_pack_value (&bp, fn->calls_alloca, 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_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 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);
|
||||
|
||||
/* 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);
|
||||
output_struct_function_base (ob, fn);
|
||||
|
||||
/* Output the head of the arguments list. */
|
||||
stream_write_tree (ob, DECL_ARGUMENTS (function), true);
|
||||
|
|
Loading…
Add table
Reference in a new issue