gcc/ * is-a.h: Update comments to reflect the following changes to the "pointerness" of the API, making the template parameter match the return type, allowing use of is-a.h with typedefs of pointers. (is_a_helper::cast): Return a T rather then a pointer to a T, so that the return type matches the parameter to the is_a_helper. (as_a): Likewise. (dyn_cast): Likewise. * cgraph.c (cgraph_node_for_asm): Update for removal of implicit pointer from the is-a.h API. * cgraph.h (is_a_helper <cgraph_node>::test): Convert to... (is_a_helper <cgraph_node *>::test): ...this, matching change to is-a.h API. (is_a_helper <varpool_node>::test): Likewise, convert to... (is_a_helper <varpool_node *>::test): ...this. (varpool_first_variable): Update for removal of implicit pointer from the is-a.h API. (varpool_next_variable): Likewise. (varpool_first_static_initializer): Likewise. (varpool_next_static_initializer): Likewise. (varpool_first_defined_variable): Likewise. (varpool_next_defined_variable): Likewise. (cgraph_first_defined_function): Likewise. (cgraph_next_defined_function): Likewise. (cgraph_first_function): Likewise. (cgraph_next_function): Likewise. (cgraph_first_function_with_gimple_body): Likewise. (cgraph_next_function_with_gimple_body): Likewise. (cgraph_alias_target): Likewise. (varpool_alias_target): Likewise. (cgraph_function_or_thunk_node): Likewise. (varpool_variable_node): Likewise. (symtab_real_symbol_p): Likewise. * cgraphunit.c (referred_to_p): Likewise. (analyze_functions): Likewise. (handle_alias_pairs): Likewise. * gimple-fold.c (can_refer_decl_in_current_unit_p): Likewise. * gimple-ssa.h (gimple_vuse_op): Likewise. (gimple_vdef_op): Likewise. * gimple-streamer-in.c (input_gimple_stmt): Likewise. * gimple.c (gimple_build_asm_1): Likewise. (gimple_build_try): Likewise. (gimple_build_resx): Likewise. (gimple_build_eh_dispatch): Likewise. (gimple_build_omp_for): Likewise. (gimple_omp_for_set_clauses): Likewise. * gimple.h (is_a_helper <gimple_statement_asm>::test): Convert to... (is_a_helper <gimple_statement_asm *>::test): ...this. (is_a_helper <gimple_statement_bind>::test): Convert to... (is_a_helper <gimple_statement_bind *>::test): ...this. (is_a_helper <gimple_statement_call>::test): Convert to... (is_a_helper <gimple_statement_call *>::test): ...this. (is_a_helper <gimple_statement_catch>::test): Convert to... (is_a_helper <gimple_statement_catch *>::test): ...this. (is_a_helper <gimple_statement_resx>::test): Convert to... (is_a_helper <gimple_statement_resx *>::test): ...this. (is_a_helper <gimple_statement_eh_dispatch>::test): Convert to... (is_a_helper <gimple_statement_eh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else>::test): Convert to... (is_a_helper <gimple_statement_eh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter>::test): Convert to... (is_a_helper <gimple_statement_eh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt>::test): Convert to... (is_a_helper <gimple_statement_eh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load>::test): Convert to... (is_a_helper <gimple_statement_omp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store>::test): Convert to... (is_a_helper <gimple_statement_omp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_return>::test): Convert to... (is_a_helper <gimple_statement_omp_return *>::test): ...this. (is_a_helper <gimple_statement_omp_continue>::test): Convert to... (is_a_helper <gimple_statement_omp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical>::test): Convert to... (is_a_helper <gimple_statement_omp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for>::test): Convert to... (is_a_helper <gimple_statement_omp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_taskreg>::test): Convert to... (is_a_helper <gimple_statement_omp_taskreg *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel>::test): Convert to... (is_a_helper <gimple_statement_omp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target>::test): Convert to... (is_a_helper <gimple_statement_omp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections>::test): Convert to... (is_a_helper <gimple_statement_omp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single>::test): Convert to... (is_a_helper <gimple_statement_omp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams>::test): Convert to... (is_a_helper <gimple_statement_omp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task>::test): Convert to... (is_a_helper <gimple_statement_omp_task *>::test): ...this. (is_a_helper <gimple_statement_phi>::test): Convert to... (is_a_helper <gimple_statement_phi *>::test): ...this. (is_a_helper <gimple_statement_transaction>::test): Convert to... (is_a_helper <gimple_statement_transaction *>::test): ...this. (is_a_helper <gimple_statement_try>::test): Convert to... (is_a_helper <gimple_statement_try *>::test): ...this. (is_a_helper <gimple_statement_wce>::test): Convert to... (is_a_helper <gimple_statement_wce *>::test): ...this. (is_a_helper <const gimple_statement_asm>::test): Convert to... (is_a_helper <const gimple_statement_asm *>::test): ...this. (is_a_helper <const gimple_statement_bind>::test): Convert to... (is_a_helper <const gimple_statement_bind *>::test): ...this. (is_a_helper <const gimple_statement_call>::test): Convert to... (is_a_helper <const gimple_statement_call *>::test): ...this. (is_a_helper <const gimple_statement_catch>::test): Convert to... (is_a_helper <const gimple_statement_catch *>::test): ...this. (is_a_helper <const gimple_statement_resx>::test): Convert to... (is_a_helper <const gimple_statement_resx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch>::test): Convert to... (is_a_helper <const gimple_statement_eh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter>::test): Convert to... (is_a_helper <const gimple_statement_eh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load>::test): Convert to... (is_a_helper <const gimple_statement_omp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store>::test): Convert to... (is_a_helper <const gimple_statement_omp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_return>::test): Convert to... (is_a_helper <const gimple_statement_omp_return *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue>::test): Convert to... (is_a_helper <const gimple_statement_omp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical>::test): Convert to... (is_a_helper <const gimple_statement_omp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for>::test): Convert to... (is_a_helper <const gimple_statement_omp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_taskreg>::test): Convert to... (is_a_helper <const gimple_statement_omp_taskreg *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel>::test): Convert to... (is_a_helper <const gimple_statement_omp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target>::test): Convert to... (is_a_helper <const gimple_statement_omp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections>::test): Convert to... (is_a_helper <const gimple_statement_omp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single>::test): Convert to... (is_a_helper <const gimple_statement_omp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams>::test): Convert to... (is_a_helper <const gimple_statement_omp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task>::test): Convert to... (is_a_helper <const gimple_statement_omp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi>::test): Convert to... (is_a_helper <const gimple_statement_phi *>::test): ...this. (is_a_helper <const gimple_statement_transaction>::test): Convert to... (is_a_helper <const gimple_statement_transaction *>::test): ...this. (is_a_helper <const gimple_statement_with_ops>::test): Convert to... (is_a_helper <const gimple_statement_with_ops *>::test): ...this. (is_a_helper <gimple_statement_with_ops>::test): Convert to... (is_a_helper <gimple_statement_with_ops *>::test): ...this. (is_a_helper <const gimple_statement_with_memory_ops>::test): Convert to... (is_a_helper <const gimple_statement_with_memory_ops *>::test): ...this. (is_a_helper <gimple_statement_with_memory_ops>::test): Convert to... (is_a_helper <gimple_statement_with_memory_ops *>::test): ...this. (gimple_use_ops): Update for removal of implicit pointer from the is-a.h API. (gimple_set_use_ops): Likewise. (gimple_vuse): Likewise. (gimple_vdef): Likewise. (gimple_vuse_ptr): Likewise. (gimple_vdef_ptr): Likewise. (gimple_set_vuse): Likewise. (gimple_set_vdef): Likewise. (gimple_omp_return_set_lhs): Likewise. (gimple_omp_return_lhs): Likewise. (gimple_omp_return_lhs_ptr): Likewise. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_bind_vars): Likewise. (gimple_bind_set_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_block): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Likewise. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_set_output_op): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_catch_types): Likewise. (gimple_catch_types_ptr): Likewise. (gimple_catch_handler_ptr): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Likewise. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Likewise. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Likewise. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_eval_ptr): Likewise. (gimple_try_cleanup_ptr): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_wce_cleanup_ptr): Likewise. (gimple_wce_set_cleanup): Likewise. (gimple_phi_capacity): Likewise. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_set_result): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_arg): Likewise. (gimple_resx_region): Likewise. (gimple_resx_set_region): Likewise. (gimple_eh_dispatch_region): Likewise. (gimple_eh_dispatch_set_region): Likewise. (gimple_omp_critical_name): Likewise. (gimple_omp_critical_name_ptr): Likewise. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_clauses): Likewise. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body_ptr): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Likewise. (gimple_omp_parallel_clauses_ptr): Likewise. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_task_clauses): Likewise. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Likewise. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Likewise. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Likewise. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Likewise. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Likewise. (gimple_omp_target_child_fn): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_teams_clauses): Likewise. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Likewise. (gimple_omp_sections_clauses): Likewise. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Likewise. (gimple_omp_atomic_store_val): Likewise. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Likewise. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Likewise. (gimple_omp_continue_control_def_ptr): Likewise. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Likewise. (gimple_transaction_label): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_set_body): Likewise. (gimple_transaction_set_label): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * ipa-inline-analysis.c (inline_write_summary): Likewise. * ipa-ref.c (ipa_record_reference): Likewise. * ipa-reference.c (analyze_function): Likewise. (ipa_reference_write_optimization_summary): Likewise. * ipa.c (symtab_remove_unreachable_nodes): Likewise. (address_taken_from_non_vtable_p): Likewise. (comdat_can_be_unshared_p_1): Likewise. * lto-cgraph.c (lto_output_ref): Likewise. (add_references): Likewise. (compute_ltrans_boundary): Likewise. (output_symtab): Likewise. (input_ref): Likewise. (input_cgraph_1): Likewise. (output_cgraph_opt_summary): Likewise. * lto-streamer-out.c (lto_output): Likewise. (output_symbol_p): Likewise. * lto-streamer.h (lsei_next_function_in_partition): Likewise. (lsei_start_function_in_partition): Likewise. (lsei_next_variable_in_partition): Likewise. (lsei_start_variable_in_partition): Likewise. * symtab.c (insert_to_assembler_name_hash): Likewise. (unlink_from_assembler_name_hash): Likewise. (symtab_unregister_node): Likewise. (symtab_remove_node): Likewise. (dump_symtab_node): Likewise. (verify_symtab_base): Likewise. (verify_symtab_node): Likewise. (symtab_make_decl_local): Likewise. (symtab_alias_ultimate_target): Likewise. (symtab_resolve_alias): Likewise. (symtab_get_symbol_partitioning_class): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. (reserve_phi_args_for_new_edge): Likewise. (remove_phi_args): Likewise. * varpool.c (varpool_node_for_asm): Likewise. (varpool_remove_unreferenced_decls): Likewise. gcc/lto/ * lto-partition.c (add_references_to_partition): Update for removal of implicit pointer from the is-a.h API. (add_symbol_to_partition_1): Likewise. (contained_in_symbol): Likewise. (undo_partition): Likewise. (lto_balanced_map): Likewise. (promote_symbol): Likewise. * lto-symtab.c (lto_symtab_merge_symbols_1): Likewise. (lto_symtab_merge_symbols): Likewise. * lto.c (lto_wpa_write_files): Likewise. From-SVN: r209719
301 lines
8.5 KiB
C
301 lines
8.5 KiB
C
/* Routines for reading GIMPLE from a file stream.
|
|
|
|
Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
|
Contributed by Diego Novillo <dnovillo@google.com>
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include "config.h"
|
|
#include "system.h"
|
|
#include "coretypes.h"
|
|
#include "diagnostic.h"
|
|
#include "tree.h"
|
|
#include "basic-block.h"
|
|
#include "tree-ssa-alias.h"
|
|
#include "internal-fn.h"
|
|
#include "tree-eh.h"
|
|
#include "gimple-expr.h"
|
|
#include "is-a.h"
|
|
#include "gimple.h"
|
|
#include "gimple-iterator.h"
|
|
#include "gimple-ssa.h"
|
|
#include "tree-phinodes.h"
|
|
#include "stringpool.h"
|
|
#include "tree-ssanames.h"
|
|
#include "data-streamer.h"
|
|
#include "tree-streamer.h"
|
|
#include "gimple-streamer.h"
|
|
#include "value-prof.h"
|
|
|
|
/* Read a PHI function for basic block BB in function FN. DATA_IN is
|
|
the file being read. IB is the input block to use for reading. */
|
|
|
|
static gimple
|
|
input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
|
|
struct function *fn)
|
|
{
|
|
unsigned HOST_WIDE_INT ix;
|
|
tree phi_result;
|
|
int i, len;
|
|
gimple result;
|
|
|
|
ix = streamer_read_uhwi (ib);
|
|
phi_result = (*SSANAMES (fn))[ix];
|
|
len = EDGE_COUNT (bb->preds);
|
|
result = create_phi_node (phi_result, bb);
|
|
|
|
/* We have to go through a lookup process here because the preds in the
|
|
reconstructed graph are generally in a different order than they
|
|
were in the original program. */
|
|
for (i = 0; i < len; i++)
|
|
{
|
|
tree def = stream_read_tree (ib, data_in);
|
|
int src_index = streamer_read_uhwi (ib);
|
|
bitpack_d bp = streamer_read_bitpack (ib);
|
|
location_t arg_loc = stream_input_location (&bp, data_in);
|
|
basic_block sbb = BASIC_BLOCK_FOR_FN (fn, src_index);
|
|
|
|
edge e = NULL;
|
|
int j;
|
|
|
|
for (j = 0; j < len; j++)
|
|
if (EDGE_PRED (bb, j)->src == sbb)
|
|
{
|
|
e = EDGE_PRED (bb, j);
|
|
break;
|
|
}
|
|
|
|
add_phi_arg (result, def, e, arg_loc);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/* Read a statement with tag TAG in function FN from block IB using
|
|
descriptors in DATA_IN. */
|
|
|
|
static gimple
|
|
input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
|
|
enum LTO_tags tag)
|
|
{
|
|
gimple stmt;
|
|
enum gimple_code code;
|
|
unsigned HOST_WIDE_INT num_ops;
|
|
size_t i;
|
|
struct bitpack_d bp;
|
|
bool has_hist;
|
|
|
|
code = lto_tag_to_gimple_code (tag);
|
|
|
|
/* Read the tuple header. */
|
|
bp = streamer_read_bitpack (ib);
|
|
num_ops = bp_unpack_var_len_unsigned (&bp);
|
|
stmt = gimple_alloc (code, num_ops);
|
|
stmt->no_warning = bp_unpack_value (&bp, 1);
|
|
if (is_gimple_assign (stmt))
|
|
stmt->nontemporal_move = bp_unpack_value (&bp, 1);
|
|
stmt->has_volatile_ops = bp_unpack_value (&bp, 1);
|
|
has_hist = bp_unpack_value (&bp, 1);
|
|
stmt->subcode = bp_unpack_var_len_unsigned (&bp);
|
|
|
|
/* Read location information. */
|
|
gimple_set_location (stmt, stream_input_location (&bp, data_in));
|
|
|
|
/* Read lexical block reference. */
|
|
gimple_set_block (stmt, stream_read_tree (ib, data_in));
|
|
|
|
/* Read in all the operands. */
|
|
switch (code)
|
|
{
|
|
case GIMPLE_RESX:
|
|
gimple_resx_set_region (stmt, streamer_read_hwi (ib));
|
|
break;
|
|
|
|
case GIMPLE_EH_MUST_NOT_THROW:
|
|
gimple_eh_must_not_throw_set_fndecl (stmt, stream_read_tree (ib, data_in));
|
|
break;
|
|
|
|
case GIMPLE_EH_DISPATCH:
|
|
gimple_eh_dispatch_set_region (stmt, streamer_read_hwi (ib));
|
|
break;
|
|
|
|
case GIMPLE_ASM:
|
|
{
|
|
/* FIXME lto. Move most of this into a new gimple_asm_set_string(). */
|
|
gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (stmt);
|
|
tree str;
|
|
asm_stmt->ni = streamer_read_uhwi (ib);
|
|
asm_stmt->no = streamer_read_uhwi (ib);
|
|
asm_stmt->nc = streamer_read_uhwi (ib);
|
|
asm_stmt->nl = streamer_read_uhwi (ib);
|
|
str = streamer_read_string_cst (data_in, ib);
|
|
asm_stmt->string = TREE_STRING_POINTER (str);
|
|
}
|
|
/* Fallthru */
|
|
|
|
case GIMPLE_ASSIGN:
|
|
case GIMPLE_CALL:
|
|
case GIMPLE_RETURN:
|
|
case GIMPLE_SWITCH:
|
|
case GIMPLE_LABEL:
|
|
case GIMPLE_COND:
|
|
case GIMPLE_GOTO:
|
|
case GIMPLE_DEBUG:
|
|
for (i = 0; i < num_ops; i++)
|
|
{
|
|
tree *opp, op = stream_read_tree (ib, data_in);
|
|
gimple_set_op (stmt, i, op);
|
|
if (!op)
|
|
continue;
|
|
|
|
opp = gimple_op_ptr (stmt, i);
|
|
if (TREE_CODE (*opp) == ADDR_EXPR)
|
|
opp = &TREE_OPERAND (*opp, 0);
|
|
while (handled_component_p (*opp))
|
|
opp = &TREE_OPERAND (*opp, 0);
|
|
/* At LTO output time we wrap all global decls in MEM_REFs to
|
|
allow seamless replacement with prevailing decls. Undo this
|
|
here if the prevailing decl allows for this.
|
|
??? Maybe we should simply fold all stmts. */
|
|
if (TREE_CODE (*opp) == MEM_REF
|
|
&& TREE_CODE (TREE_OPERAND (*opp, 0)) == ADDR_EXPR
|
|
&& integer_zerop (TREE_OPERAND (*opp, 1))
|
|
&& (TREE_THIS_VOLATILE (*opp)
|
|
== TREE_THIS_VOLATILE
|
|
(TREE_OPERAND (TREE_OPERAND (*opp, 0), 0)))
|
|
&& !TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (*opp, 1)))
|
|
&& (TREE_TYPE (*opp)
|
|
== TREE_TYPE (TREE_TYPE (TREE_OPERAND (*opp, 1))))
|
|
&& (TREE_TYPE (*opp)
|
|
== TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*opp, 0), 0))))
|
|
*opp = TREE_OPERAND (TREE_OPERAND (*opp, 0), 0);
|
|
}
|
|
if (is_gimple_call (stmt))
|
|
{
|
|
if (gimple_call_internal_p (stmt))
|
|
gimple_call_set_internal_fn
|
|
(stmt, streamer_read_enum (ib, internal_fn, IFN_LAST));
|
|
else
|
|
gimple_call_set_fntype (stmt, stream_read_tree (ib, data_in));
|
|
}
|
|
break;
|
|
|
|
case GIMPLE_NOP:
|
|
case GIMPLE_PREDICT:
|
|
break;
|
|
|
|
case GIMPLE_TRANSACTION:
|
|
gimple_transaction_set_label (stmt, stream_read_tree (ib, data_in));
|
|
break;
|
|
|
|
default:
|
|
internal_error ("bytecode stream: unknown GIMPLE statement tag %s",
|
|
lto_tag_name (tag));
|
|
}
|
|
|
|
/* Update the properties of symbols, SSA names and labels associated
|
|
with STMT. */
|
|
if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
|
|
{
|
|
tree lhs = gimple_get_lhs (stmt);
|
|
if (lhs && TREE_CODE (lhs) == SSA_NAME)
|
|
SSA_NAME_DEF_STMT (lhs) = stmt;
|
|
}
|
|
else if (code == GIMPLE_ASM)
|
|
{
|
|
unsigned i;
|
|
|
|
for (i = 0; i < gimple_asm_noutputs (stmt); i++)
|
|
{
|
|
tree op = TREE_VALUE (gimple_asm_output_op (stmt, i));
|
|
if (TREE_CODE (op) == SSA_NAME)
|
|
SSA_NAME_DEF_STMT (op) = stmt;
|
|
}
|
|
}
|
|
|
|
/* Reset alias information. */
|
|
if (code == GIMPLE_CALL)
|
|
gimple_call_reset_alias_info (stmt);
|
|
|
|
/* Mark the statement modified so its operand vectors can be filled in. */
|
|
gimple_set_modified (stmt, true);
|
|
if (has_hist)
|
|
stream_in_histogram_value (ib, stmt);
|
|
|
|
return stmt;
|
|
}
|
|
|
|
|
|
/* Read a basic block with tag TAG from DATA_IN using input block IB.
|
|
FN is the function being processed. */
|
|
|
|
void
|
|
input_bb (struct lto_input_block *ib, enum LTO_tags tag,
|
|
struct data_in *data_in, struct function *fn,
|
|
int count_materialization_scale)
|
|
{
|
|
unsigned int index;
|
|
basic_block bb;
|
|
gimple_stmt_iterator bsi;
|
|
|
|
/* This routine assumes that CFUN is set to FN, as it needs to call
|
|
basic GIMPLE routines that use CFUN. */
|
|
gcc_assert (cfun == fn);
|
|
|
|
index = streamer_read_uhwi (ib);
|
|
bb = BASIC_BLOCK_FOR_FN (fn, index);
|
|
|
|
bb->count = apply_scale (streamer_read_gcov_count (ib),
|
|
count_materialization_scale);
|
|
bb->frequency = streamer_read_hwi (ib);
|
|
bb->flags = streamer_read_hwi (ib);
|
|
|
|
/* LTO_bb1 has statements. LTO_bb0 does not. */
|
|
if (tag == LTO_bb0)
|
|
return;
|
|
|
|
bsi = gsi_start_bb (bb);
|
|
tag = streamer_read_record_start (ib);
|
|
while (tag)
|
|
{
|
|
gimple stmt = input_gimple_stmt (ib, data_in, tag);
|
|
gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
|
|
|
|
/* After the statement, expect a 0 delimiter or the EH region
|
|
that the previous statement belongs to. */
|
|
tag = streamer_read_record_start (ib);
|
|
lto_tag_check_set (tag, 2, LTO_eh_region, LTO_null);
|
|
|
|
if (tag == LTO_eh_region)
|
|
{
|
|
HOST_WIDE_INT region = streamer_read_hwi (ib);
|
|
gcc_assert (region == (int) region);
|
|
add_stmt_to_eh_lp (stmt, region);
|
|
}
|
|
|
|
tag = streamer_read_record_start (ib);
|
|
}
|
|
|
|
tag = streamer_read_record_start (ib);
|
|
while (tag)
|
|
{
|
|
input_phi (ib, bb, data_in, fn);
|
|
tag = streamer_read_record_start (ib);
|
|
}
|
|
}
|