tree streamer_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in) { unsigned HOST_WIDE_INT ix; tree result; enum LTO_tags expected_tag; ix = streamer_read_uhwi (ib); expected_tag = streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS); result = streamer_tree_cache_get_tree (data_in->reader_cache, ix); gcc_assert (result && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag)); return result; }
const char * lto_tag_name (enum LTO_tags tag) { if (lto_tag_is_tree_code_p (tag)) { /* For tags representing tree nodes, return the name of the associated tree code. */ return get_tree_code_name (lto_tag_to_tree_code (tag)); } if (lto_tag_is_gimple_code_p (tag)) { /* For tags representing gimple statements, return the name of the associated gimple code. */ return gimple_code_name[lto_tag_to_gimple_code (tag)]; } switch (tag) { case LTO_null: return "LTO_null"; case LTO_bb0: return "LTO_bb0"; case LTO_bb1: return "LTO_bb1"; case LTO_eh_region: return "LTO_eh_region"; case LTO_function: return "LTO_function"; case LTO_eh_table: return "LTO_eh_table"; case LTO_ert_cleanup: return "LTO_ert_cleanup"; case LTO_ert_try: return "LTO_ert_try"; case LTO_ert_allowed_exceptions: return "LTO_ert_allowed_exceptions"; case LTO_ert_must_not_throw: return "LTO_ert_must_not_throw"; case LTO_tree_pickle_reference: return "LTO_tree_pickle_reference"; case LTO_field_decl_ref: return "LTO_field_decl_ref"; case LTO_function_decl_ref: return "LTO_function_decl_ref"; case LTO_label_decl_ref: return "LTO_label_decl_ref"; case LTO_namespace_decl_ref: return "LTO_namespace_decl_ref"; case LTO_result_decl_ref: return "LTO_result_decl_ref"; case LTO_ssa_name_ref: return "LTO_ssa_name_ref"; case LTO_type_decl_ref: return "LTO_type_decl_ref"; case LTO_type_ref: return "LTO_type_ref"; case LTO_global_decl_ref: return "LTO_global_decl_ref"; default: return "LTO_UNKNOWN"; } }
tree streamer_alloc_tree (struct lto_input_block *ib, struct data_in *data_in, enum LTO_tags tag) { enum tree_code code; tree result; #ifdef LTO_STREAMER_DEBUG HOST_WIDE_INT orig_address_in_writer; #endif result = NULL_TREE; #ifdef LTO_STREAMER_DEBUG /* Read the word representing the memory address for the tree as it was written by the writer. This is useful when debugging differences between the writer and reader. */ orig_address_in_writer = streamer_read_hwi (ib); gcc_assert ((intptr_t) orig_address_in_writer == orig_address_in_writer); #endif code = lto_tag_to_tree_code (tag); /* We should never see an SSA_NAME tree. Only the version numbers of SSA names are ever written out. See input_ssa_names. */ gcc_assert (code != SSA_NAME); /* Instantiate a new tree using the header data. */ if (CODE_CONTAINS_STRUCT (code, TS_STRING)) result = streamer_read_string_cst (data_in, ib); else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER)) result = input_identifier (data_in, ib); else if (CODE_CONTAINS_STRUCT (code, TS_VEC)) { HOST_WIDE_INT len = streamer_read_hwi (ib); result = make_tree_vec (len); } else if (CODE_CONTAINS_STRUCT (code, TS_VECTOR)) { HOST_WIDE_INT len = streamer_read_hwi (ib); result = make_vector (len); } else if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) { unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib); result = make_tree_binfo (len); } else if (CODE_CONTAINS_STRUCT (code, TS_INT_CST)) { unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib); unsigned HOST_WIDE_INT ext_len = streamer_read_uhwi (ib); result = make_int_cst (len, ext_len); } else if (code == CALL_EXPR) { unsigned HOST_WIDE_INT nargs = streamer_read_uhwi (ib); return build_vl_exp (CALL_EXPR, nargs + 3); } else if (code == OMP_CLAUSE) { enum omp_clause_code subcode = (enum omp_clause_code) streamer_read_uhwi (ib); return build_omp_clause (UNKNOWN_LOCATION, subcode); } else { /* For all other nodes, materialize the tree with a raw make_node call. */ result = make_node (code); } #ifdef LTO_STREAMER_DEBUG /* Store the original address of the tree as seen by the writer in RESULT's aux field. This is useful when debugging streaming problems. This way, a debugging session can be started on both writer and reader with a breakpoint using this address value in both. */ lto_orig_address_map (result, (intptr_t) orig_address_in_writer); #endif return result; }