1 /* Read the GIMPLE representation from a file stream.
3 Copyright 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
5 Re-implemented by Diego Novillo <dnovillo@google.com>
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
34 #include "basic-block.h"
35 #include "tree-flow.h"
36 #include "tree-pass.h"
40 #include "diagnostic.h"
47 #include "ipa-utils.h"
48 #include "lto-streamer.h"
49 #include "tree-pass.h"
51 /* Data structure used to hash file names in the source_location field. */
55 unsigned int slot_num
;
58 /* The table to hold the file names. */
59 static htab_t file_name_hash_table
;
62 /* Check that tag ACTUAL has one of the given values. NUM_TAGS is the
63 number of valid tag values to check. */
66 lto_tag_check_set (enum LTO_tags actual
, int ntags
, ...)
72 for (i
= 0; i
< ntags
; i
++)
73 if ((unsigned) actual
== va_arg (ap
, unsigned))
80 internal_error ("bytecode stream: unexpected tag %s", lto_tag_name (actual
));
84 /* Check that tag ACTUAL is in the range [TAG1, TAG2]. */
87 lto_tag_check_range (enum LTO_tags actual
, enum LTO_tags tag1
,
90 if (actual
< tag1
|| actual
> tag2
)
91 internal_error ("bytecode stream: tag %s is not in the expected range "
93 lto_tag_name (actual
),
99 /* Check that tag ACTUAL == EXPECTED. */
102 lto_tag_check (enum LTO_tags actual
, enum LTO_tags expected
)
104 if (actual
!= expected
)
105 internal_error ("bytecode stream: expected tag %s instead of %s",
106 lto_tag_name (expected
), lto_tag_name (actual
));
110 /* Return a hash code for P. */
113 hash_string_slot_node (const void *p
)
115 const struct string_slot
*ds
= (const struct string_slot
*) p
;
116 return (hashval_t
) htab_hash_string (ds
->s
);
120 /* Returns nonzero if P1 and P2 are equal. */
123 eq_string_slot_node (const void *p1
, const void *p2
)
125 const struct string_slot
*ds1
= (const struct string_slot
*) p1
;
126 const struct string_slot
*ds2
= (const struct string_slot
*) p2
;
127 return strcmp (ds1
->s
, ds2
->s
) == 0;
131 /* Read a string from the string table in DATA_IN using input block
132 IB. Write the length to RLEN. */
135 input_string_internal (struct data_in
*data_in
, struct lto_input_block
*ib
,
138 struct lto_input_block str_tab
;
143 /* Read the location of the string from IB. */
144 loc
= lto_input_uleb128 (ib
);
146 /* Get the string stored at location LOC in DATA_IN->STRINGS. */
147 LTO_INIT_INPUT_BLOCK (str_tab
, data_in
->strings
, loc
, data_in
->strings_len
);
148 len
= lto_input_uleb128 (&str_tab
);
151 if (str_tab
.p
+ len
> data_in
->strings_len
)
152 internal_error ("bytecode stream: string too long for the string table");
154 result
= (const char *)(data_in
->strings
+ str_tab
.p
);
160 /* Read a STRING_CST from the string table in DATA_IN using input
164 input_string_cst (struct data_in
*data_in
, struct lto_input_block
*ib
)
168 unsigned int is_null
;
170 is_null
= lto_input_uleb128 (ib
);
174 ptr
= input_string_internal (data_in
, ib
, &len
);
175 return build_string (len
, ptr
);
179 /* Read an IDENTIFIER from the string table in DATA_IN using input
183 input_identifier (struct data_in
*data_in
, struct lto_input_block
*ib
)
187 unsigned int is_null
;
189 is_null
= lto_input_uleb128 (ib
);
193 ptr
= input_string_internal (data_in
, ib
, &len
);
194 return get_identifier_with_length (ptr
, len
);
198 /* Read LENGTH bytes from STREAM to ADDR. */
201 lto_input_data_block (struct lto_input_block
*ib
, void *addr
, size_t length
)
204 unsigned char *const buffer
= (unsigned char *const) addr
;
206 for (i
= 0; i
< length
; i
++)
207 buffer
[i
] = lto_input_1_unsigned (ib
);
211 /* Read a NULL terminated string from the string table in DATA_IN. */
214 lto_input_string (struct data_in
*data_in
, struct lto_input_block
*ib
)
218 unsigned int is_null
;
220 is_null
= lto_input_uleb128 (ib
);
224 ptr
= input_string_internal (data_in
, ib
, &len
);
225 if (ptr
[len
- 1] != '\0')
226 internal_error ("bytecode stream: found non-null terminated string");
232 /* Return the next tag in the input block IB. */
235 input_record_start (struct lto_input_block
*ib
)
237 enum LTO_tags tag
= (enum LTO_tags
) lto_input_uleb128 (ib
);
242 /* Lookup STRING in file_name_hash_table. If found, return the existing
243 string, otherwise insert STRING as the canonical version. */
246 canon_file_name (const char *string
)
249 struct string_slot s_slot
;
252 slot
= htab_find_slot (file_name_hash_table
, &s_slot
, INSERT
);
257 struct string_slot
*new_slot
;
259 len
= strlen (string
);
260 saved_string
= (char *) xmalloc (len
+ 1);
261 new_slot
= XCNEW (struct string_slot
);
262 strcpy (saved_string
, string
);
263 new_slot
->s
= saved_string
;
269 struct string_slot
*old_slot
= (struct string_slot
*) *slot
;
275 /* Clear the line info stored in DATA_IN. */
278 clear_line_info (struct data_in
*data_in
)
280 if (data_in
->current_file
)
281 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
282 data_in
->current_file
= NULL
;
283 data_in
->current_line
= 0;
284 data_in
->current_col
= 0;
288 /* Read a location from input block IB. */
291 lto_input_location (struct lto_input_block
*ib
, struct data_in
*data_in
)
293 expanded_location xloc
;
295 xloc
.file
= lto_input_string (data_in
, ib
);
296 if (xloc
.file
== NULL
)
297 return UNKNOWN_LOCATION
;
299 xloc
.file
= canon_file_name (xloc
.file
);
300 xloc
.line
= lto_input_sleb128 (ib
);
301 xloc
.column
= lto_input_sleb128 (ib
);
302 xloc
.sysp
= lto_input_sleb128 (ib
);
304 if (data_in
->current_file
!= xloc
.file
)
306 if (data_in
->current_file
)
307 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
309 linemap_add (line_table
, LC_ENTER
, xloc
.sysp
, xloc
.file
, xloc
.line
);
311 else if (data_in
->current_line
!= xloc
.line
)
312 linemap_line_start (line_table
, xloc
.line
, xloc
.column
);
314 data_in
->current_file
= xloc
.file
;
315 data_in
->current_line
= xloc
.line
;
316 data_in
->current_col
= xloc
.column
;
318 return linemap_position_for_column (line_table
, xloc
.column
);
322 /* Read a reference to a tree node from DATA_IN using input block IB.
323 TAG is the expected node that should be found in IB, if TAG belongs
324 to one of the indexable trees, expect to read a reference index to
325 be looked up in one of the symbol tables, otherwise read the pysical
326 representation of the tree using lto_input_tree. FN is the
327 function scope for the read tree. */
330 lto_input_tree_ref (struct lto_input_block
*ib
, struct data_in
*data_in
,
331 struct function
*fn
, enum LTO_tags tag
)
333 unsigned HOST_WIDE_INT ix_u
;
334 tree result
= NULL_TREE
;
336 lto_tag_check_range (tag
, LTO_field_decl_ref
, LTO_global_decl_ref
);
341 ix_u
= lto_input_uleb128 (ib
);
342 result
= lto_file_decl_data_get_type (data_in
->file_data
, ix_u
);
345 case LTO_ssa_name_ref
:
346 ix_u
= lto_input_uleb128 (ib
);
347 result
= VEC_index (tree
, SSANAMES (fn
), ix_u
);
350 case LTO_field_decl_ref
:
351 ix_u
= lto_input_uleb128 (ib
);
352 result
= lto_file_decl_data_get_field_decl (data_in
->file_data
, ix_u
);
355 case LTO_function_decl_ref
:
356 ix_u
= lto_input_uleb128 (ib
);
357 result
= lto_file_decl_data_get_fn_decl (data_in
->file_data
, ix_u
);
360 case LTO_type_decl_ref
:
361 ix_u
= lto_input_uleb128 (ib
);
362 result
= lto_file_decl_data_get_type_decl (data_in
->file_data
, ix_u
);
365 case LTO_namespace_decl_ref
:
366 ix_u
= lto_input_uleb128 (ib
);
367 result
= lto_file_decl_data_get_namespace_decl (data_in
->file_data
, ix_u
);
370 case LTO_global_decl_ref
:
371 case LTO_result_decl_ref
:
372 case LTO_const_decl_ref
:
373 case LTO_imported_decl_ref
:
374 case LTO_label_decl_ref
:
375 case LTO_translation_unit_decl_ref
:
376 ix_u
= lto_input_uleb128 (ib
);
377 result
= lto_file_decl_data_get_var_decl (data_in
->file_data
, ix_u
);
390 /* Read a chain of tree nodes from input block IB. DATA_IN contains
391 tables and descriptors for the file being read. */
394 lto_input_chain (struct lto_input_block
*ib
, struct data_in
*data_in
)
397 tree first
, prev
, curr
;
399 first
= prev
= NULL_TREE
;
400 count
= lto_input_sleb128 (ib
);
401 for (i
= 0; i
< count
; i
++)
403 curr
= lto_input_tree (ib
, data_in
);
405 TREE_CHAIN (prev
) = curr
;
409 TREE_CHAIN (curr
) = NULL_TREE
;
417 /* Read and return a double-linked list of catch handlers from input
418 block IB, using descriptors in DATA_IN. */
420 static struct eh_catch_d
*
421 lto_input_eh_catch_list (struct lto_input_block
*ib
, struct data_in
*data_in
,
427 *last_p
= first
= NULL
;
428 tag
= input_record_start (ib
);
434 lto_tag_check_range (tag
, LTO_eh_catch
, LTO_eh_catch
);
436 /* Read the catch node. */
437 n
= ggc_alloc_cleared_eh_catch_d ();
438 n
->type_list
= lto_input_tree (ib
, data_in
);
439 n
->filter_list
= lto_input_tree (ib
, data_in
);
440 n
->label
= lto_input_tree (ib
, data_in
);
442 /* Register all the types in N->FILTER_LIST. */
443 for (list
= n
->filter_list
; list
; list
= TREE_CHAIN (list
))
444 add_type_for_runtime (TREE_VALUE (list
));
446 /* Chain N to the end of the list. */
448 (*last_p
)->next_catch
= n
;
449 n
->prev_catch
= *last_p
;
452 /* Set the head of the list the first time through the loop. */
456 tag
= input_record_start (ib
);
463 /* Read and return EH region IX from input block IB, using descriptors
467 input_eh_region (struct lto_input_block
*ib
, struct data_in
*data_in
, int ix
)
472 /* Read the region header. */
473 tag
= input_record_start (ib
);
477 r
= ggc_alloc_cleared_eh_region_d ();
478 r
->index
= lto_input_sleb128 (ib
);
480 gcc_assert (r
->index
== ix
);
482 /* Read all the region pointers as region numbers. We'll fix up
483 the pointers once the whole array has been read. */
484 r
->outer
= (eh_region
) (intptr_t) lto_input_sleb128 (ib
);
485 r
->inner
= (eh_region
) (intptr_t) lto_input_sleb128 (ib
);
486 r
->next_peer
= (eh_region
) (intptr_t) lto_input_sleb128 (ib
);
490 case LTO_ert_cleanup
:
491 r
->type
= ERT_CLEANUP
;
496 struct eh_catch_d
*last_catch
;
498 r
->u
.eh_try
.first_catch
= lto_input_eh_catch_list (ib
, data_in
,
500 r
->u
.eh_try
.last_catch
= last_catch
;
504 case LTO_ert_allowed_exceptions
:
508 r
->type
= ERT_ALLOWED_EXCEPTIONS
;
509 r
->u
.allowed
.type_list
= lto_input_tree (ib
, data_in
);
510 r
->u
.allowed
.label
= lto_input_tree (ib
, data_in
);
511 r
->u
.allowed
.filter
= lto_input_uleb128 (ib
);
513 for (l
= r
->u
.allowed
.type_list
; l
; l
= TREE_CHAIN (l
))
514 add_type_for_runtime (TREE_VALUE (l
));
518 case LTO_ert_must_not_throw
:
519 r
->type
= ERT_MUST_NOT_THROW
;
520 r
->u
.must_not_throw
.failure_decl
= lto_input_tree (ib
, data_in
);
521 r
->u
.must_not_throw
.failure_loc
= lto_input_location (ib
, data_in
);
528 r
->landing_pads
= (eh_landing_pad
) (intptr_t) lto_input_sleb128 (ib
);
534 /* Read and return EH landing pad IX from input block IB, using descriptors
537 static eh_landing_pad
538 input_eh_lp (struct lto_input_block
*ib
, struct data_in
*data_in
, int ix
)
543 /* Read the landing pad header. */
544 tag
= input_record_start (ib
);
548 lto_tag_check_range (tag
, LTO_eh_landing_pad
, LTO_eh_landing_pad
);
550 lp
= ggc_alloc_cleared_eh_landing_pad_d ();
551 lp
->index
= lto_input_sleb128 (ib
);
552 gcc_assert (lp
->index
== ix
);
553 lp
->next_lp
= (eh_landing_pad
) (intptr_t) lto_input_sleb128 (ib
);
554 lp
->region
= (eh_region
) (intptr_t) lto_input_sleb128 (ib
);
555 lp
->post_landing_pad
= lto_input_tree (ib
, data_in
);
561 /* After reading the EH regions, pointers to peer and children regions
562 are region numbers. This converts all these region numbers into
563 real pointers into the rematerialized regions for FN. ROOT_REGION
564 is the region number for the root EH region in FN. */
567 fixup_eh_region_pointers (struct function
*fn
, HOST_WIDE_INT root_region
)
570 VEC(eh_region
,gc
) *eh_array
= fn
->eh
->region_array
;
571 VEC(eh_landing_pad
,gc
) *lp_array
= fn
->eh
->lp_array
;
575 gcc_assert (eh_array
&& lp_array
);
577 gcc_assert (root_region
>= 0);
578 fn
->eh
->region_tree
= VEC_index (eh_region
, eh_array
, root_region
);
580 #define FIXUP_EH_REGION(r) (r) = VEC_index (eh_region, eh_array, \
581 (HOST_WIDE_INT) (intptr_t) (r))
582 #define FIXUP_EH_LP(p) (p) = VEC_index (eh_landing_pad, lp_array, \
583 (HOST_WIDE_INT) (intptr_t) (p))
585 /* Convert all the index numbers stored in pointer fields into
586 pointers to the corresponding slots in the EH region array. */
587 FOR_EACH_VEC_ELT (eh_region
, eh_array
, i
, r
)
589 /* The array may contain NULL regions. */
593 gcc_assert (i
== (unsigned) r
->index
);
594 FIXUP_EH_REGION (r
->outer
);
595 FIXUP_EH_REGION (r
->inner
);
596 FIXUP_EH_REGION (r
->next_peer
);
597 FIXUP_EH_LP (r
->landing_pads
);
600 /* Convert all the index numbers stored in pointer fields into
601 pointers to the corresponding slots in the EH landing pad array. */
602 FOR_EACH_VEC_ELT (eh_landing_pad
, lp_array
, i
, lp
)
604 /* The array may contain NULL landing pads. */
608 gcc_assert (i
== (unsigned) lp
->index
);
609 FIXUP_EH_LP (lp
->next_lp
);
610 FIXUP_EH_REGION (lp
->region
);
613 #undef FIXUP_EH_REGION
618 /* Initialize EH support. */
623 static bool eh_initialized_p
= false;
625 if (eh_initialized_p
)
628 /* Contrary to most other FEs, we only initialize EH support when at
629 least one of the files in the set contains exception regions in
630 it. Since this happens much later than the call to init_eh in
631 lang_dependent_init, we have to set flag_exceptions and call
632 init_eh again to initialize the EH tables. */
636 /* Initialize dwarf2 tables. Since dwarf2out_do_frame() returns
637 true only when exceptions are enabled, this initialization is
638 never done during lang_dependent_init. */
639 #if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO
640 if (dwarf2out_do_frame ())
641 dwarf2out_frame_init ();
644 eh_initialized_p
= true;
648 /* Read the exception table for FN from IB using the data descriptors
652 input_eh_regions (struct lto_input_block
*ib
, struct data_in
*data_in
,
655 HOST_WIDE_INT i
, root_region
, len
;
658 tag
= input_record_start (ib
);
662 lto_tag_check_range (tag
, LTO_eh_table
, LTO_eh_table
);
664 /* If the file contains EH regions, then it was compiled with
665 -fexceptions. In that case, initialize the backend EH
671 root_region
= lto_input_sleb128 (ib
);
672 gcc_assert (root_region
== (int) root_region
);
674 /* Read the EH region array. */
675 len
= lto_input_sleb128 (ib
);
676 gcc_assert (len
== (int) len
);
679 VEC_safe_grow (eh_region
, gc
, fn
->eh
->region_array
, len
);
680 for (i
= 0; i
< len
; i
++)
682 eh_region r
= input_eh_region (ib
, data_in
, i
);
683 VEC_replace (eh_region
, fn
->eh
->region_array
, i
, r
);
687 /* Read the landing pads. */
688 len
= lto_input_sleb128 (ib
);
689 gcc_assert (len
== (int) len
);
692 VEC_safe_grow (eh_landing_pad
, gc
, fn
->eh
->lp_array
, len
);
693 for (i
= 0; i
< len
; i
++)
695 eh_landing_pad lp
= input_eh_lp (ib
, data_in
, i
);
696 VEC_replace (eh_landing_pad
, fn
->eh
->lp_array
, i
, lp
);
700 /* Read the runtime type data. */
701 len
= lto_input_sleb128 (ib
);
702 gcc_assert (len
== (int) len
);
705 VEC_safe_grow (tree
, gc
, fn
->eh
->ttype_data
, len
);
706 for (i
= 0; i
< len
; i
++)
708 tree ttype
= lto_input_tree (ib
, data_in
);
709 VEC_replace (tree
, fn
->eh
->ttype_data
, i
, ttype
);
713 /* Read the table of action chains. */
714 len
= lto_input_sleb128 (ib
);
715 gcc_assert (len
== (int) len
);
718 if (targetm
.arm_eabi_unwinder
)
720 VEC_safe_grow (tree
, gc
, fn
->eh
->ehspec_data
.arm_eabi
, len
);
721 for (i
= 0; i
< len
; i
++)
723 tree t
= lto_input_tree (ib
, data_in
);
724 VEC_replace (tree
, fn
->eh
->ehspec_data
.arm_eabi
, i
, t
);
729 VEC_safe_grow (uchar
, gc
, fn
->eh
->ehspec_data
.other
, len
);
730 for (i
= 0; i
< len
; i
++)
732 uchar c
= lto_input_1_unsigned (ib
);
733 VEC_replace (uchar
, fn
->eh
->ehspec_data
.other
, i
, c
);
738 /* Reconstruct the EH region tree by fixing up the peer/children
740 fixup_eh_region_pointers (fn
, root_region
);
742 tag
= input_record_start (ib
);
743 lto_tag_check_range (tag
, LTO_null
, LTO_null
);
747 /* Make a new basic block with index INDEX in function FN. */
750 make_new_block (struct function
*fn
, unsigned int index
)
752 basic_block bb
= alloc_block ();
754 SET_BASIC_BLOCK_FOR_FUNCTION (fn
, index
, bb
);
755 bb
->il
.gimple
= ggc_alloc_cleared_gimple_bb_info ();
756 n_basic_blocks_for_function (fn
)++;
758 set_bb_seq (bb
, gimple_seq_alloc ());
763 /* Read the CFG for function FN from input block IB. */
766 input_cfg (struct lto_input_block
*ib
, struct function
*fn
,
767 int count_materialization_scale
)
769 unsigned int bb_count
;
774 init_empty_tree_cfg_for_function (fn
);
775 init_ssa_operands ();
777 profile_status_for_function (fn
) =
778 (enum profile_status_d
) lto_input_uleb128 (ib
);
780 bb_count
= lto_input_uleb128 (ib
);
782 last_basic_block_for_function (fn
) = bb_count
;
783 if (bb_count
> VEC_length (basic_block
, basic_block_info_for_function (fn
)))
784 VEC_safe_grow_cleared (basic_block
, gc
,
785 basic_block_info_for_function (fn
), bb_count
);
787 if (bb_count
> VEC_length (basic_block
, label_to_block_map_for_function (fn
)))
788 VEC_safe_grow_cleared (basic_block
, gc
,
789 label_to_block_map_for_function (fn
), bb_count
);
791 index
= lto_input_sleb128 (ib
);
794 basic_block bb
= BASIC_BLOCK_FOR_FUNCTION (fn
, index
);
795 unsigned int edge_count
;
798 bb
= make_new_block (fn
, index
);
800 edge_count
= lto_input_uleb128 (ib
);
802 /* Connect up the CFG. */
803 for (i
= 0; i
< edge_count
; i
++)
805 unsigned int dest_index
;
806 unsigned int edge_flags
;
812 dest_index
= lto_input_uleb128 (ib
);
813 probability
= (int) lto_input_sleb128 (ib
);
814 count
= ((gcov_type
) lto_input_sleb128 (ib
) * count_materialization_scale
815 + REG_BR_PROB_BASE
/ 2) / REG_BR_PROB_BASE
;
816 edge_flags
= lto_input_uleb128 (ib
);
818 dest
= BASIC_BLOCK_FOR_FUNCTION (fn
, dest_index
);
821 dest
= make_new_block (fn
, dest_index
);
823 e
= make_edge (bb
, dest
, edge_flags
);
824 e
->probability
= probability
;
828 index
= lto_input_sleb128 (ib
);
831 p_bb
= ENTRY_BLOCK_PTR_FOR_FUNCTION(fn
);
832 index
= lto_input_sleb128 (ib
);
835 basic_block bb
= BASIC_BLOCK_FOR_FUNCTION (fn
, index
);
839 index
= lto_input_sleb128 (ib
);
844 /* Read a PHI function for basic block BB in function FN. DATA_IN is
845 the file being read. IB is the input block to use for reading. */
848 input_phi (struct lto_input_block
*ib
, basic_block bb
, struct data_in
*data_in
,
851 unsigned HOST_WIDE_INT ix
;
856 ix
= lto_input_uleb128 (ib
);
857 phi_result
= VEC_index (tree
, SSANAMES (fn
), ix
);
858 len
= EDGE_COUNT (bb
->preds
);
859 result
= create_phi_node (phi_result
, bb
);
860 SSA_NAME_DEF_STMT (phi_result
) = result
;
862 /* We have to go through a lookup process here because the preds in the
863 reconstructed graph are generally in a different order than they
864 were in the original program. */
865 for (i
= 0; i
< len
; i
++)
867 tree def
= lto_input_tree (ib
, data_in
);
868 int src_index
= lto_input_uleb128 (ib
);
869 location_t arg_loc
= lto_input_location (ib
, data_in
);
870 basic_block sbb
= BASIC_BLOCK_FOR_FUNCTION (fn
, src_index
);
875 for (j
= 0; j
< len
; j
++)
876 if (EDGE_PRED (bb
, j
)->src
== sbb
)
878 e
= EDGE_PRED (bb
, j
);
882 add_phi_arg (result
, def
, e
, arg_loc
);
889 /* Read the SSA names array for function FN from DATA_IN using input
893 input_ssa_names (struct lto_input_block
*ib
, struct data_in
*data_in
,
896 unsigned int i
, size
;
898 size
= lto_input_uleb128 (ib
);
899 init_ssanames (fn
, size
);
901 i
= lto_input_uleb128 (ib
);
907 /* Skip over the elements that had been freed. */
908 while (VEC_length (tree
, SSANAMES (fn
)) < i
)
909 VEC_quick_push (tree
, SSANAMES (fn
), NULL_TREE
);
911 is_default_def
= (lto_input_1_unsigned (ib
) != 0);
912 name
= lto_input_tree (ib
, data_in
);
913 ssa_name
= make_ssa_name_fn (fn
, name
, gimple_build_nop ());
916 set_default_def (SSA_NAME_VAR (ssa_name
), ssa_name
);
918 i
= lto_input_uleb128 (ib
);
922 /* Read a statement with tag TAG in function FN from block IB using
923 descriptors in DATA_IN. */
926 input_gimple_stmt (struct lto_input_block
*ib
, struct data_in
*data_in
,
927 struct function
*fn
, enum LTO_tags tag
)
930 enum gimple_code code
;
931 unsigned HOST_WIDE_INT num_ops
;
935 code
= lto_tag_to_gimple_code (tag
);
937 /* Read the tuple header. */
938 bp
= lto_input_bitpack (ib
);
939 num_ops
= bp_unpack_value (&bp
, sizeof (unsigned) * 8);
940 stmt
= gimple_alloc (code
, num_ops
);
941 stmt
->gsbase
.no_warning
= bp_unpack_value (&bp
, 1);
942 if (is_gimple_assign (stmt
))
943 stmt
->gsbase
.nontemporal_move
= bp_unpack_value (&bp
, 1);
944 stmt
->gsbase
.has_volatile_ops
= bp_unpack_value (&bp
, 1);
945 stmt
->gsbase
.subcode
= bp_unpack_value (&bp
, 16);
947 /* Read location information. */
948 gimple_set_location (stmt
, lto_input_location (ib
, data_in
));
950 /* Read lexical block reference. */
951 gimple_set_block (stmt
, lto_input_tree (ib
, data_in
));
953 /* Read in all the operands. */
957 gimple_resx_set_region (stmt
, lto_input_sleb128 (ib
));
960 case GIMPLE_EH_MUST_NOT_THROW
:
961 gimple_eh_must_not_throw_set_fndecl (stmt
, lto_input_tree (ib
, data_in
));
964 case GIMPLE_EH_DISPATCH
:
965 gimple_eh_dispatch_set_region (stmt
, lto_input_sleb128 (ib
));
970 /* FIXME lto. Move most of this into a new gimple_asm_set_string(). */
972 stmt
->gimple_asm
.ni
= lto_input_uleb128 (ib
);
973 stmt
->gimple_asm
.no
= lto_input_uleb128 (ib
);
974 stmt
->gimple_asm
.nc
= lto_input_uleb128 (ib
);
975 stmt
->gimple_asm
.nl
= lto_input_uleb128 (ib
);
976 str
= input_string_cst (data_in
, ib
);
977 stmt
->gimple_asm
.string
= TREE_STRING_POINTER (str
);
989 for (i
= 0; i
< num_ops
; i
++)
991 tree op
= lto_input_tree (ib
, data_in
);
992 gimple_set_op (stmt
, i
, op
);
996 /* Fixup FIELD_DECLs in COMPONENT_REFs, they are not handled
998 if (TREE_CODE (op
) == ADDR_EXPR
)
999 op
= TREE_OPERAND (op
, 0);
1000 while (handled_component_p (op
))
1002 if (TREE_CODE (op
) == COMPONENT_REF
)
1004 tree field
, type
, tem
;
1005 tree closest_match
= NULL_TREE
;
1006 field
= TREE_OPERAND (op
, 1);
1007 type
= DECL_CONTEXT (field
);
1008 for (tem
= TYPE_FIELDS (type
); tem
; tem
= TREE_CHAIN (tem
))
1012 if (DECL_NONADDRESSABLE_P (tem
)
1013 == DECL_NONADDRESSABLE_P (field
)
1014 && gimple_compare_field_offset (tem
, field
))
1016 if (types_compatible_p (TREE_TYPE (tem
),
1020 closest_match
= tem
;
1023 /* In case of type mismatches across units we can fail
1024 to unify some types and thus not find a proper
1026 if (tem
== NULL_TREE
)
1028 /* Thus, emit a ODR violation warning. */
1029 if (warning_at (gimple_location (stmt
), 0,
1030 "use of type %<%E%> with two mismatching "
1031 "declarations at field %<%E%>",
1032 type
, TREE_OPERAND (op
, 1)))
1034 if (TYPE_FIELDS (type
))
1035 inform (DECL_SOURCE_LOCATION (TYPE_FIELDS (type
)),
1036 "original type declared here");
1037 inform (DECL_SOURCE_LOCATION (TREE_OPERAND (op
, 1)),
1038 "field in mismatching type declared here");
1039 if (TYPE_NAME (TREE_TYPE (field
))
1040 && (TREE_CODE (TYPE_NAME (TREE_TYPE (field
)))
1042 inform (DECL_SOURCE_LOCATION
1043 (TYPE_NAME (TREE_TYPE (field
))),
1044 "type of field declared here");
1046 && TYPE_NAME (TREE_TYPE (closest_match
))
1047 && (TREE_CODE (TYPE_NAME
1048 (TREE_TYPE (closest_match
))) == TYPE_DECL
))
1049 inform (DECL_SOURCE_LOCATION
1050 (TYPE_NAME (TREE_TYPE (closest_match
))),
1051 "type of mismatching field declared here");
1053 /* And finally fixup the types. */
1054 TREE_OPERAND (op
, 0)
1055 = build1 (VIEW_CONVERT_EXPR
, type
,
1056 TREE_OPERAND (op
, 0));
1059 TREE_OPERAND (op
, 1) = tem
;
1062 op
= TREE_OPERAND (op
, 0);
1065 if (is_gimple_call (stmt
))
1066 gimple_call_set_fntype (stmt
, lto_input_tree (ib
, data_in
));
1070 case GIMPLE_PREDICT
:
1074 internal_error ("bytecode stream: unknown GIMPLE statement tag %s",
1075 lto_tag_name (tag
));
1078 /* Update the properties of symbols, SSA names and labels associated
1080 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
1082 tree lhs
= gimple_get_lhs (stmt
);
1083 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1084 SSA_NAME_DEF_STMT (lhs
) = stmt
;
1086 else if (code
== GIMPLE_LABEL
)
1087 gcc_assert (emit_label_in_global_context_p (gimple_label_label (stmt
))
1088 || DECL_CONTEXT (gimple_label_label (stmt
)) == fn
->decl
);
1089 else if (code
== GIMPLE_ASM
)
1093 for (i
= 0; i
< gimple_asm_noutputs (stmt
); i
++)
1095 tree op
= TREE_VALUE (gimple_asm_output_op (stmt
, i
));
1096 if (TREE_CODE (op
) == SSA_NAME
)
1097 SSA_NAME_DEF_STMT (op
) = stmt
;
1101 /* Reset alias information. */
1102 if (code
== GIMPLE_CALL
)
1103 gimple_call_reset_alias_info (stmt
);
1105 /* Mark the statement modified so its operand vectors can be filled in. */
1106 gimple_set_modified (stmt
, true);
1112 /* Read a basic block with tag TAG from DATA_IN using input block IB.
1113 FN is the function being processed. */
1116 input_bb (struct lto_input_block
*ib
, enum LTO_tags tag
,
1117 struct data_in
*data_in
, struct function
*fn
,
1118 int count_materialization_scale
)
1122 gimple_stmt_iterator bsi
;
1124 /* This routine assumes that CFUN is set to FN, as it needs to call
1125 basic GIMPLE routines that use CFUN. */
1126 gcc_assert (cfun
== fn
);
1128 index
= lto_input_uleb128 (ib
);
1129 bb
= BASIC_BLOCK_FOR_FUNCTION (fn
, index
);
1131 bb
->count
= (lto_input_sleb128 (ib
) * count_materialization_scale
1132 + REG_BR_PROB_BASE
/ 2) / REG_BR_PROB_BASE
;
1133 bb
->loop_depth
= lto_input_sleb128 (ib
);
1134 bb
->frequency
= lto_input_sleb128 (ib
);
1135 bb
->flags
= lto_input_sleb128 (ib
);
1137 /* LTO_bb1 has statements. LTO_bb0 does not. */
1141 bsi
= gsi_start_bb (bb
);
1142 tag
= input_record_start (ib
);
1145 gimple stmt
= input_gimple_stmt (ib
, data_in
, fn
, tag
);
1146 if (!is_gimple_debug (stmt
))
1147 find_referenced_vars_in (stmt
);
1148 gsi_insert_after (&bsi
, stmt
, GSI_NEW_STMT
);
1150 /* After the statement, expect a 0 delimiter or the EH region
1151 that the previous statement belongs to. */
1152 tag
= input_record_start (ib
);
1153 lto_tag_check_set (tag
, 2, LTO_eh_region
, LTO_null
);
1155 if (tag
== LTO_eh_region
)
1157 HOST_WIDE_INT region
= lto_input_sleb128 (ib
);
1158 gcc_assert (region
== (int) region
);
1159 add_stmt_to_eh_lp (stmt
, region
);
1162 tag
= input_record_start (ib
);
1165 tag
= input_record_start (ib
);
1168 gimple phi
= input_phi (ib
, bb
, data_in
, fn
);
1169 find_referenced_vars_in (phi
);
1170 tag
= input_record_start (ib
);
1174 /* Go through all NODE edges and fixup call_stmt pointers
1175 so they point to STMTS. */
1178 fixup_call_stmt_edges_1 (struct cgraph_node
*node
, gimple
*stmts
)
1180 struct cgraph_edge
*cedge
;
1181 for (cedge
= node
->callees
; cedge
; cedge
= cedge
->next_callee
)
1182 cedge
->call_stmt
= stmts
[cedge
->lto_stmt_uid
];
1183 for (cedge
= node
->indirect_calls
; cedge
; cedge
= cedge
->next_callee
)
1184 cedge
->call_stmt
= stmts
[cedge
->lto_stmt_uid
];
1187 /* Fixup call_stmt pointers in NODE and all clones. */
1190 fixup_call_stmt_edges (struct cgraph_node
*orig
, gimple
*stmts
)
1192 struct cgraph_node
*node
;
1194 while (orig
->clone_of
)
1195 orig
= orig
->clone_of
;
1197 fixup_call_stmt_edges_1 (orig
, stmts
);
1199 for (node
= orig
->clones
; node
!= orig
;)
1201 fixup_call_stmt_edges_1 (node
, stmts
);
1203 node
= node
->clones
;
1204 else if (node
->next_sibling_clone
)
1205 node
= node
->next_sibling_clone
;
1208 while (node
!= orig
&& !node
->next_sibling_clone
)
1209 node
= node
->clone_of
;
1211 node
= node
->next_sibling_clone
;
1216 /* Read the body of function FN_DECL from DATA_IN using input block IB. */
1219 input_function (tree fn_decl
, struct data_in
*data_in
,
1220 struct lto_input_block
*ib
)
1222 struct function
*fn
;
1226 struct bitpack_d bp
;
1227 struct cgraph_node
*node
;
1228 tree args
, narg
, oarg
;
1231 fn
= DECL_STRUCT_FUNCTION (fn_decl
);
1232 tag
= input_record_start (ib
);
1233 clear_line_info (data_in
);
1235 gimple_register_cfg_hooks ();
1236 lto_tag_check (tag
, LTO_function
);
1238 /* Read all the attributes for FN. */
1239 bp
= lto_input_bitpack (ib
);
1240 fn
->is_thunk
= bp_unpack_value (&bp
, 1);
1241 fn
->has_local_explicit_reg_vars
= bp_unpack_value (&bp
, 1);
1242 fn
->after_tree_profile
= bp_unpack_value (&bp
, 1);
1243 fn
->returns_pcc_struct
= bp_unpack_value (&bp
, 1);
1244 fn
->returns_struct
= bp_unpack_value (&bp
, 1);
1245 fn
->can_throw_non_call_exceptions
= bp_unpack_value (&bp
, 1);
1246 fn
->always_inline_functions_inlined
= bp_unpack_value (&bp
, 1);
1247 fn
->after_inlining
= bp_unpack_value (&bp
, 1);
1248 fn
->dont_save_pending_sizes_p
= bp_unpack_value (&bp
, 1);
1249 fn
->stdarg
= bp_unpack_value (&bp
, 1);
1250 fn
->has_nonlocal_label
= bp_unpack_value (&bp
, 1);
1251 fn
->calls_alloca
= bp_unpack_value (&bp
, 1);
1252 fn
->calls_setjmp
= bp_unpack_value (&bp
, 1);
1253 fn
->va_list_fpr_size
= bp_unpack_value (&bp
, 8);
1254 fn
->va_list_gpr_size
= bp_unpack_value (&bp
, 8);
1256 /* Input the function start and end loci. */
1257 fn
->function_start_locus
= lto_input_location (ib
, data_in
);
1258 fn
->function_end_locus
= lto_input_location (ib
, data_in
);
1260 /* Input the current IL state of the function. */
1261 fn
->curr_properties
= lto_input_uleb128 (ib
);
1263 /* Read the static chain and non-local goto save area. */
1264 fn
->static_chain_decl
= lto_input_tree (ib
, data_in
);
1265 fn
->nonlocal_goto_save_area
= lto_input_tree (ib
, data_in
);
1267 /* Read all the local symbols. */
1268 len
= lto_input_sleb128 (ib
);
1272 VEC_safe_grow (tree
, gc
, fn
->local_decls
, len
);
1273 for (i
= 0; i
< len
; i
++)
1275 tree t
= lto_input_tree (ib
, data_in
);
1276 VEC_replace (tree
, fn
->local_decls
, i
, t
);
1280 /* Read all function arguments. We need to re-map them here to the
1281 arguments of the merged function declaration. */
1282 args
= lto_input_tree (ib
, data_in
);
1283 for (oarg
= args
, narg
= DECL_ARGUMENTS (fn_decl
);
1285 oarg
= TREE_CHAIN (oarg
), narg
= TREE_CHAIN (narg
))
1289 res
= lto_streamer_cache_lookup (data_in
->reader_cache
, oarg
, &ix
);
1291 /* Replace the argument in the streamer cache. */
1292 lto_streamer_cache_insert_at (data_in
->reader_cache
, narg
, ix
);
1294 gcc_assert (!oarg
&& !narg
);
1296 /* Read all the SSA names. */
1297 input_ssa_names (ib
, data_in
, fn
);
1299 /* Read the exception handling regions in the function. */
1300 input_eh_regions (ib
, data_in
, fn
);
1302 /* Read the tree of lexical scopes for the function. */
1303 DECL_INITIAL (fn_decl
) = lto_input_tree (ib
, data_in
);
1304 gcc_assert (DECL_INITIAL (fn_decl
));
1305 DECL_SAVED_TREE (fn_decl
) = NULL_TREE
;
1306 node
= cgraph_get_create_node (fn_decl
);
1308 /* Read all the basic blocks. */
1309 tag
= input_record_start (ib
);
1312 input_bb (ib
, tag
, data_in
, fn
,
1313 node
->count_materialization_scale
);
1314 tag
= input_record_start (ib
);
1317 /* Fix up the call statements that are mentioned in the callgraph
1319 set_gimple_stmt_max_uid (cfun
, 0);
1322 gimple_stmt_iterator gsi
;
1323 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1325 gimple stmt
= gsi_stmt (gsi
);
1326 gimple_set_uid (stmt
, inc_gimple_stmt_max_uid (cfun
));
1329 stmts
= (gimple
*) xcalloc (gimple_stmt_max_uid (fn
), sizeof (gimple
));
1332 gimple_stmt_iterator bsi
= gsi_start_bb (bb
);
1333 while (!gsi_end_p (bsi
))
1335 gimple stmt
= gsi_stmt (bsi
);
1336 /* If we're recompiling LTO objects with debug stmts but
1337 we're not supposed to have debug stmts, remove them now.
1338 We can't remove them earlier because this would cause uid
1339 mismatches in fixups, but we can do it at this point, as
1340 long as debug stmts don't require fixups. */
1341 if (!MAY_HAVE_DEBUG_STMTS
&& is_gimple_debug (stmt
))
1343 gimple_stmt_iterator gsi
= bsi
;
1345 gsi_remove (&gsi
, true);
1350 stmts
[gimple_uid (stmt
)] = stmt
;
1355 /* Set the gimple body to the statement sequence in the entry
1356 basic block. FIXME lto, this is fairly hacky. The existence
1357 of a gimple body is used by the cgraph routines, but we should
1358 really use the presence of the CFG. */
1360 edge_iterator ei
= ei_start (ENTRY_BLOCK_PTR
->succs
);
1361 gimple_set_body (fn_decl
, bb_seq (ei_edge (ei
)->dest
));
1364 fixup_call_stmt_edges (node
, stmts
);
1365 execute_all_ipa_stmt_fixups (node
, stmts
);
1367 update_ssa (TODO_update_ssa_only_virtuals
);
1368 free_dominance_info (CDI_DOMINATORS
);
1369 free_dominance_info (CDI_POST_DOMINATORS
);
1374 /* Read initializer expressions for public statics. DATA_IN is the
1375 file being read. IB is the input block used for reading. */
1378 input_alias_pairs (struct lto_input_block
*ib
, struct data_in
*data_in
)
1382 clear_line_info (data_in
);
1384 var
= lto_input_tree (ib
, data_in
);
1387 const char *orig_name
, *new_name
;
1390 p
= VEC_safe_push (alias_pair
, gc
, alias_pairs
, NULL
);
1392 p
->target
= lto_input_tree (ib
, data_in
);
1394 /* If the target is a static object, we may have registered a
1395 new name for it to avoid clashes between statics coming from
1396 different files. In that case, use the new name. */
1397 orig_name
= IDENTIFIER_POINTER (p
->target
);
1398 new_name
= lto_get_decl_name_mapping (data_in
->file_data
, orig_name
);
1399 if (strcmp (orig_name
, new_name
) != 0)
1400 p
->target
= get_identifier (new_name
);
1402 var
= lto_input_tree (ib
, data_in
);
1407 /* Read the body from DATA for function FN_DECL and fill it in.
1408 FILE_DATA are the global decls and types. SECTION_TYPE is either
1409 LTO_section_function_body or LTO_section_static_initializer. If
1410 section type is LTO_section_function_body, FN must be the decl for
1414 lto_read_body (struct lto_file_decl_data
*file_data
, tree fn_decl
,
1415 const char *data
, enum lto_section_type section_type
)
1417 const struct lto_function_header
*header
;
1418 struct data_in
*data_in
;
1420 int32_t main_offset
;
1421 int32_t string_offset
;
1422 struct lto_input_block ib_cfg
;
1423 struct lto_input_block ib_main
;
1425 header
= (const struct lto_function_header
*) data
;
1426 cfg_offset
= sizeof (struct lto_function_header
);
1427 main_offset
= cfg_offset
+ header
->cfg_size
;
1428 string_offset
= main_offset
+ header
->main_size
;
1430 LTO_INIT_INPUT_BLOCK (ib_cfg
,
1435 LTO_INIT_INPUT_BLOCK (ib_main
,
1440 data_in
= lto_data_in_create (file_data
, data
+ string_offset
,
1441 header
->string_size
, NULL
);
1443 /* Make sure the file was generated by the exact same compiler. */
1444 lto_check_version (header
->lto_header
.major_version
,
1445 header
->lto_header
.minor_version
);
1447 if (section_type
== LTO_section_function_body
)
1449 struct function
*fn
= DECL_STRUCT_FUNCTION (fn_decl
);
1450 struct lto_in_decl_state
*decl_state
;
1451 struct cgraph_node
*node
= cgraph_get_node (fn_decl
);
1453 gcc_checking_assert (node
);
1457 /* Use the function's decl state. */
1458 decl_state
= lto_get_function_in_decl_state (file_data
, fn_decl
);
1459 gcc_assert (decl_state
);
1460 file_data
->current_decl_state
= decl_state
;
1462 input_cfg (&ib_cfg
, fn
, node
->count_materialization_scale
);
1464 /* Set up the struct function. */
1465 input_function (fn_decl
, data_in
, &ib_main
);
1467 /* We should now be in SSA. */
1468 cfun
->gimple_df
->in_ssa_p
= true;
1470 /* Restore decl state */
1471 file_data
->current_decl_state
= file_data
->global_decl_state
;
1477 input_alias_pairs (&ib_main
, data_in
);
1480 clear_line_info (data_in
);
1481 lto_data_in_delete (data_in
);
1485 /* Read the body of FN_DECL using DATA. FILE_DATA holds the global
1489 lto_input_function_body (struct lto_file_decl_data
*file_data
,
1490 tree fn_decl
, const char *data
)
1492 current_function_decl
= fn_decl
;
1493 lto_read_body (file_data
, fn_decl
, data
, LTO_section_function_body
);
1497 /* Read in VAR_DECL using DATA. FILE_DATA holds the global decls and
1501 lto_input_constructors_and_inits (struct lto_file_decl_data
*file_data
,
1504 lto_read_body (file_data
, NULL
, data
, LTO_section_static_initializer
);
1508 /* Return the resolution for the decl with index INDEX from DATA_IN. */
1510 static enum ld_plugin_symbol_resolution
1511 get_resolution (struct data_in
*data_in
, unsigned index
)
1513 if (data_in
->globals_resolution
)
1515 ld_plugin_symbol_resolution_t ret
;
1516 /* We can have references to not emitted functions in
1517 DECL_FUNCTION_PERSONALITY at least. So we can and have
1518 to indeed return LDPR_UNKNOWN in some cases. */
1519 if (VEC_length (ld_plugin_symbol_resolution_t
,
1520 data_in
->globals_resolution
) <= index
)
1521 return LDPR_UNKNOWN
;
1522 ret
= VEC_index (ld_plugin_symbol_resolution_t
,
1523 data_in
->globals_resolution
,
1528 /* Delay resolution finding until decl merging. */
1529 return LDPR_UNKNOWN
;
1533 /* Unpack all the non-pointer fields of the TS_BASE structure of
1534 expression EXPR from bitpack BP. */
1537 unpack_ts_base_value_fields (struct bitpack_d
*bp
, tree expr
)
1539 /* Note that the code for EXPR has already been unpacked to create EXPR in
1540 lto_materialize_tree. */
1543 TREE_SIDE_EFFECTS (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1544 TREE_CONSTANT (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1545 TREE_READONLY (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1547 /* TREE_PUBLIC is used on types to indicate that the type
1548 has a TYPE_CACHED_VALUES vector. This is not streamed out,
1549 so we skip it here. */
1550 TREE_PUBLIC (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1553 bp_unpack_value (bp
, 4);
1554 TREE_ADDRESSABLE (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1555 TREE_THIS_VOLATILE (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1557 DECL_UNSIGNED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1558 else if (TYPE_P (expr
))
1559 TYPE_UNSIGNED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1561 bp_unpack_value (bp
, 1);
1562 TREE_ASM_WRITTEN (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1563 TREE_NO_WARNING (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1564 TREE_USED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1565 TREE_NOTHROW (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1566 TREE_STATIC (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1567 TREE_PRIVATE (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1568 TREE_PROTECTED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1569 TREE_DEPRECATED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1572 TYPE_SATURATING (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1573 TYPE_ADDR_SPACE (expr
) = (unsigned) bp_unpack_value (bp
, 8);
1575 else if (TREE_CODE (expr
) == SSA_NAME
)
1576 SSA_NAME_IS_DEFAULT_DEF (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1578 bp_unpack_value (bp
, 1);
1582 /* Unpack all the non-pointer fields of the TS_REAL_CST structure of
1583 expression EXPR from bitpack BP. */
1586 unpack_ts_real_cst_value_fields (struct bitpack_d
*bp
, tree expr
)
1590 REAL_VALUE_TYPE
*rp
;
1592 r
.cl
= (unsigned) bp_unpack_value (bp
, 2);
1593 r
.decimal
= (unsigned) bp_unpack_value (bp
, 1);
1594 r
.sign
= (unsigned) bp_unpack_value (bp
, 1);
1595 r
.signalling
= (unsigned) bp_unpack_value (bp
, 1);
1596 r
.canonical
= (unsigned) bp_unpack_value (bp
, 1);
1597 r
.uexp
= (unsigned) bp_unpack_value (bp
, EXP_BITS
);
1598 for (i
= 0; i
< SIGSZ
; i
++)
1599 r
.sig
[i
] = (unsigned long) bp_unpack_value (bp
, HOST_BITS_PER_LONG
);
1601 rp
= ggc_alloc_real_value ();
1602 memcpy (rp
, &r
, sizeof (REAL_VALUE_TYPE
));
1603 TREE_REAL_CST_PTR (expr
) = rp
;
1607 /* Unpack all the non-pointer fields of the TS_FIXED_CST structure of
1608 expression EXPR from bitpack BP. */
1611 unpack_ts_fixed_cst_value_fields (struct bitpack_d
*bp
, tree expr
)
1613 struct fixed_value fv
;
1615 fv
.data
.low
= (HOST_WIDE_INT
) bp_unpack_value (bp
, HOST_BITS_PER_WIDE_INT
);
1616 fv
.data
.high
= (HOST_WIDE_INT
) bp_unpack_value (bp
, HOST_BITS_PER_WIDE_INT
);
1617 fv
.mode
= (enum machine_mode
) bp_unpack_value (bp
, HOST_BITS_PER_INT
);
1618 TREE_FIXED_CST (expr
) = fv
;
1622 /* Unpack all the non-pointer fields of the TS_DECL_COMMON structure
1623 of expression EXPR from bitpack BP. */
1626 unpack_ts_decl_common_value_fields (struct bitpack_d
*bp
, tree expr
)
1628 DECL_MODE (expr
) = (enum machine_mode
) bp_unpack_value (bp
, 8);
1629 DECL_NONLOCAL (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1630 DECL_VIRTUAL_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1631 DECL_IGNORED_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1632 DECL_ABSTRACT (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1633 DECL_ARTIFICIAL (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1634 DECL_USER_ALIGN (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1635 DECL_PRESERVE_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1636 DECL_DEBUG_EXPR_IS_FROM (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1637 DECL_EXTERNAL (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1638 DECL_GIMPLE_REG_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1639 DECL_ALIGN (expr
) = (unsigned) bp_unpack_value (bp
, HOST_BITS_PER_INT
);
1641 if (TREE_CODE (expr
) == LABEL_DECL
)
1643 DECL_ERROR_ISSUED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1644 EH_LANDING_PAD_NR (expr
) = (int) bp_unpack_value (bp
, HOST_BITS_PER_INT
);
1646 /* Always assume an initial value of -1 for LABEL_DECL_UID to
1647 force gimple_set_bb to recreate label_to_block_map. */
1648 LABEL_DECL_UID (expr
) = -1;
1651 if (TREE_CODE (expr
) == FIELD_DECL
)
1653 unsigned HOST_WIDE_INT off_align
;
1654 DECL_PACKED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1655 DECL_NONADDRESSABLE_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1656 off_align
= (unsigned HOST_WIDE_INT
) bp_unpack_value (bp
, 8);
1657 SET_DECL_OFFSET_ALIGN (expr
, off_align
);
1660 if (TREE_CODE (expr
) == RESULT_DECL
1661 || TREE_CODE (expr
) == PARM_DECL
1662 || TREE_CODE (expr
) == VAR_DECL
)
1664 DECL_BY_REFERENCE (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1665 if (TREE_CODE (expr
) == VAR_DECL
1666 || TREE_CODE (expr
) == PARM_DECL
)
1667 DECL_HAS_VALUE_EXPR_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1668 DECL_RESTRICTED_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1673 /* Unpack all the non-pointer fields of the TS_DECL_WRTL structure
1674 of expression EXPR from bitpack BP. */
1677 unpack_ts_decl_wrtl_value_fields (struct bitpack_d
*bp
, tree expr
)
1679 DECL_REGISTER (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1683 /* Unpack all the non-pointer fields of the TS_DECL_WITH_VIS structure
1684 of expression EXPR from bitpack BP. */
1687 unpack_ts_decl_with_vis_value_fields (struct bitpack_d
*bp
, tree expr
)
1689 DECL_DEFER_OUTPUT (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1690 DECL_COMMON (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1691 DECL_DLLIMPORT_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1692 DECL_WEAK (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1693 DECL_SEEN_IN_BIND_EXPR_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1694 DECL_COMDAT (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1695 DECL_VISIBILITY (expr
) = (enum symbol_visibility
) bp_unpack_value (bp
, 2);
1696 DECL_VISIBILITY_SPECIFIED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1698 if (TREE_CODE (expr
) == VAR_DECL
)
1700 DECL_HARD_REGISTER (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1701 DECL_IN_TEXT_SECTION (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1702 DECL_IN_CONSTANT_POOL (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1703 DECL_TLS_MODEL (expr
) = (enum tls_model
) bp_unpack_value (bp
, 3);
1706 if (VAR_OR_FUNCTION_DECL_P (expr
))
1709 p
= (priority_type
) bp_unpack_value (bp
, HOST_BITS_PER_SHORT
);
1710 SET_DECL_INIT_PRIORITY (expr
, p
);
1715 /* Unpack all the non-pointer fields of the TS_FUNCTION_DECL structure
1716 of expression EXPR from bitpack BP. */
1719 unpack_ts_function_decl_value_fields (struct bitpack_d
*bp
, tree expr
)
1721 DECL_FUNCTION_CODE (expr
) = (enum built_in_function
) bp_unpack_value (bp
, 11);
1722 DECL_BUILT_IN_CLASS (expr
) = (enum built_in_class
) bp_unpack_value (bp
, 2);
1723 DECL_STATIC_CONSTRUCTOR (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1724 DECL_STATIC_DESTRUCTOR (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1725 DECL_UNINLINABLE (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1726 DECL_POSSIBLY_INLINED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1727 DECL_IS_NOVOPS (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1728 DECL_IS_RETURNS_TWICE (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1729 DECL_IS_MALLOC (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1730 DECL_IS_OPERATOR_NEW (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1731 DECL_DECLARED_INLINE_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1732 DECL_STATIC_CHAIN (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1733 DECL_NO_INLINE_WARNING_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1734 DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr
)
1735 = (unsigned) bp_unpack_value (bp
, 1);
1736 DECL_NO_LIMIT_STACK (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1737 DECL_DISREGARD_INLINE_LIMITS (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1738 DECL_PURE_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1739 DECL_LOOPING_CONST_OR_PURE_P (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1740 if (DECL_STATIC_DESTRUCTOR (expr
))
1742 priority_type p
= (priority_type
) bp_unpack_value (bp
, HOST_BITS_PER_SHORT
);
1743 SET_DECL_FINI_PRIORITY (expr
, p
);
1748 /* Unpack all the non-pointer fields of the TS_TYPE structure
1749 of expression EXPR from bitpack BP. */
1752 unpack_ts_type_value_fields (struct bitpack_d
*bp
, tree expr
)
1754 enum machine_mode mode
;
1756 TYPE_PRECISION (expr
) = (unsigned) bp_unpack_value (bp
, 10);
1757 mode
= (enum machine_mode
) bp_unpack_value (bp
, 8);
1758 SET_TYPE_MODE (expr
, mode
);
1759 TYPE_STRING_FLAG (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1760 TYPE_NO_FORCE_BLK (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1761 TYPE_NEEDS_CONSTRUCTING (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1762 if (RECORD_OR_UNION_TYPE_P (expr
))
1763 TYPE_TRANSPARENT_AGGR (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1764 TYPE_PACKED (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1765 TYPE_RESTRICT (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1766 TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr
)
1767 = (unsigned) bp_unpack_value (bp
, 2);
1768 TYPE_USER_ALIGN (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1769 TYPE_READONLY (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1770 TYPE_ALIGN (expr
) = (unsigned) bp_unpack_value (bp
, HOST_BITS_PER_INT
);
1771 TYPE_ALIAS_SET (expr
) = bp_unpack_value (bp
, BITS_PER_BITPACK_WORD
);
1775 /* Unpack all the non-pointer fields of the TS_BLOCK structure
1776 of expression EXPR from bitpack BP. */
1779 unpack_ts_block_value_fields (struct bitpack_d
*bp
, tree expr
)
1781 BLOCK_ABSTRACT (expr
) = (unsigned) bp_unpack_value (bp
, 1);
1782 BLOCK_NUMBER (expr
) = (unsigned) bp_unpack_value (bp
, 31);
1785 /* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
1786 structure of expression EXPR from bitpack BP. */
1789 unpack_ts_translation_unit_decl_value_fields (struct bitpack_d
*bp ATTRIBUTE_UNUSED
, tree expr ATTRIBUTE_UNUSED
)
1793 /* Unpack all the non-pointer fields in EXPR into a bit pack. */
1796 unpack_value_fields (struct bitpack_d
*bp
, tree expr
)
1798 enum tree_code code
;
1800 code
= TREE_CODE (expr
);
1802 /* Note that all these functions are highly sensitive to changes in
1803 the types and sizes of each of the fields being packed. */
1804 unpack_ts_base_value_fields (bp
, expr
);
1806 if (CODE_CONTAINS_STRUCT (code
, TS_REAL_CST
))
1807 unpack_ts_real_cst_value_fields (bp
, expr
);
1809 if (CODE_CONTAINS_STRUCT (code
, TS_FIXED_CST
))
1810 unpack_ts_fixed_cst_value_fields (bp
, expr
);
1812 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
1813 unpack_ts_decl_common_value_fields (bp
, expr
);
1815 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
1816 unpack_ts_decl_wrtl_value_fields (bp
, expr
);
1818 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
1819 unpack_ts_decl_with_vis_value_fields (bp
, expr
);
1821 if (CODE_CONTAINS_STRUCT (code
, TS_FUNCTION_DECL
))
1822 unpack_ts_function_decl_value_fields (bp
, expr
);
1824 if (CODE_CONTAINS_STRUCT (code
, TS_TYPE
))
1825 unpack_ts_type_value_fields (bp
, expr
);
1827 if (CODE_CONTAINS_STRUCT (code
, TS_BLOCK
))
1828 unpack_ts_block_value_fields (bp
, expr
);
1830 if (CODE_CONTAINS_STRUCT (code
, TS_TRANSLATION_UNIT_DECL
))
1831 unpack_ts_translation_unit_decl_value_fields (bp
, expr
);
1833 if (streamer_hooks ()->unpack_value_fields
)
1834 streamer_hooks ()->unpack_value_fields (bp
, expr
);
1838 /* Materialize a new tree from input block IB using descriptors in
1839 DATA_IN. The code for the new tree should match TAG. Store in
1840 *IX_P the index into the reader cache where the new tree is stored. */
1843 lto_materialize_tree (struct lto_input_block
*ib
, struct data_in
*data_in
,
1846 struct bitpack_d bp
;
1847 enum tree_code code
;
1849 #ifdef LTO_STREAMER_DEBUG
1850 HOST_WIDEST_INT orig_address_in_writer
;
1855 #ifdef LTO_STREAMER_DEBUG
1856 /* Read the word representing the memory address for the tree
1857 as it was written by the writer. This is useful when
1858 debugging differences between the writer and reader. */
1859 orig_address_in_writer
= lto_input_sleb128 (ib
);
1860 gcc_assert ((intptr_t) orig_address_in_writer
== orig_address_in_writer
);
1863 code
= lto_tag_to_tree_code (tag
);
1865 /* We should never see an SSA_NAME tree. Only the version numbers of
1866 SSA names are ever written out. See input_ssa_names. */
1867 gcc_assert (code
!= SSA_NAME
);
1869 /* Instantiate a new tree using the header data. */
1870 if (CODE_CONTAINS_STRUCT (code
, TS_STRING
))
1871 result
= input_string_cst (data_in
, ib
);
1872 else if (CODE_CONTAINS_STRUCT (code
, TS_IDENTIFIER
))
1873 result
= input_identifier (data_in
, ib
);
1874 else if (CODE_CONTAINS_STRUCT (code
, TS_VEC
))
1876 HOST_WIDE_INT len
= lto_input_sleb128 (ib
);
1877 result
= make_tree_vec (len
);
1879 else if (CODE_CONTAINS_STRUCT (code
, TS_BINFO
))
1881 unsigned HOST_WIDE_INT len
= lto_input_uleb128 (ib
);
1882 result
= make_tree_binfo (len
);
1886 /* For all other nodes, see if the streamer knows how to allocate
1888 if (streamer_hooks ()->alloc_tree
)
1889 result
= streamer_hooks ()->alloc_tree (code
, ib
, data_in
);
1891 /* If the hook did not handle it, materialize the tree with a raw
1893 if (result
== NULL_TREE
)
1894 result
= make_node (code
);
1897 #ifdef LTO_STREAMER_DEBUG
1898 /* Store the original address of the tree as seen by the writer
1899 in RESULT's aux field. This is useful when debugging streaming
1900 problems. This way, a debugging session can be started on
1901 both writer and reader with a breakpoint using this address
1903 lto_orig_address_map (result
, (intptr_t) orig_address_in_writer
);
1906 /* Read the bitpack of non-pointer values from IB. */
1907 bp
= lto_input_bitpack (ib
);
1909 /* The first word in BP contains the code of the tree that we
1910 are about to read. */
1911 code
= (enum tree_code
) bp_unpack_value (&bp
, 16);
1912 lto_tag_check (lto_tree_code_to_tag (code
), tag
);
1914 /* Unpack all the value fields from BP. */
1915 unpack_value_fields (&bp
, result
);
1917 /* Enter RESULT in the reader cache. This will make RESULT
1918 available so that circular references in the rest of the tree
1919 structure can be resolved in subsequent calls to lto_input_tree. */
1920 lto_streamer_cache_append (data_in
->reader_cache
, result
);
1926 /* Read all pointer fields in the TS_COMMON structure of EXPR from input
1927 block IB. DATA_IN contains tables and descriptors for the
1932 lto_input_ts_common_tree_pointers (struct lto_input_block
*ib
,
1933 struct data_in
*data_in
, tree expr
)
1935 if (TREE_CODE (expr
) != IDENTIFIER_NODE
)
1936 TREE_TYPE (expr
) = lto_input_tree (ib
, data_in
);
1940 /* Read all pointer fields in the TS_VECTOR structure of EXPR from input
1941 block IB. DATA_IN contains tables and descriptors for the
1945 lto_input_ts_vector_tree_pointers (struct lto_input_block
*ib
,
1946 struct data_in
*data_in
, tree expr
)
1948 TREE_VECTOR_CST_ELTS (expr
) = lto_input_chain (ib
, data_in
);
1952 /* Read all pointer fields in the TS_COMPLEX structure of EXPR from input
1953 block IB. DATA_IN contains tables and descriptors for the
1957 lto_input_ts_complex_tree_pointers (struct lto_input_block
*ib
,
1958 struct data_in
*data_in
, tree expr
)
1960 TREE_REALPART (expr
) = lto_input_tree (ib
, data_in
);
1961 TREE_IMAGPART (expr
) = lto_input_tree (ib
, data_in
);
1965 /* Read all pointer fields in the TS_DECL_MINIMAL structure of EXPR
1966 from input block IB. DATA_IN contains tables and descriptors for the
1970 lto_input_ts_decl_minimal_tree_pointers (struct lto_input_block
*ib
,
1971 struct data_in
*data_in
, tree expr
)
1973 DECL_NAME (expr
) = lto_input_tree (ib
, data_in
);
1974 DECL_CONTEXT (expr
) = lto_input_tree (ib
, data_in
);
1975 DECL_SOURCE_LOCATION (expr
) = lto_input_location (ib
, data_in
);
1979 /* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from
1980 input block IB. DATA_IN contains tables and descriptors for the
1984 lto_input_ts_decl_common_tree_pointers (struct lto_input_block
*ib
,
1985 struct data_in
*data_in
, tree expr
)
1987 DECL_SIZE (expr
) = lto_input_tree (ib
, data_in
);
1988 DECL_SIZE_UNIT (expr
) = lto_input_tree (ib
, data_in
);
1989 DECL_ATTRIBUTES (expr
) = lto_input_tree (ib
, data_in
);
1991 /* Do not stream DECL_ABSTRACT_ORIGIN. We cannot handle debug information
1992 for early inlining so drop it on the floor instead of ICEing in
1995 if (TREE_CODE (expr
) == PARM_DECL
)
1996 TREE_CHAIN (expr
) = lto_input_chain (ib
, data_in
);
1998 if ((TREE_CODE (expr
) == VAR_DECL
1999 || TREE_CODE (expr
) == PARM_DECL
)
2000 && DECL_HAS_VALUE_EXPR_P (expr
))
2001 SET_DECL_VALUE_EXPR (expr
, lto_input_tree (ib
, data_in
));
2003 if (TREE_CODE (expr
) == VAR_DECL
)
2005 tree dexpr
= lto_input_tree (ib
, data_in
);
2007 SET_DECL_DEBUG_EXPR (expr
, dexpr
);
2012 /* Read all pointer fields in the TS_DECL_NON_COMMON structure of
2013 EXPR from input block IB. DATA_IN contains tables and descriptors for the
2017 lto_input_ts_decl_non_common_tree_pointers (struct lto_input_block
*ib
,
2018 struct data_in
*data_in
, tree expr
)
2020 if (TREE_CODE (expr
) == FUNCTION_DECL
)
2022 DECL_ARGUMENTS (expr
) = lto_input_tree (ib
, data_in
);
2023 DECL_RESULT (expr
) = lto_input_tree (ib
, data_in
);
2025 DECL_VINDEX (expr
) = lto_input_tree (ib
, data_in
);
2029 /* Read all pointer fields in the TS_DECL_WITH_VIS structure of EXPR
2030 from input block IB. DATA_IN contains tables and descriptors for the
2034 lto_input_ts_decl_with_vis_tree_pointers (struct lto_input_block
*ib
,
2035 struct data_in
*data_in
, tree expr
)
2039 id
= lto_input_tree (ib
, data_in
);
2042 gcc_assert (TREE_CODE (id
) == IDENTIFIER_NODE
);
2043 SET_DECL_ASSEMBLER_NAME (expr
, id
);
2046 DECL_SECTION_NAME (expr
) = lto_input_tree (ib
, data_in
);
2047 DECL_COMDAT_GROUP (expr
) = lto_input_tree (ib
, data_in
);
2051 /* Read all pointer fields in the TS_FIELD_DECL structure of EXPR from
2052 input block IB. DATA_IN contains tables and descriptors for the
2056 lto_input_ts_field_decl_tree_pointers (struct lto_input_block
*ib
,
2057 struct data_in
*data_in
, tree expr
)
2059 DECL_FIELD_OFFSET (expr
) = lto_input_tree (ib
, data_in
);
2060 DECL_BIT_FIELD_TYPE (expr
) = lto_input_tree (ib
, data_in
);
2061 DECL_QUALIFIER (expr
) = lto_input_tree (ib
, data_in
);
2062 DECL_FIELD_BIT_OFFSET (expr
) = lto_input_tree (ib
, data_in
);
2063 DECL_FCONTEXT (expr
) = lto_input_tree (ib
, data_in
);
2064 TREE_CHAIN (expr
) = lto_input_chain (ib
, data_in
);
2068 /* Read all pointer fields in the TS_FUNCTION_DECL structure of EXPR
2069 from input block IB. DATA_IN contains tables and descriptors for the
2073 lto_input_ts_function_decl_tree_pointers (struct lto_input_block
*ib
,
2074 struct data_in
*data_in
, tree expr
)
2076 /* DECL_STRUCT_FUNCTION is handled by lto_input_function. FIXME lto,
2077 maybe it should be handled here? */
2078 DECL_FUNCTION_PERSONALITY (expr
) = lto_input_tree (ib
, data_in
);
2079 DECL_FUNCTION_SPECIFIC_TARGET (expr
) = lto_input_tree (ib
, data_in
);
2080 DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr
) = lto_input_tree (ib
, data_in
);
2082 /* If the file contains a function with an EH personality set,
2083 then it was compiled with -fexceptions. In that case, initialize
2084 the backend EH machinery. */
2085 if (DECL_FUNCTION_PERSONALITY (expr
))
2090 /* Read all pointer fields in the TS_TYPE structure of EXPR from input
2091 block IB. DATA_IN contains tables and descriptors for the
2095 lto_input_ts_type_tree_pointers (struct lto_input_block
*ib
,
2096 struct data_in
*data_in
, tree expr
)
2098 if (TREE_CODE (expr
) == ENUMERAL_TYPE
)
2099 TYPE_VALUES (expr
) = lto_input_tree (ib
, data_in
);
2100 else if (TREE_CODE (expr
) == ARRAY_TYPE
)
2101 TYPE_DOMAIN (expr
) = lto_input_tree (ib
, data_in
);
2102 else if (RECORD_OR_UNION_TYPE_P (expr
))
2103 TYPE_FIELDS (expr
) = lto_input_tree (ib
, data_in
);
2104 else if (TREE_CODE (expr
) == FUNCTION_TYPE
2105 || TREE_CODE (expr
) == METHOD_TYPE
)
2106 TYPE_ARG_TYPES (expr
) = lto_input_tree (ib
, data_in
);
2108 TYPE_SIZE (expr
) = lto_input_tree (ib
, data_in
);
2109 TYPE_SIZE_UNIT (expr
) = lto_input_tree (ib
, data_in
);
2110 TYPE_ATTRIBUTES (expr
) = lto_input_tree (ib
, data_in
);
2111 TYPE_NAME (expr
) = lto_input_tree (ib
, data_in
);
2112 /* Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO nor
2113 TYPE_NEXT_PTR_TO or TYPE_NEXT_REF_TO. */
2114 if (!POINTER_TYPE_P (expr
))
2115 TYPE_MINVAL (expr
) = lto_input_tree (ib
, data_in
);
2116 TYPE_MAXVAL (expr
) = lto_input_tree (ib
, data_in
);
2117 TYPE_MAIN_VARIANT (expr
) = lto_input_tree (ib
, data_in
);
2118 /* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
2120 if (RECORD_OR_UNION_TYPE_P (expr
))
2121 TYPE_BINFO (expr
) = lto_input_tree (ib
, data_in
);
2122 TYPE_CONTEXT (expr
) = lto_input_tree (ib
, data_in
);
2123 /* TYPE_CANONICAL gets re-computed during type merging. */
2124 TYPE_CANONICAL (expr
) = NULL_TREE
;
2125 TYPE_STUB_DECL (expr
) = lto_input_tree (ib
, data_in
);
2129 /* Read all pointer fields in the TS_LIST structure of EXPR from input
2130 block IB. DATA_IN contains tables and descriptors for the
2134 lto_input_ts_list_tree_pointers (struct lto_input_block
*ib
,
2135 struct data_in
*data_in
, tree expr
)
2137 TREE_PURPOSE (expr
) = lto_input_tree (ib
, data_in
);
2138 TREE_VALUE (expr
) = lto_input_tree (ib
, data_in
);
2139 TREE_CHAIN (expr
) = lto_input_chain (ib
, data_in
);
2143 /* Read all pointer fields in the TS_VEC structure of EXPR from input
2144 block IB. DATA_IN contains tables and descriptors for the
2148 lto_input_ts_vec_tree_pointers (struct lto_input_block
*ib
,
2149 struct data_in
*data_in
, tree expr
)
2153 /* Note that TREE_VEC_LENGTH was read by lto_materialize_tree to
2154 instantiate EXPR. */
2155 for (i
= 0; i
< TREE_VEC_LENGTH (expr
); i
++)
2156 TREE_VEC_ELT (expr
, i
) = lto_input_tree (ib
, data_in
);
2160 /* Read all pointer fields in the TS_EXP structure of EXPR from input
2161 block IB. DATA_IN contains tables and descriptors for the
2166 lto_input_ts_exp_tree_pointers (struct lto_input_block
*ib
,
2167 struct data_in
*data_in
, tree expr
)
2172 length
= lto_input_sleb128 (ib
);
2173 gcc_assert (length
== TREE_OPERAND_LENGTH (expr
));
2175 for (i
= 0; i
< length
; i
++)
2176 TREE_OPERAND (expr
, i
) = lto_input_tree (ib
, data_in
);
2178 loc
= lto_input_location (ib
, data_in
);
2179 SET_EXPR_LOCATION (expr
, loc
);
2180 TREE_BLOCK (expr
) = lto_input_tree (ib
, data_in
);
2184 /* Read all pointer fields in the TS_BLOCK structure of EXPR from input
2185 block IB. DATA_IN contains tables and descriptors for the
2189 lto_input_ts_block_tree_pointers (struct lto_input_block
*ib
,
2190 struct data_in
*data_in
, tree expr
)
2192 /* Do not stream BLOCK_SOURCE_LOCATION. We cannot handle debug information
2193 for early inlining so drop it on the floor instead of ICEing in
2195 BLOCK_VARS (expr
) = lto_input_chain (ib
, data_in
);
2197 /* Do not stream BLOCK_NONLOCALIZED_VARS. We cannot handle debug information
2198 for early inlining so drop it on the floor instead of ICEing in
2201 BLOCK_SUPERCONTEXT (expr
) = lto_input_tree (ib
, data_in
);
2202 /* Do not stream BLOCK_ABSTRACT_ORIGIN. We cannot handle debug information
2203 for early inlining so drop it on the floor instead of ICEing in
2205 BLOCK_FRAGMENT_ORIGIN (expr
) = lto_input_tree (ib
, data_in
);
2206 BLOCK_FRAGMENT_CHAIN (expr
) = lto_input_tree (ib
, data_in
);
2207 /* We re-compute BLOCK_SUBBLOCKS of our parent here instead
2208 of streaming it. For non-BLOCK BLOCK_SUPERCONTEXTs we still
2209 stream the child relationship explicitly. */
2210 if (BLOCK_SUPERCONTEXT (expr
)
2211 && TREE_CODE (BLOCK_SUPERCONTEXT (expr
)) == BLOCK
)
2213 BLOCK_CHAIN (expr
) = BLOCK_SUBBLOCKS (BLOCK_SUPERCONTEXT (expr
));
2214 BLOCK_SUBBLOCKS (BLOCK_SUPERCONTEXT (expr
)) = expr
;
2216 /* The global block is rooted at the TU decl. Hook it here to
2217 avoid the need to stream in this block during WPA time. */
2218 else if (BLOCK_SUPERCONTEXT (expr
)
2219 && TREE_CODE (BLOCK_SUPERCONTEXT (expr
)) == TRANSLATION_UNIT_DECL
)
2220 DECL_INITIAL (BLOCK_SUPERCONTEXT (expr
)) = expr
;
2221 /* The function-level block is connected at the time we read in
2222 function bodies for the same reason. */
2226 /* Read all pointer fields in the TS_BINFO structure of EXPR from input
2227 block IB. DATA_IN contains tables and descriptors for the
2231 lto_input_ts_binfo_tree_pointers (struct lto_input_block
*ib
,
2232 struct data_in
*data_in
, tree expr
)
2237 /* Note that the number of slots in EXPR was read in
2238 lto_materialize_tree when instantiating EXPR. However, the
2239 vector is empty so we cannot rely on VEC_length to know how many
2240 elements to read. So, this list is emitted as a 0-terminated
2241 list on the writer side. */
2244 t
= lto_input_tree (ib
, data_in
);
2246 VEC_quick_push (tree
, BINFO_BASE_BINFOS (expr
), t
);
2250 BINFO_OFFSET (expr
) = lto_input_tree (ib
, data_in
);
2251 BINFO_VTABLE (expr
) = lto_input_tree (ib
, data_in
);
2252 BINFO_VIRTUALS (expr
) = lto_input_tree (ib
, data_in
);
2253 BINFO_VPTR_FIELD (expr
) = lto_input_tree (ib
, data_in
);
2255 len
= lto_input_uleb128 (ib
);
2258 VEC_reserve_exact (tree
, gc
, BINFO_BASE_ACCESSES (expr
), len
);
2259 for (i
= 0; i
< len
; i
++)
2261 tree a
= lto_input_tree (ib
, data_in
);
2262 VEC_quick_push (tree
, BINFO_BASE_ACCESSES (expr
), a
);
2266 BINFO_INHERITANCE_CHAIN (expr
) = lto_input_tree (ib
, data_in
);
2267 BINFO_SUBVTT_INDEX (expr
) = lto_input_tree (ib
, data_in
);
2268 BINFO_VPTR_INDEX (expr
) = lto_input_tree (ib
, data_in
);
2272 /* Read all pointer fields in the TS_CONSTRUCTOR structure of EXPR from
2273 input block IB. DATA_IN contains tables and descriptors for the
2277 lto_input_ts_constructor_tree_pointers (struct lto_input_block
*ib
,
2278 struct data_in
*data_in
, tree expr
)
2282 len
= lto_input_uleb128 (ib
);
2283 for (i
= 0; i
< len
; i
++)
2287 index
= lto_input_tree (ib
, data_in
);
2288 value
= lto_input_tree (ib
, data_in
);
2289 CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (expr
), index
, value
);
2294 /* Input a TS_TARGET_OPTION tree from IB into EXPR. */
2297 lto_input_ts_target_option (struct lto_input_block
*ib
, tree expr
)
2300 struct bitpack_d bp
;
2301 struct cl_target_option
*t
= TREE_TARGET_OPTION (expr
);
2303 bp
= lto_input_bitpack (ib
);
2304 len
= sizeof (struct cl_target_option
);
2305 for (i
= 0; i
< len
; i
++)
2306 ((unsigned char *)t
)[i
] = bp_unpack_value (&bp
, 8);
2307 if (bp_unpack_value (&bp
, 32) != 0x12345678)
2308 fatal_error ("cl_target_option size mismatch in LTO reader and writer");
2311 /* Input a TS_TRANSLATION_UNIT_DECL tree from IB and DATA_IN into EXPR. */
2314 lto_input_ts_translation_unit_decl_tree_pointers (struct lto_input_block
*ib
,
2315 struct data_in
*data_in
,
2318 TRANSLATION_UNIT_LANGUAGE (expr
) = xstrdup (lto_input_string (data_in
, ib
));
2319 VEC_safe_push (tree
, gc
, all_translation_units
, expr
);
2322 /* Helper for lto_input_tree. Read all pointer fields in EXPR from
2323 input block IB. DATA_IN contains tables and descriptors for the
2327 lto_input_tree_pointers (struct lto_input_block
*ib
, struct data_in
*data_in
,
2330 enum tree_code code
;
2332 code
= TREE_CODE (expr
);
2334 if (CODE_CONTAINS_STRUCT (code
, TS_TYPED
))
2335 lto_input_ts_common_tree_pointers (ib
, data_in
, expr
);
2337 if (CODE_CONTAINS_STRUCT (code
, TS_VECTOR
))
2338 lto_input_ts_vector_tree_pointers (ib
, data_in
, expr
);
2340 if (CODE_CONTAINS_STRUCT (code
, TS_COMPLEX
))
2341 lto_input_ts_complex_tree_pointers (ib
, data_in
, expr
);
2343 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_MINIMAL
))
2344 lto_input_ts_decl_minimal_tree_pointers (ib
, data_in
, expr
);
2346 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
2347 lto_input_ts_decl_common_tree_pointers (ib
, data_in
, expr
);
2349 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
2350 lto_input_ts_decl_non_common_tree_pointers (ib
, data_in
, expr
);
2352 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
2353 lto_input_ts_decl_with_vis_tree_pointers (ib
, data_in
, expr
);
2355 if (CODE_CONTAINS_STRUCT (code
, TS_FIELD_DECL
))
2356 lto_input_ts_field_decl_tree_pointers (ib
, data_in
, expr
);
2358 if (CODE_CONTAINS_STRUCT (code
, TS_FUNCTION_DECL
))
2359 lto_input_ts_function_decl_tree_pointers (ib
, data_in
, expr
);
2361 if (CODE_CONTAINS_STRUCT (code
, TS_TYPE
))
2362 lto_input_ts_type_tree_pointers (ib
, data_in
, expr
);
2364 if (CODE_CONTAINS_STRUCT (code
, TS_LIST
))
2365 lto_input_ts_list_tree_pointers (ib
, data_in
, expr
);
2367 if (CODE_CONTAINS_STRUCT (code
, TS_VEC
))
2368 lto_input_ts_vec_tree_pointers (ib
, data_in
, expr
);
2370 if (CODE_CONTAINS_STRUCT (code
, TS_EXP
))
2371 lto_input_ts_exp_tree_pointers (ib
, data_in
, expr
);
2373 if (CODE_CONTAINS_STRUCT (code
, TS_BLOCK
))
2374 lto_input_ts_block_tree_pointers (ib
, data_in
, expr
);
2376 if (CODE_CONTAINS_STRUCT (code
, TS_BINFO
))
2377 lto_input_ts_binfo_tree_pointers (ib
, data_in
, expr
);
2379 if (CODE_CONTAINS_STRUCT (code
, TS_CONSTRUCTOR
))
2380 lto_input_ts_constructor_tree_pointers (ib
, data_in
, expr
);
2382 if (CODE_CONTAINS_STRUCT (code
, TS_TARGET_OPTION
))
2383 lto_input_ts_target_option (ib
, expr
);
2385 if (CODE_CONTAINS_STRUCT (code
, TS_TRANSLATION_UNIT_DECL
))
2386 lto_input_ts_translation_unit_decl_tree_pointers (ib
, data_in
, expr
);
2390 /* Register DECL with the global symbol table and change its
2391 name if necessary to avoid name clashes for static globals across
2395 lto_register_var_decl_in_symtab (struct data_in
*data_in
, tree decl
)
2399 /* Variable has file scope, not local. Need to ensure static variables
2400 between different files don't clash unexpectedly. */
2401 if (!TREE_PUBLIC (decl
)
2402 && !((context
= decl_function_context (decl
))
2403 && auto_var_in_fn_p (decl
, context
)))
2405 /* ??? We normally pre-mangle names before we serialize them
2406 out. Here, in lto1, we do not know the language, and
2407 thus cannot do the mangling again. Instead, we just
2408 append a suffix to the mangled name. The resulting name,
2409 however, is not a properly-formed mangled name, and will
2410 confuse any attempt to unmangle it. */
2411 const char *name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
2414 ASM_FORMAT_PRIVATE_NAME (label
, name
, DECL_UID (decl
));
2415 SET_DECL_ASSEMBLER_NAME (decl
, get_identifier (label
));
2416 rest_of_decl_compilation (decl
, 1, 0);
2418 VEC_safe_push (tree
, gc
, lto_global_var_decls
, decl
);
2421 /* If this variable has already been declared, queue the
2422 declaration for merging. */
2423 if (TREE_PUBLIC (decl
))
2426 if (!lto_streamer_cache_lookup (data_in
->reader_cache
, decl
, &ix
))
2428 lto_symtab_register_decl (decl
, get_resolution (data_in
, ix
),
2429 data_in
->file_data
);
2435 /* Register DECL with the global symbol table and change its
2436 name if necessary to avoid name clashes for static globals across
2437 different files. DATA_IN contains descriptors and tables for the
2441 lto_register_function_decl_in_symtab (struct data_in
*data_in
, tree decl
)
2443 /* Need to ensure static entities between different files
2444 don't clash unexpectedly. */
2445 if (!TREE_PUBLIC (decl
))
2447 /* We must not use the DECL_ASSEMBLER_NAME macro here, as it
2448 may set the assembler name where it was previously empty. */
2449 tree old_assembler_name
= decl
->decl_with_vis
.assembler_name
;
2451 /* FIXME lto: We normally pre-mangle names before we serialize
2452 them out. Here, in lto1, we do not know the language, and
2453 thus cannot do the mangling again. Instead, we just append a
2454 suffix to the mangled name. The resulting name, however, is
2455 not a properly-formed mangled name, and will confuse any
2456 attempt to unmangle it. */
2457 const char *name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
2460 ASM_FORMAT_PRIVATE_NAME (label
, name
, DECL_UID (decl
));
2461 SET_DECL_ASSEMBLER_NAME (decl
, get_identifier (label
));
2463 /* We may arrive here with the old assembler name not set
2464 if the function body is not needed, e.g., it has been
2465 inlined away and does not appear in the cgraph. */
2466 if (old_assembler_name
)
2468 tree new_assembler_name
= DECL_ASSEMBLER_NAME (decl
);
2470 /* Make the original assembler name available for later use.
2471 We may have used it to indicate the section within its
2472 object file where the function body may be found.
2473 FIXME lto: Find a better way to maintain the function decl
2474 to body section mapping so we don't need this hack. */
2475 lto_record_renamed_decl (data_in
->file_data
,
2476 IDENTIFIER_POINTER (old_assembler_name
),
2477 IDENTIFIER_POINTER (new_assembler_name
));
2479 /* Also register the reverse mapping so that we can find the
2480 new name given to an existing assembler name (used when
2481 restoring alias pairs in input_constructors_or_inits. */
2482 lto_record_renamed_decl (data_in
->file_data
,
2483 IDENTIFIER_POINTER (new_assembler_name
),
2484 IDENTIFIER_POINTER (old_assembler_name
));
2488 /* If this variable has already been declared, queue the
2489 declaration for merging. */
2490 if (TREE_PUBLIC (decl
) && !DECL_ABSTRACT (decl
))
2493 if (!lto_streamer_cache_lookup (data_in
->reader_cache
, decl
, &ix
))
2495 lto_symtab_register_decl (decl
, get_resolution (data_in
, ix
),
2496 data_in
->file_data
);
2501 /* Read an index IX from input block IB and return the tree node at
2502 DATA_IN->FILE_DATA->GLOBALS_INDEX[IX]. */
2505 lto_get_pickled_tree (struct lto_input_block
*ib
, struct data_in
*data_in
)
2507 unsigned HOST_WIDE_INT ix
;
2509 enum LTO_tags expected_tag
;
2511 ix
= lto_input_uleb128 (ib
);
2512 expected_tag
= (enum LTO_tags
) lto_input_uleb128 (ib
);
2514 result
= lto_streamer_cache_get (data_in
->reader_cache
, ix
);
2516 && TREE_CODE (result
) == lto_tag_to_tree_code (expected_tag
));
2522 /* Read a code and class from input block IB and return the
2523 corresponding builtin. DATA_IN is as in lto_input_tree. */
2526 lto_get_builtin_tree (struct lto_input_block
*ib
, struct data_in
*data_in
)
2528 enum built_in_class fclass
;
2529 enum built_in_function fcode
;
2530 const char *asmname
;
2533 fclass
= (enum built_in_class
) lto_input_uleb128 (ib
);
2534 gcc_assert (fclass
== BUILT_IN_NORMAL
|| fclass
== BUILT_IN_MD
);
2536 fcode
= (enum built_in_function
) lto_input_uleb128 (ib
);
2538 if (fclass
== BUILT_IN_NORMAL
)
2540 gcc_assert (fcode
< END_BUILTINS
);
2541 result
= built_in_decls
[fcode
];
2542 gcc_assert (result
);
2544 else if (fclass
== BUILT_IN_MD
)
2546 result
= targetm
.builtin_decl (fcode
, true);
2547 if (!result
|| result
== error_mark_node
)
2548 fatal_error ("target specific builtin not available");
2553 asmname
= lto_input_string (data_in
, ib
);
2555 set_builtin_user_assembler_name (result
, asmname
);
2557 lto_streamer_cache_append (data_in
->reader_cache
, result
);
2563 /* Read the physical representation of a tree node with tag TAG from
2564 input block IB using the per-file context in DATA_IN. */
2567 lto_read_tree (struct lto_input_block
*ib
, struct data_in
*data_in
,
2572 result
= lto_materialize_tree (ib
, data_in
, tag
);
2574 /* Read all the pointer fields in RESULT. */
2575 lto_input_tree_pointers (ib
, data_in
, result
);
2577 /* Call back into the streaming module to read anything else it
2579 if (streamer_hooks ()->read_tree
)
2580 streamer_hooks ()->read_tree (ib
, data_in
, result
);
2582 /* We should never try to instantiate an MD or NORMAL builtin here. */
2583 if (TREE_CODE (result
) == FUNCTION_DECL
)
2584 gcc_assert (!lto_stream_as_builtin_p (result
));
2586 if (streamer_hooks ()->register_decls_in_symtab_p
)
2588 if (TREE_CODE (result
) == VAR_DECL
)
2589 lto_register_var_decl_in_symtab (data_in
, result
);
2590 else if (TREE_CODE (result
) == FUNCTION_DECL
&& !DECL_BUILT_IN (result
))
2591 lto_register_function_decl_in_symtab (data_in
, result
);
2594 /* end_marker = */ lto_input_1_unsigned (ib
);
2596 #ifdef LTO_STREAMER_DEBUG
2597 /* Remove the mapping to RESULT's original address set by
2598 lto_materialize_tree. */
2599 lto_orig_address_remove (result
);
2606 /* LTO streamer hook for reading GIMPLE trees. IB and DATA_IN are as in
2607 lto_read_tree. EXPR is the tree was materialized by lto_read_tree and
2608 needs GIMPLE specific data to be filled in. */
2611 gimple_streamer_read_tree (struct lto_input_block
*ib
,
2612 struct data_in
*data_in
,
2616 && TREE_CODE (expr
) != FUNCTION_DECL
2617 && TREE_CODE (expr
) != TRANSLATION_UNIT_DECL
)
2618 DECL_INITIAL (expr
) = lto_input_tree (ib
, data_in
);
2622 /* Read and INTEGER_CST node from input block IB using the per-file
2623 context in DATA_IN. */
2626 lto_input_integer_cst (struct lto_input_block
*ib
, struct data_in
*data_in
)
2629 HOST_WIDE_INT low
, high
;
2632 type
= lto_input_tree (ib
, data_in
);
2633 overflow_p
= (lto_input_1_unsigned (ib
) != 0);
2634 low
= lto_input_uleb128 (ib
);
2635 high
= lto_input_uleb128 (ib
);
2636 result
= build_int_cst_wide (type
, low
, high
);
2638 /* If the original constant had overflown, build a replica of RESULT to
2639 avoid modifying the shared constant returned by build_int_cst_wide. */
2642 result
= copy_node (result
);
2643 TREE_OVERFLOW (result
) = 1;
2650 /* Read a tree from input block IB using the per-file context in
2651 DATA_IN. This context is used, for example, to resolve references
2652 to previously read nodes. */
2655 lto_input_tree (struct lto_input_block
*ib
, struct data_in
*data_in
)
2660 tag
= input_record_start (ib
);
2661 gcc_assert ((unsigned) tag
< (unsigned) LTO_NUM_TAGS
);
2663 if (tag
== LTO_null
)
2665 else if (tag
>= LTO_field_decl_ref
&& tag
<= LTO_global_decl_ref
)
2667 /* If TAG is a reference to an indexable tree, the next value
2668 in IB is the index into the table where we expect to find
2670 result
= lto_input_tree_ref (ib
, data_in
, cfun
, tag
);
2672 else if (tag
== LTO_tree_pickle_reference
)
2674 /* If TAG is a reference to a previously read tree, look it up in
2675 the reader cache. */
2676 result
= lto_get_pickled_tree (ib
, data_in
);
2678 else if (tag
== LTO_builtin_decl
)
2680 /* If we are going to read a built-in function, all we need is
2681 the code and class. */
2682 result
= lto_get_builtin_tree (ib
, data_in
);
2684 else if (tag
== lto_tree_code_to_tag (INTEGER_CST
))
2686 /* For integer constants we only need the type and its hi/low
2688 result
= lto_input_integer_cst (ib
, data_in
);
2692 /* Otherwise, materialize a new node from IB. */
2693 result
= lto_read_tree (ib
, data_in
, tag
);
2700 /* Initialization for the LTO reader. */
2703 lto_reader_init (void)
2705 lto_streamer_init ();
2706 file_name_hash_table
= htab_create (37, hash_string_slot_node
,
2707 eq_string_slot_node
, free
);
2708 if (streamer_hooks ()->reader_init
)
2709 streamer_hooks ()->reader_init ();
2713 /* GIMPLE streamer hook for initializing the LTO reader. */
2716 gimple_streamer_reader_init (void)
2718 memset (<o_stats
, 0, sizeof (lto_stats
));
2719 bitmap_obstack_initialize (NULL
);
2720 gimple_register_cfg_hooks ();
2724 /* Create a new data_in object for FILE_DATA. STRINGS is the string
2725 table to use with LEN strings. RESOLUTIONS is the vector of linker
2726 resolutions (NULL if not using a linker plugin). */
2729 lto_data_in_create (struct lto_file_decl_data
*file_data
, const char *strings
,
2731 VEC(ld_plugin_symbol_resolution_t
,heap
) *resolutions
)
2733 struct data_in
*data_in
= XCNEW (struct data_in
);
2734 data_in
->file_data
= file_data
;
2735 data_in
->strings
= strings
;
2736 data_in
->strings_len
= len
;
2737 data_in
->globals_resolution
= resolutions
;
2738 data_in
->reader_cache
= lto_streamer_cache_create ();
2744 /* Remove DATA_IN. */
2747 lto_data_in_delete (struct data_in
*data_in
)
2749 VEC_free (ld_plugin_symbol_resolution_t
, heap
, data_in
->globals_resolution
);
2750 lto_streamer_cache_delete (data_in
->reader_cache
);
2751 free (data_in
->labels
);