RISC-V: Make stack_save_restore tests more robust
[official-gcc.git] / gcc / lto-streamer-in.cc
blobd3128fcebe4b90bf8636f29688b23808c68ee8e2
1 /* Read the GIMPLE representation from a file stream.
3 Copyright (C) 2009-2023 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
12 version.
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
17 for more details.
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/>. */
23 #include "config.h"
24 #include "system.h"
25 #include "coretypes.h"
26 #include "backend.h"
27 #include "target.h"
28 #include "rtl.h"
29 #include "tree.h"
30 #include "gimple.h"
31 #include "cfghooks.h"
32 #include "tree-pass.h"
33 #include "ssa.h"
34 #include "gimple-streamer.h"
35 #include "toplev.h"
36 #include "gimple-iterator.h"
37 #include "tree-cfg.h"
38 #include "tree-into-ssa.h"
39 #include "tree-dfa.h"
40 #include "tree-ssa.h"
41 #include "except.h"
42 #include "cgraph.h"
43 #include "cfgloop.h"
44 #include "debug.h"
45 #include "alloc-pool.h"
46 #include "toplev.h"
48 /* Allocator used to hold string slot entries for line map streaming. */
49 static struct object_allocator<struct string_slot> *string_slot_allocator;
51 /* The table to hold the file names. */
52 static hash_table<string_slot_hasher> *file_name_hash_table;
54 /* The table to hold the relative pathname prefixes. */
56 /* This obstack holds file names used in locators. Line map datastructures
57 points here and thus it needs to be kept allocated as long as linemaps
58 exists. */
59 static struct obstack file_name_obstack;
61 /* Map a pair of nul terminated strings where the first one can be
62 pointer compared, but the second can't, to another string. */
63 struct string_pair_map
65 const char *str1;
66 const char *str2;
67 const char *str3;
68 hashval_t hash;
69 bool prefix;
72 /* Allocator used to hold string pair map entries for line map streaming. */
73 static struct object_allocator<struct string_pair_map>
74 *string_pair_map_allocator;
76 struct string_pair_map_hasher : nofree_ptr_hash <string_pair_map>
78 static inline hashval_t hash (const string_pair_map *);
79 static inline bool equal (const string_pair_map *, const string_pair_map *);
82 inline hashval_t
83 string_pair_map_hasher::hash (const string_pair_map *spm)
85 return spm->hash;
88 inline bool
89 string_pair_map_hasher::equal (const string_pair_map *spm1,
90 const string_pair_map *spm2)
92 return (spm1->hash == spm2->hash
93 && spm1->str1 == spm2->str1
94 && spm1->prefix == spm2->prefix
95 && strcmp (spm1->str2, spm2->str2) == 0);
98 /* The table to hold the pairs of pathnames and corresponding
99 resulting pathname. Used for both mapping of get_src_pwd ()
100 and recorded source working directory to relative path prefix
101 from current working directory to the recorded one, and for
102 mapping of that relative path prefix and some relative path
103 to those concatenated. */
104 static hash_table<string_pair_map_hasher> *path_name_pair_hash_table;
107 /* Check that tag ACTUAL has one of the given values. NUM_TAGS is the
108 number of valid tag values to check. */
110 void
111 lto_tag_check_set (enum LTO_tags actual, int ntags, ...)
113 va_list ap;
114 int i;
116 va_start (ap, ntags);
117 for (i = 0; i < ntags; i++)
118 if ((unsigned) actual == va_arg (ap, unsigned))
120 va_end (ap);
121 return;
124 va_end (ap);
125 internal_error ("bytecode stream: unexpected tag %s", lto_tag_name (actual));
129 /* Read LENGTH bytes from STREAM to ADDR. */
131 void
132 lto_input_data_block (class lto_input_block *ib, void *addr, size_t length)
134 size_t i;
135 unsigned char *const buffer = (unsigned char *) addr;
137 for (i = 0; i < length; i++)
138 buffer[i] = streamer_read_uchar (ib);
141 /* Compute the relative path to get to DATA_WD (absolute directory name)
142 from CWD (another absolute directory name). E.g. for
143 DATA_WD of "/tmp/foo/bar" and CWD of "/tmp/baz/qux" return
144 "../../foo/bar". Returned string should be freed by the caller.
145 Return NULL if absolute file name needs to be used. */
147 static char *
148 relative_path_prefix (const char *data_wd, const char *cwd)
150 const char *d = data_wd;
151 const char *c = cwd;
152 #ifdef HAVE_DOS_BASED_FILE_SYSTEM
153 if (d[1] == ':')
155 if (!IS_DIR_SEPARATOR (d[2]))
156 return NULL;
157 if (c[0] == d[0] && c[1] == ':' && IS_DIR_SEPARATOR (c[2]))
159 c += 3;
160 d += 3;
162 else
163 return NULL;
165 else if (c[1] == ':')
166 return NULL;
167 #endif
170 while (IS_DIR_SEPARATOR (*d))
171 d++;
172 while (IS_DIR_SEPARATOR (*c))
173 c++;
174 size_t i;
175 for (i = 0; c[i] && !IS_DIR_SEPARATOR (c[i]) && c[i] == d[i]; i++)
177 if ((c[i] == '\0' || IS_DIR_SEPARATOR (c[i]))
178 && (d[i] == '\0' || IS_DIR_SEPARATOR (d[i])))
180 c += i;
181 d += i;
182 if (*c == '\0' || *d == '\0')
183 break;
185 else
186 break;
188 while (1);
189 size_t num_up = 0;
192 while (IS_DIR_SEPARATOR (*c))
193 c++;
194 if (*c == '\0')
195 break;
196 num_up++;
197 while (*c && !IS_DIR_SEPARATOR (*c))
198 c++;
200 while (1);
201 while (IS_DIR_SEPARATOR (*d))
202 d++;
203 size_t len = strlen (d);
204 if (len == 0 && num_up == 0)
205 return xstrdup (".");
206 char *ret = XNEWVEC (char, num_up * 3 + len + 1);
207 char *p = ret;
208 for (; num_up; num_up--)
210 const char dir_up[3] = { '.', '.', DIR_SEPARATOR };
211 memcpy (p, dir_up, 3);
212 p += 3;
214 memcpy (p, d, len + 1);
215 return ret;
218 /* Look up DATA_WD in hash table of relative prefixes. If found,
219 return relative path from CWD to DATA_WD from the hash table,
220 otherwise create it. */
222 static const char *
223 canon_relative_path_prefix (const char *data_wd, const char *cwd)
225 if (!IS_ABSOLUTE_PATH (data_wd) || !IS_ABSOLUTE_PATH (cwd))
226 return NULL;
228 if (!path_name_pair_hash_table)
230 path_name_pair_hash_table
231 = new hash_table<string_pair_map_hasher> (37);
232 string_pair_map_allocator
233 = new object_allocator <struct string_pair_map>
234 ("line map string pair map hash");
237 inchash::hash h;
238 h.add_ptr (cwd);
239 h.merge_hash (htab_hash_string (data_wd));
240 h.add_int (true);
242 string_pair_map s_slot;
243 s_slot.str1 = cwd;
244 s_slot.str2 = data_wd;
245 s_slot.str3 = NULL;
246 s_slot.hash = h.end ();
247 s_slot.prefix = true;
249 string_pair_map **slot
250 = path_name_pair_hash_table->find_slot (&s_slot, INSERT);
251 if (*slot == NULL)
253 /* Compute relative path from cwd directory to data_wd directory.
254 E.g. if cwd is /tmp/foo/bar and data_wd is /tmp/baz/qux ,
255 it will return ../../baz/qux . */
256 char *relative_path = relative_path_prefix (data_wd, cwd);
257 const char *relative = relative_path ? relative_path : data_wd;
258 size_t relative_len = strlen (relative);
259 gcc_assert (relative_len);
261 size_t data_wd_len = strlen (data_wd);
262 bool add_separator = false;
263 if (!IS_DIR_SEPARATOR (relative[relative_len - 1]))
264 add_separator = true;
266 size_t len = relative_len + 1 + data_wd_len + 1 + add_separator;
268 char *saved_string = XOBNEWVEC (&file_name_obstack, char, len);
269 struct string_pair_map *new_slot
270 = string_pair_map_allocator->allocate ();
271 memcpy (saved_string, data_wd, data_wd_len + 1);
272 memcpy (saved_string + data_wd_len + 1, relative, relative_len);
273 if (add_separator)
274 saved_string[len - 2] = DIR_SEPARATOR;
275 saved_string[len - 1] = '\0';
276 new_slot->str1 = cwd;
277 new_slot->str2 = saved_string;
278 new_slot->str3 = saved_string + data_wd_len + 1;
279 if (relative_len == 1 && relative[0] == '.')
280 new_slot->str3 = NULL;
281 new_slot->hash = s_slot.hash;
282 new_slot->prefix = true;
283 *slot = new_slot;
284 free (relative_path);
285 return new_slot->str3;
287 else
289 string_pair_map *old_slot = *slot;
290 return old_slot->str3;
294 /* Look up the pair of RELATIVE_PREFIX and STRING strings in a hash table.
295 If found, return the concatenation of those from the hash table,
296 otherwise concatenate them. */
298 static const char *
299 canon_relative_file_name (const char *relative_prefix, const char *string)
301 inchash::hash h;
302 h.add_ptr (relative_prefix);
303 h.merge_hash (htab_hash_string (string));
305 string_pair_map s_slot;
306 s_slot.str1 = relative_prefix;
307 s_slot.str2 = string;
308 s_slot.str3 = NULL;
309 s_slot.hash = h.end ();
310 s_slot.prefix = false;
312 string_pair_map **slot
313 = path_name_pair_hash_table->find_slot (&s_slot, INSERT);
314 if (*slot == NULL)
316 size_t relative_prefix_len = strlen (relative_prefix);
317 size_t string_len = strlen (string);
318 size_t len = relative_prefix_len + string_len + 1;
320 char *saved_string = XOBNEWVEC (&file_name_obstack, char, len);
321 struct string_pair_map *new_slot
322 = string_pair_map_allocator->allocate ();
323 memcpy (saved_string, relative_prefix, relative_prefix_len);
324 memcpy (saved_string + relative_prefix_len, string, string_len + 1);
325 new_slot->str1 = relative_prefix;
326 new_slot->str2 = saved_string + relative_prefix_len;
327 new_slot->str3 = saved_string;
328 new_slot->hash = s_slot.hash;
329 new_slot->prefix = false;
330 *slot = new_slot;
331 return new_slot->str3;
333 else
335 string_pair_map *old_slot = *slot;
336 return old_slot->str3;
340 /* Lookup STRING in file_name_hash_table. If found, return the existing
341 string, otherwise insert STRING as the canonical version.
342 If STRING is a relative pathname and RELATIVE_PREFIX is non-NULL, use
343 canon_relative_file_name instead. */
345 static const char *
346 canon_file_name (const char *relative_prefix, const char *string)
348 if (relative_prefix && !IS_ABSOLUTE_PATH (string))
349 return canon_relative_file_name (relative_prefix, string);
351 string_slot **slot;
352 struct string_slot s_slot;
353 size_t len = strlen (string);
355 s_slot.s = string;
356 s_slot.len = len;
358 slot = file_name_hash_table->find_slot (&s_slot, INSERT);
359 if (*slot == NULL)
361 char *saved_string;
362 struct string_slot *new_slot;
364 saved_string = XOBNEWVEC (&file_name_obstack, char, len + 1);
365 new_slot = string_slot_allocator->allocate ();
366 memcpy (saved_string, string, len + 1);
367 new_slot->s = saved_string;
368 new_slot->len = len;
369 *slot = new_slot;
370 return saved_string;
372 else
374 struct string_slot *old_slot = *slot;
375 return old_slot->s;
379 /* Pointer to currently alive instance of lto_location_cache. */
381 lto_location_cache *lto_location_cache::current_cache;
383 /* Sort locations in source order. Start with file from last application. */
386 lto_location_cache::cmp_loc (const void *pa, const void *pb)
388 const cached_location *a = ((const cached_location *)pa);
389 const cached_location *b = ((const cached_location *)pb);
390 const char *current_file = current_cache->current_file;
391 int current_line = current_cache->current_line;
393 if (a->file == current_file && b->file != current_file)
394 return -1;
395 if (a->file != current_file && b->file == current_file)
396 return 1;
397 if (a->file == current_file && b->file == current_file)
399 if (a->line == current_line && b->line != current_line)
400 return -1;
401 if (a->line != current_line && b->line == current_line)
402 return 1;
404 if (a->file != b->file)
405 return strcmp (a->file, b->file);
406 if (a->sysp != b->sysp)
407 return a->sysp ? 1 : -1;
408 if (a->line != b->line)
409 return a->line - b->line;
410 if (a->col != b->col)
411 return a->col - b->col;
412 if (a->discr != b->discr)
413 return a->discr - b->discr;
414 if ((a->block == NULL_TREE) != (b->block == NULL_TREE))
415 return a->block ? 1 : -1;
416 if (a->block)
418 if (BLOCK_NUMBER (a->block) < BLOCK_NUMBER (b->block))
419 return -1;
420 if (BLOCK_NUMBER (a->block) > BLOCK_NUMBER (b->block))
421 return 1;
423 return 0;
426 /* Apply all changes in location cache. Add locations into linemap and patch
427 trees. */
429 bool
430 lto_location_cache::apply_location_cache ()
432 static const char *prev_file;
433 if (!loc_cache.length ())
434 return false;
435 if (loc_cache.length () > 1)
436 loc_cache.qsort (cmp_loc);
438 for (unsigned int i = 0; i < loc_cache.length (); i++)
440 struct cached_location loc = loc_cache[i];
442 if (current_file != loc.file)
443 linemap_add (line_table, prev_file ? LC_RENAME : LC_ENTER,
444 loc.sysp, loc.file, loc.line);
445 else if (current_line != loc.line)
447 int max = loc.col;
449 for (unsigned int j = i + 1; j < loc_cache.length (); j++)
450 if (loc.file != loc_cache[j].file
451 || loc.line != loc_cache[j].line)
452 break;
453 else if (max < loc_cache[j].col)
454 max = loc_cache[j].col;
455 linemap_line_start (line_table, loc.line, max + 1);
457 gcc_assert (*loc.loc == BUILTINS_LOCATION + 1);
458 if (current_file != loc.file
459 || current_line != loc.line
460 || current_col != loc.col)
462 current_loc = linemap_position_for_column (line_table, loc.col);
463 if (loc.block)
464 current_loc = set_block (current_loc, loc.block);
465 if (loc.discr)
466 current_loc = location_with_discriminator (current_loc, loc.discr);
468 else if (current_block != loc.block)
470 if (loc.block)
471 current_loc = set_block (current_loc, loc.block);
472 else
473 current_loc = LOCATION_LOCUS (current_loc);
474 if (loc.discr)
475 current_loc = location_with_discriminator (current_loc, loc.discr);
477 else if (current_discr != loc.discr)
478 current_loc = location_with_discriminator (current_loc, loc.discr);
479 *loc.loc = current_loc;
480 current_line = loc.line;
481 prev_file = current_file = loc.file;
482 current_col = loc.col;
483 current_block = loc.block;
484 current_discr = loc.discr;
486 loc_cache.truncate (0);
487 accepted_length = 0;
488 return true;
491 /* Tree merging did not succeed; mark all changes in the cache as accepted. */
493 void
494 lto_location_cache::accept_location_cache ()
496 gcc_assert (current_cache == this);
497 accepted_length = loc_cache.length ();
500 /* Tree merging did succeed; throw away recent changes. */
502 void
503 lto_location_cache::revert_location_cache ()
505 loc_cache.truncate (accepted_length);
508 /* Read a location bitpack from bit pack BP and either update *LOC directly
509 or add it to the location cache. If IB is non-NULL, stream in a block
510 afterwards.
511 It is neccesary to call apply_location_cache to get *LOC updated. */
513 void
514 lto_location_cache::input_location_and_block (location_t *loc,
515 struct bitpack_d *bp,
516 class lto_input_block *ib,
517 class data_in *data_in)
519 static const char *stream_file;
520 static int stream_line;
521 static int stream_col;
522 static bool stream_sysp;
523 static tree stream_block;
524 static unsigned stream_discr;
525 static const char *stream_relative_path_prefix;
527 gcc_assert (current_cache == this);
529 *loc = bp_unpack_int_in_range (bp, "location", 0,
530 RESERVED_LOCATION_COUNT + 1);
532 if (*loc < RESERVED_LOCATION_COUNT)
534 if (ib)
536 bool block_change = bp_unpack_value (bp, 1);
537 if (block_change)
538 stream_block = stream_read_tree (ib, data_in);
539 if (stream_block)
540 *loc = set_block (*loc, stream_block);
542 return;
545 bool file_change = (*loc == RESERVED_LOCATION_COUNT + 1);
546 /* Keep value RESERVED_LOCATION_COUNT in *loc as linemap lookups will
547 ICE on it. */
548 *loc = RESERVED_LOCATION_COUNT;
549 bool line_change = bp_unpack_value (bp, 1);
550 bool column_change = bp_unpack_value (bp, 1);
551 bool discr_change = bp_unpack_value (bp, 1);
553 if (file_change)
555 bool pwd_change = bp_unpack_value (bp, 1);
556 if (pwd_change)
558 const char *pwd = bp_unpack_string (data_in, bp);
559 const char *src_pwd = get_src_pwd ();
560 if (strcmp (pwd, src_pwd) == 0)
561 stream_relative_path_prefix = NULL;
562 else
563 stream_relative_path_prefix
564 = canon_relative_path_prefix (pwd, src_pwd);
566 stream_file = canon_file_name (stream_relative_path_prefix,
567 bp_unpack_string (data_in, bp));
568 stream_sysp = bp_unpack_value (bp, 1);
571 if (line_change)
572 stream_line = bp_unpack_var_len_unsigned (bp);
574 if (column_change)
575 stream_col = bp_unpack_var_len_unsigned (bp);
577 if (discr_change)
578 stream_discr = bp_unpack_var_len_unsigned (bp);
580 tree block = NULL_TREE;
581 if (ib)
583 bool block_change = bp_unpack_value (bp, 1);
584 if (block_change)
585 stream_block = stream_read_tree (ib, data_in);
586 block = stream_block;
589 /* This optimization saves location cache operations during gimple
590 streaming. */
592 if (current_file == stream_file
593 && current_line == stream_line
594 && current_col == stream_col
595 && current_sysp == stream_sysp
596 && current_discr == stream_discr)
598 if (current_block == block)
599 *loc = current_loc;
600 else if (block)
601 *loc = set_block (current_loc, block);
602 else
603 *loc = LOCATION_LOCUS (current_loc);
604 return;
607 struct cached_location entry
608 = {stream_file, loc, stream_line, stream_col, stream_sysp, block, stream_discr};
609 loc_cache.safe_push (entry);
612 /* Read a location bitpack from bit pack BP and either update *LOC directly
613 or add it to the location cache.
614 It is neccesary to call apply_location_cache to get *LOC updated. */
616 void
617 lto_location_cache::input_location (location_t *loc, struct bitpack_d *bp,
618 class data_in *data_in)
620 return input_location_and_block (loc, bp, NULL, data_in);
623 /* Read a location bitpack from input block IB and either update *LOC directly
624 or add it to the location cache.
625 It is neccesary to call apply_location_cache to get *LOC updated. */
627 void
628 lto_input_location (location_t *loc, struct bitpack_d *bp,
629 class data_in *data_in)
631 data_in->location_cache.input_location (loc, bp, data_in);
634 /* Read a reference to a tree node from DATA_IN using input block IB.
635 TAG is the expected node that should be found in IB, if TAG belongs
636 to one of the indexable trees, expect to read a reference index to
637 be looked up in one of the symbol tables, otherwise read the pysical
638 representation of the tree using stream_read_tree. FN is the
639 function scope for the read tree. */
641 tree
642 lto_input_tree_ref (class lto_input_block *ib, class data_in *data_in,
643 struct function *fn, enum LTO_tags tag)
645 unsigned HOST_WIDE_INT ix_u;
646 tree result = NULL_TREE;
648 if (tag == LTO_ssa_name_ref)
650 ix_u = streamer_read_uhwi (ib);
651 result = (*SSANAMES (fn))[ix_u];
653 else
655 gcc_checking_assert (tag == LTO_global_stream_ref);
656 ix_u = streamer_read_uhwi (ib);
657 result = (*data_in->file_data->current_decl_state
658 ->streams[LTO_DECL_STREAM])[ix_u];
661 gcc_assert (result);
663 return result;
666 /* Read VAR_DECL reference to DATA from IB. */
668 tree
669 lto_input_var_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data)
671 unsigned int ix_u = streamer_read_uhwi (ib);
672 tree result = (*file_data->current_decl_state
673 ->streams[LTO_DECL_STREAM])[ix_u];
674 gcc_assert (VAR_P (result));
675 return result;
678 /* Read VAR_DECL reference to DATA from IB. */
680 tree
681 lto_input_fn_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data)
683 unsigned int ix_u = streamer_read_uhwi (ib);
684 tree result = (*file_data->current_decl_state
685 ->streams[LTO_DECL_STREAM])[ix_u];
686 gcc_assert (TREE_CODE (result) == FUNCTION_DECL);
687 return result;
691 /* Read and return a double-linked list of catch handlers from input
692 block IB, using descriptors in DATA_IN. */
694 static struct eh_catch_d *
695 lto_input_eh_catch_list (class lto_input_block *ib, class data_in *data_in,
696 eh_catch *last_p)
698 eh_catch first;
699 enum LTO_tags tag;
701 *last_p = first = NULL;
702 tag = streamer_read_record_start (ib);
703 while (tag)
705 tree list;
706 eh_catch n;
708 lto_tag_check_range (tag, LTO_eh_catch, LTO_eh_catch);
710 /* Read the catch node. */
711 n = ggc_cleared_alloc<eh_catch_d> ();
712 n->type_list = stream_read_tree (ib, data_in);
713 n->filter_list = stream_read_tree (ib, data_in);
714 n->label = stream_read_tree (ib, data_in);
716 /* Register all the types in N->FILTER_LIST. */
717 for (list = n->filter_list; list; list = TREE_CHAIN (list))
718 add_type_for_runtime (TREE_VALUE (list));
720 /* Chain N to the end of the list. */
721 if (*last_p)
722 (*last_p)->next_catch = n;
723 n->prev_catch = *last_p;
724 *last_p = n;
726 /* Set the head of the list the first time through the loop. */
727 if (first == NULL)
728 first = n;
730 tag = streamer_read_record_start (ib);
733 return first;
737 /* Read and return EH region IX from input block IB, using descriptors
738 in DATA_IN. */
740 static eh_region
741 input_eh_region (class lto_input_block *ib, class data_in *data_in, int ix)
743 enum LTO_tags tag;
744 eh_region r;
746 /* Read the region header. */
747 tag = streamer_read_record_start (ib);
748 if (tag == LTO_null)
749 return NULL;
751 r = ggc_cleared_alloc<eh_region_d> ();
752 r->index = streamer_read_hwi (ib);
754 gcc_assert (r->index == ix);
756 /* Read all the region pointers as region numbers. We'll fix up
757 the pointers once the whole array has been read. */
758 r->outer = (eh_region) (intptr_t) streamer_read_hwi (ib);
759 r->inner = (eh_region) (intptr_t) streamer_read_hwi (ib);
760 r->next_peer = (eh_region) (intptr_t) streamer_read_hwi (ib);
762 switch (tag)
764 case LTO_ert_cleanup:
765 r->type = ERT_CLEANUP;
766 break;
768 case LTO_ert_try:
770 struct eh_catch_d *last_catch;
771 r->type = ERT_TRY;
772 r->u.eh_try.first_catch = lto_input_eh_catch_list (ib, data_in,
773 &last_catch);
774 r->u.eh_try.last_catch = last_catch;
775 break;
778 case LTO_ert_allowed_exceptions:
780 tree l;
782 r->type = ERT_ALLOWED_EXCEPTIONS;
783 r->u.allowed.type_list = stream_read_tree (ib, data_in);
784 r->u.allowed.label = stream_read_tree (ib, data_in);
785 r->u.allowed.filter = streamer_read_uhwi (ib);
787 for (l = r->u.allowed.type_list; l ; l = TREE_CHAIN (l))
788 add_type_for_runtime (TREE_VALUE (l));
790 break;
792 case LTO_ert_must_not_throw:
794 r->type = ERT_MUST_NOT_THROW;
795 r->u.must_not_throw.failure_decl = stream_read_tree (ib, data_in);
796 bitpack_d bp = streamer_read_bitpack (ib);
797 stream_input_location (&r->u.must_not_throw.failure_loc,
798 &bp, data_in);
800 break;
802 default:
803 gcc_unreachable ();
806 r->landing_pads = (eh_landing_pad) (intptr_t) streamer_read_hwi (ib);
808 return r;
812 /* Read and return EH landing pad IX from input block IB, using descriptors
813 in DATA_IN. */
815 static eh_landing_pad
816 input_eh_lp (class lto_input_block *ib, class data_in *data_in, int ix)
818 enum LTO_tags tag;
819 eh_landing_pad lp;
821 /* Read the landing pad header. */
822 tag = streamer_read_record_start (ib);
823 if (tag == LTO_null)
824 return NULL;
826 lto_tag_check_range (tag, LTO_eh_landing_pad, LTO_eh_landing_pad);
828 lp = ggc_cleared_alloc<eh_landing_pad_d> ();
829 lp->index = streamer_read_hwi (ib);
830 gcc_assert (lp->index == ix);
831 lp->next_lp = (eh_landing_pad) (intptr_t) streamer_read_hwi (ib);
832 lp->region = (eh_region) (intptr_t) streamer_read_hwi (ib);
833 lp->post_landing_pad = stream_read_tree (ib, data_in);
835 return lp;
839 /* After reading the EH regions, pointers to peer and children regions
840 are region numbers. This converts all these region numbers into
841 real pointers into the rematerialized regions for FN. ROOT_REGION
842 is the region number for the root EH region in FN. */
844 static void
845 fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
847 unsigned i;
848 vec<eh_region, va_gc> *eh_array = fn->eh->region_array;
849 vec<eh_landing_pad, va_gc> *lp_array = fn->eh->lp_array;
850 eh_region r;
851 eh_landing_pad lp;
853 gcc_assert (eh_array && lp_array);
855 gcc_assert (root_region >= 0);
856 fn->eh->region_tree = (*eh_array)[root_region];
858 #define FIXUP_EH_REGION(r) (r) = (*eh_array)[(HOST_WIDE_INT) (intptr_t) (r)]
859 #define FIXUP_EH_LP(p) (p) = (*lp_array)[(HOST_WIDE_INT) (intptr_t) (p)]
861 /* Convert all the index numbers stored in pointer fields into
862 pointers to the corresponding slots in the EH region array. */
863 FOR_EACH_VEC_ELT (*eh_array, i, r)
865 /* The array may contain NULL regions. */
866 if (r == NULL)
867 continue;
869 gcc_assert (i == (unsigned) r->index);
870 FIXUP_EH_REGION (r->outer);
871 FIXUP_EH_REGION (r->inner);
872 FIXUP_EH_REGION (r->next_peer);
873 FIXUP_EH_LP (r->landing_pads);
876 /* Convert all the index numbers stored in pointer fields into
877 pointers to the corresponding slots in the EH landing pad array. */
878 FOR_EACH_VEC_ELT (*lp_array, i, lp)
880 /* The array may contain NULL landing pads. */
881 if (lp == NULL)
882 continue;
884 gcc_assert (i == (unsigned) lp->index);
885 FIXUP_EH_LP (lp->next_lp);
886 FIXUP_EH_REGION (lp->region);
889 #undef FIXUP_EH_REGION
890 #undef FIXUP_EH_LP
894 /* Initialize EH support. */
896 void
897 lto_init_eh (void)
899 static bool eh_initialized_p = false;
901 if (eh_initialized_p)
902 return;
904 /* Contrary to most other FEs, we only initialize EH support when at
905 least one of the files in the set contains exception regions in
906 it. Since this happens much later than the call to init_eh in
907 lang_dependent_init, we have to set flag_exceptions and call
908 init_eh again to initialize the EH tables. */
909 flag_exceptions = 1;
910 init_eh ();
912 eh_initialized_p = true;
916 /* Read the exception table for FN from IB using the data descriptors
917 in DATA_IN. */
919 static void
920 input_eh_regions (class lto_input_block *ib, class data_in *data_in,
921 struct function *fn)
923 HOST_WIDE_INT i, root_region, len;
924 enum LTO_tags tag;
926 tag = streamer_read_record_start (ib);
927 if (tag == LTO_null)
928 return;
930 lto_tag_check_range (tag, LTO_eh_table, LTO_eh_table);
932 gcc_assert (fn->eh);
934 root_region = streamer_read_hwi (ib);
935 gcc_assert (root_region == (int) root_region);
937 /* Read the EH region array. */
938 len = streamer_read_hwi (ib);
939 gcc_assert (len == (int) len);
940 if (len > 0)
942 vec_safe_grow_cleared (fn->eh->region_array, len, true);
943 for (i = 0; i < len; i++)
945 eh_region r = input_eh_region (ib, data_in, i);
946 (*fn->eh->region_array)[i] = r;
950 /* Read the landing pads. */
951 len = streamer_read_hwi (ib);
952 gcc_assert (len == (int) len);
953 if (len > 0)
955 vec_safe_grow_cleared (fn->eh->lp_array, len, true);
956 for (i = 0; i < len; i++)
958 eh_landing_pad lp = input_eh_lp (ib, data_in, i);
959 (*fn->eh->lp_array)[i] = lp;
963 /* Read the runtime type data. */
964 len = streamer_read_hwi (ib);
965 gcc_assert (len == (int) len);
966 if (len > 0)
968 vec_safe_grow_cleared (fn->eh->ttype_data, len, true);
969 for (i = 0; i < len; i++)
971 tree ttype = stream_read_tree (ib, data_in);
972 (*fn->eh->ttype_data)[i] = ttype;
976 /* Read the table of action chains. */
977 len = streamer_read_hwi (ib);
978 gcc_assert (len == (int) len);
979 if (len > 0)
981 if (targetm.arm_eabi_unwinder)
983 vec_safe_grow_cleared (fn->eh->ehspec_data.arm_eabi, len, true);
984 for (i = 0; i < len; i++)
986 tree t = stream_read_tree (ib, data_in);
987 (*fn->eh->ehspec_data.arm_eabi)[i] = t;
990 else
992 vec_safe_grow_cleared (fn->eh->ehspec_data.other, len, true);
993 for (i = 0; i < len; i++)
995 uchar c = streamer_read_uchar (ib);
996 (*fn->eh->ehspec_data.other)[i] = c;
1001 /* Reconstruct the EH region tree by fixing up the peer/children
1002 pointers. */
1003 fixup_eh_region_pointers (fn, root_region);
1005 tag = streamer_read_record_start (ib);
1006 lto_tag_check_range (tag, LTO_null, LTO_null);
1010 /* Make a new basic block with index INDEX in function FN. */
1012 static basic_block
1013 make_new_block (struct function *fn, unsigned int index)
1015 basic_block bb = alloc_block ();
1016 bb->index = index;
1017 SET_BASIC_BLOCK_FOR_FN (fn, index, bb);
1018 n_basic_blocks_for_fn (fn)++;
1019 return bb;
1023 /* Read the CFG for function FN from input block IB. */
1025 static void
1026 input_cfg (class lto_input_block *ib, class data_in *data_in,
1027 struct function *fn)
1029 unsigned int bb_count;
1030 basic_block p_bb;
1031 unsigned int i;
1032 int index;
1033 bool full_profile = false;
1035 init_empty_tree_cfg_for_function (fn);
1037 profile_status_for_fn (fn) = streamer_read_enum (ib, profile_status_d,
1038 PROFILE_LAST);
1040 bb_count = streamer_read_uhwi (ib);
1042 last_basic_block_for_fn (fn) = bb_count;
1043 if (bb_count > basic_block_info_for_fn (fn)->length ())
1044 vec_safe_grow_cleared (basic_block_info_for_fn (fn), bb_count, true);
1046 if (bb_count > label_to_block_map_for_fn (fn)->length ())
1047 vec_safe_grow_cleared (label_to_block_map_for_fn (fn), bb_count, true);
1049 index = streamer_read_hwi (ib);
1050 while (index != -1)
1052 basic_block bb = BASIC_BLOCK_FOR_FN (fn, index);
1053 unsigned int edge_count;
1055 if (bb == NULL)
1056 bb = make_new_block (fn, index);
1058 edge_count = streamer_read_uhwi (ib);
1060 /* Connect up the CFG. */
1061 for (i = 0; i < edge_count; i++)
1063 bitpack_d bp = streamer_read_bitpack (ib);
1064 unsigned int dest_index = bp_unpack_var_len_unsigned (&bp);
1065 unsigned int edge_flags = bp_unpack_var_len_unsigned (&bp);
1066 basic_block dest = BASIC_BLOCK_FOR_FN (fn, dest_index);
1068 if (dest == NULL)
1069 dest = make_new_block (fn, dest_index);
1071 edge e = make_edge (bb, dest, edge_flags);
1072 data_in->location_cache.input_location_and_block (&e->goto_locus,
1073 &bp, ib, data_in);
1074 e->probability = profile_probability::stream_in (ib);
1075 if (!e->probability.initialized_p ())
1076 full_profile = false;
1080 index = streamer_read_hwi (ib);
1083 p_bb = ENTRY_BLOCK_PTR_FOR_FN (fn);
1084 index = streamer_read_hwi (ib);
1085 while (index != -1)
1087 basic_block bb = BASIC_BLOCK_FOR_FN (fn, index);
1088 bb->prev_bb = p_bb;
1089 p_bb->next_bb = bb;
1090 p_bb = bb;
1091 index = streamer_read_hwi (ib);
1094 /* ??? The cfgloop interface is tied to cfun. */
1095 gcc_assert (cfun == fn);
1097 /* Input the loop tree. */
1098 unsigned n_loops = streamer_read_uhwi (ib);
1099 if (n_loops == 0)
1100 return;
1102 struct loops *loops = ggc_cleared_alloc<struct loops> ();
1103 init_loops_structure (fn, loops, n_loops);
1104 set_loops_for_fn (fn, loops);
1106 /* Input each loop and associate it with its loop header so
1107 flow_loops_find can rebuild the loop tree. */
1108 for (unsigned i = 1; i < n_loops; ++i)
1110 int header_index = streamer_read_hwi (ib);
1111 if (header_index == -1)
1113 loops->larray->quick_push (NULL);
1114 continue;
1117 class loop *loop = alloc_loop ();
1118 loop->header = BASIC_BLOCK_FOR_FN (fn, header_index);
1119 loop->header->loop_father = loop;
1121 /* Read everything copy_loop_info copies. */
1122 loop->estimate_state = streamer_read_enum (ib, loop_estimation, EST_LAST);
1123 loop->any_upper_bound = streamer_read_hwi (ib);
1124 if (loop->any_upper_bound)
1125 loop->nb_iterations_upper_bound = streamer_read_widest_int (ib);
1126 loop->any_likely_upper_bound = streamer_read_hwi (ib);
1127 if (loop->any_likely_upper_bound)
1128 loop->nb_iterations_likely_upper_bound = streamer_read_widest_int (ib);
1129 loop->any_estimate = streamer_read_hwi (ib);
1130 if (loop->any_estimate)
1131 loop->nb_iterations_estimate = streamer_read_widest_int (ib);
1133 /* Read OMP SIMD related info. */
1134 loop->safelen = streamer_read_hwi (ib);
1135 loop->unroll = streamer_read_hwi (ib);
1136 loop->owned_clique = streamer_read_hwi (ib);
1137 loop->dont_vectorize = streamer_read_hwi (ib);
1138 loop->force_vectorize = streamer_read_hwi (ib);
1139 loop->finite_p = streamer_read_hwi (ib);
1140 loop->simduid = stream_read_tree (ib, data_in);
1142 place_new_loop (fn, loop);
1144 /* flow_loops_find doesn't like loops not in the tree, hook them
1145 all as siblings of the tree root temporarily. */
1146 flow_loop_tree_node_add (loops->tree_root, loop);
1149 /* Rebuild the loop tree. */
1150 flow_loops_find (loops);
1151 cfun->cfg->full_profile = full_profile;
1155 /* Read the SSA names array for function FN from DATA_IN using input
1156 block IB. */
1158 static void
1159 input_ssa_names (class lto_input_block *ib, class data_in *data_in,
1160 struct function *fn)
1162 unsigned int i, size;
1164 size = streamer_read_uhwi (ib);
1165 init_tree_ssa (fn, size);
1166 cfun->gimple_df->in_ssa_p = true;
1167 init_ssa_operands (fn);
1169 i = streamer_read_uhwi (ib);
1170 while (i)
1172 tree ssa_name, name;
1173 bool is_default_def;
1175 /* Skip over the elements that had been freed. */
1176 while (SSANAMES (fn)->length () < i)
1177 SSANAMES (fn)->quick_push (NULL_TREE);
1179 is_default_def = (streamer_read_uchar (ib) != 0);
1180 name = stream_read_tree (ib, data_in);
1181 ssa_name = make_ssa_name_fn (fn, name, NULL);
1183 if (is_default_def)
1185 set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name);
1186 SSA_NAME_DEF_STMT (ssa_name) = gimple_build_nop ();
1189 i = streamer_read_uhwi (ib);
1194 /* Go through all NODE edges and fixup call_stmt pointers
1195 so they point to STMTS. */
1197 static void
1198 fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts,
1199 struct function *fn)
1201 #define STMT_UID_NOT_IN_RANGE(uid) \
1202 (gimple_stmt_max_uid (fn) < uid || uid == 0)
1204 struct cgraph_edge *cedge;
1205 struct ipa_ref *ref = NULL;
1206 unsigned int i;
1208 for (cedge = node->callees; cedge; cedge = cedge->next_callee)
1210 if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
1211 fatal_error (input_location,
1212 "Cgraph edge statement index out of range");
1213 cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
1214 cedge->lto_stmt_uid = 0;
1215 if (!cedge->call_stmt)
1216 fatal_error (input_location,
1217 "Cgraph edge statement index not found");
1219 for (cedge = node->indirect_calls; cedge; cedge = cedge->next_callee)
1221 if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
1222 fatal_error (input_location,
1223 "Cgraph edge statement index out of range");
1224 cedge->call_stmt = as_a <gcall *> (stmts[cedge->lto_stmt_uid - 1]);
1225 cedge->lto_stmt_uid = 0;
1226 if (!cedge->call_stmt)
1227 fatal_error (input_location, "Cgraph edge statement index not found");
1229 for (i = 0; node->iterate_reference (i, ref); i++)
1230 if (ref->lto_stmt_uid)
1232 if (STMT_UID_NOT_IN_RANGE (ref->lto_stmt_uid))
1233 fatal_error (input_location,
1234 "Reference statement index out of range");
1235 ref->stmt = stmts[ref->lto_stmt_uid - 1];
1236 ref->lto_stmt_uid = 0;
1237 if (!ref->stmt)
1238 fatal_error (input_location, "Reference statement index not found");
1243 /* Fixup call_stmt pointers in NODE and all clones. */
1245 static void
1246 fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts)
1248 struct cgraph_node *node;
1249 struct function *fn;
1251 while (orig->clone_of)
1252 orig = orig->clone_of;
1253 fn = DECL_STRUCT_FUNCTION (orig->decl);
1255 if (!orig->thunk)
1256 fixup_call_stmt_edges_1 (orig, stmts, fn);
1257 if (orig->clones)
1258 for (node = orig->clones; node != orig;)
1260 if (!node->thunk)
1261 fixup_call_stmt_edges_1 (node, stmts, fn);
1262 if (node->clones)
1263 node = node->clones;
1264 else if (node->next_sibling_clone)
1265 node = node->next_sibling_clone;
1266 else
1268 while (node != orig && !node->next_sibling_clone)
1269 node = node->clone_of;
1270 if (node != orig)
1271 node = node->next_sibling_clone;
1277 /* Input the base body of struct function FN from DATA_IN
1278 using input block IB. */
1280 static void
1281 input_struct_function_base (struct function *fn, class data_in *data_in,
1282 class lto_input_block *ib)
1284 struct bitpack_d bp;
1285 int len;
1287 /* Read the static chain and non-local goto save area. */
1288 fn->static_chain_decl = stream_read_tree (ib, data_in);
1289 fn->nonlocal_goto_save_area = stream_read_tree (ib, data_in);
1291 /* Read all the local symbols. */
1292 len = streamer_read_hwi (ib);
1293 if (len > 0)
1295 int i;
1296 vec_safe_grow_cleared (fn->local_decls, len, true);
1297 for (i = 0; i < len; i++)
1299 tree t = stream_read_tree (ib, data_in);
1300 (*fn->local_decls)[i] = t;
1304 /* Input the current IL state of the function. */
1305 fn->curr_properties = streamer_read_uhwi (ib);
1307 /* Read all the attributes for FN. */
1308 bp = streamer_read_bitpack (ib);
1309 fn->is_thunk = bp_unpack_value (&bp, 1);
1310 fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
1311 fn->returns_pcc_struct = bp_unpack_value (&bp, 1);
1312 fn->returns_struct = bp_unpack_value (&bp, 1);
1313 fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1);
1314 fn->can_delete_dead_exceptions = bp_unpack_value (&bp, 1);
1315 fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1);
1316 fn->after_inlining = bp_unpack_value (&bp, 1);
1317 fn->stdarg = bp_unpack_value (&bp, 1);
1318 fn->has_nonlocal_label = bp_unpack_value (&bp, 1);
1319 fn->has_forced_label_in_static = bp_unpack_value (&bp, 1);
1320 fn->calls_alloca = bp_unpack_value (&bp, 1);
1321 fn->calls_setjmp = bp_unpack_value (&bp, 1);
1322 fn->calls_eh_return = bp_unpack_value (&bp, 1);
1323 fn->has_force_vectorize_loops = bp_unpack_value (&bp, 1);
1324 fn->has_simduid_loops = bp_unpack_value (&bp, 1);
1325 fn->assume_function = bp_unpack_value (&bp, 1);
1326 fn->va_list_fpr_size = bp_unpack_value (&bp, 8);
1327 fn->va_list_gpr_size = bp_unpack_value (&bp, 8);
1328 fn->last_clique = bp_unpack_value (&bp, sizeof (short) * 8);
1330 /* Input the function start and end loci. */
1331 stream_input_location (&fn->function_start_locus, &bp, data_in);
1332 stream_input_location (&fn->function_end_locus, &bp, data_in);
1334 /* Restore the instance discriminators if present. */
1335 int instance_number = bp_unpack_value (&bp, 1);
1336 if (instance_number)
1338 instance_number = bp_unpack_value (&bp, sizeof (int) * CHAR_BIT);
1339 maybe_create_decl_to_instance_map ()->put (fn->decl, instance_number);
1343 /* Read a chain of tree nodes from input block IB. DATA_IN contains
1344 tables and descriptors for the file being read. */
1346 static tree
1347 streamer_read_chain (class lto_input_block *ib, class data_in *data_in)
1349 tree first, prev, curr;
1351 /* The chain is written as NULL terminated list of trees. */
1352 first = prev = NULL_TREE;
1355 curr = stream_read_tree (ib, data_in);
1356 if (prev)
1357 TREE_CHAIN (prev) = curr;
1358 else
1359 first = curr;
1361 prev = curr;
1363 while (curr);
1365 return first;
1368 /* Read the body of function FN_DECL from DATA_IN using input block IB. */
1370 static void
1371 input_function (tree fn_decl, class data_in *data_in,
1372 class lto_input_block *ib, class lto_input_block *ib_cfg,
1373 cgraph_node *node)
1375 struct function *fn;
1376 enum LTO_tags tag;
1377 gimple **stmts;
1378 basic_block bb;
1380 tag = streamer_read_record_start (ib);
1381 lto_tag_check (tag, LTO_function);
1383 /* Read decls for parameters and args. */
1384 DECL_RESULT (fn_decl) = stream_read_tree (ib, data_in);
1385 DECL_ARGUMENTS (fn_decl) = streamer_read_chain (ib, data_in);
1387 /* Read debug args if available. */
1388 unsigned n_debugargs = streamer_read_uhwi (ib);
1389 if (n_debugargs)
1391 vec<tree, va_gc> **debugargs = decl_debug_args_insert (fn_decl);
1392 vec_safe_grow (*debugargs, n_debugargs, true);
1393 for (unsigned i = 0; i < n_debugargs; ++i)
1394 (**debugargs)[i] = stream_read_tree (ib, data_in);
1397 /* Read the tree of lexical scopes for the function. */
1398 DECL_INITIAL (fn_decl) = stream_read_tree (ib, data_in);
1399 unsigned block_leaf_count = streamer_read_uhwi (ib);
1400 while (block_leaf_count--)
1401 stream_read_tree (ib, data_in);
1403 if (!streamer_read_uhwi (ib))
1404 return;
1406 push_struct_function (fn_decl);
1407 fn = DECL_STRUCT_FUNCTION (fn_decl);
1409 gimple_register_cfg_hooks ();
1411 input_struct_function_base (fn, data_in, ib);
1412 input_cfg (ib_cfg, data_in, fn);
1414 /* Read all the SSA names. */
1415 input_ssa_names (ib, data_in, fn);
1417 /* Read the exception handling regions in the function. */
1418 input_eh_regions (ib, data_in, fn);
1420 gcc_assert (DECL_INITIAL (fn_decl));
1421 DECL_SAVED_TREE (fn_decl) = NULL_TREE;
1423 /* Read all the basic blocks. */
1424 tag = streamer_read_record_start (ib);
1425 while (tag)
1427 input_bb (ib, tag, data_in, fn,
1428 node->count_materialization_scale);
1429 tag = streamer_read_record_start (ib);
1432 /* Finalize gimple_location/gimple_block of stmts and phis. */
1433 data_in->location_cache.apply_location_cache ();
1435 /* Fix up the call statements that are mentioned in the callgraph
1436 edges. */
1437 set_gimple_stmt_max_uid (cfun, 0);
1438 FOR_ALL_BB_FN (bb, cfun)
1440 gimple_stmt_iterator gsi;
1441 for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
1443 gimple *stmt = gsi_stmt (gsi);
1444 gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
1446 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
1448 gimple *stmt = gsi_stmt (gsi);
1449 gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
1452 stmts = (gimple **) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple *));
1453 FOR_ALL_BB_FN (bb, cfun)
1455 gimple_stmt_iterator bsi = gsi_start_phis (bb);
1456 while (!gsi_end_p (bsi))
1458 gimple *stmt = gsi_stmt (bsi);
1459 gsi_next (&bsi);
1460 stmts[gimple_uid (stmt)] = stmt;
1462 bsi = gsi_start_bb (bb);
1463 while (!gsi_end_p (bsi))
1465 gimple *stmt = gsi_stmt (bsi);
1466 bool remove = false;
1467 /* If we're recompiling LTO objects with debug stmts but
1468 we're not supposed to have debug stmts, remove them now.
1469 We can't remove them earlier because this would cause uid
1470 mismatches in fixups, but we can do it at this point, as
1471 long as debug stmts don't require fixups.
1472 Similarly remove all IFN_*SAN_* internal calls */
1473 if (!flag_wpa)
1475 if (is_gimple_debug (stmt)
1476 && (gimple_debug_nonbind_marker_p (stmt)
1477 ? !MAY_HAVE_DEBUG_MARKER_STMTS
1478 : !MAY_HAVE_DEBUG_BIND_STMTS))
1479 remove = true;
1480 /* In case the linemap overflows locations can be dropped
1481 to zero. Thus do not keep nonsensical inline entry markers
1482 we'd later ICE on. */
1483 tree block;
1484 if (gimple_debug_inline_entry_p (stmt)
1485 && (((block = gimple_block (stmt))
1486 && !inlined_function_outer_scope_p (block))
1487 || !debug_inline_points))
1488 remove = true;
1489 if (is_gimple_call (stmt)
1490 && gimple_call_internal_p (stmt))
1492 bool replace = false;
1493 switch (gimple_call_internal_fn (stmt))
1495 case IFN_UBSAN_NULL:
1496 if ((flag_sanitize
1497 & (SANITIZE_NULL | SANITIZE_ALIGNMENT)) == 0)
1498 replace = true;
1499 break;
1500 case IFN_UBSAN_BOUNDS:
1501 if ((flag_sanitize & SANITIZE_BOUNDS) == 0)
1502 replace = true;
1503 break;
1504 case IFN_UBSAN_VPTR:
1505 if ((flag_sanitize & SANITIZE_VPTR) == 0)
1506 replace = true;
1507 break;
1508 case IFN_UBSAN_OBJECT_SIZE:
1509 if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0)
1510 replace = true;
1511 break;
1512 case IFN_UBSAN_PTR:
1513 if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0)
1514 replace = true;
1515 break;
1516 case IFN_ASAN_MARK:
1517 if ((flag_sanitize & SANITIZE_ADDRESS) == 0)
1518 replace = true;
1519 break;
1520 case IFN_TSAN_FUNC_EXIT:
1521 if ((flag_sanitize & SANITIZE_THREAD) == 0)
1522 replace = true;
1523 break;
1524 default:
1525 break;
1527 if (replace)
1529 gimple_call_set_internal_fn (as_a <gcall *> (stmt),
1530 IFN_NOP);
1531 update_stmt (stmt);
1535 if (remove)
1537 gimple_stmt_iterator gsi = bsi;
1538 gsi_next (&bsi);
1539 unlink_stmt_vdef (stmt);
1540 release_defs (stmt);
1541 gsi_remove (&gsi, true);
1543 else
1545 gsi_next (&bsi);
1546 stmts[gimple_uid (stmt)] = stmt;
1548 /* Remember that the input function has begin stmt
1549 markers, so that we know to expect them when emitting
1550 debug info. */
1551 if (!cfun->debug_nonbind_markers
1552 && gimple_debug_nonbind_marker_p (stmt))
1553 cfun->debug_nonbind_markers = true;
1558 /* Set the gimple body to the statement sequence in the entry
1559 basic block. FIXME lto, this is fairly hacky. The existence
1560 of a gimple body is used by the cgraph routines, but we should
1561 really use the presence of the CFG. */
1563 edge_iterator ei = ei_start (ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs);
1564 gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
1567 update_max_bb_count ();
1568 fixup_call_stmt_edges (node, stmts);
1569 execute_all_ipa_stmt_fixups (node, stmts);
1571 free_dominance_info (CDI_DOMINATORS);
1572 free_dominance_info (CDI_POST_DOMINATORS);
1573 free (stmts);
1574 pop_cfun ();
1577 /* Read the body of function FN_DECL from DATA_IN using input block IB. */
1579 static void
1580 input_constructor (tree var, class data_in *data_in,
1581 class lto_input_block *ib)
1583 DECL_INITIAL (var) = stream_read_tree (ib, data_in);
1587 /* Read the body from DATA for function NODE and fill it in.
1588 FILE_DATA are the global decls and types. SECTION_TYPE is either
1589 LTO_section_function_body or LTO_section_static_initializer. If
1590 section type is LTO_section_function_body, FN must be the decl for
1591 that function. */
1593 static void
1594 lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symtab_node *node,
1595 const char *data, enum lto_section_type section_type)
1597 const struct lto_function_header *header;
1598 class data_in *data_in;
1599 int cfg_offset;
1600 int main_offset;
1601 int string_offset;
1602 tree fn_decl = node->decl;
1604 header = (const struct lto_function_header *) data;
1605 if (TREE_CODE (node->decl) == FUNCTION_DECL)
1607 cfg_offset = sizeof (struct lto_function_header);
1608 main_offset = cfg_offset + header->cfg_size;
1609 string_offset = main_offset + header->main_size;
1611 else
1613 main_offset = sizeof (struct lto_function_header);
1614 string_offset = main_offset + header->main_size;
1617 data_in = lto_data_in_create (file_data, data + string_offset,
1618 header->string_size, vNULL);
1620 if (section_type == LTO_section_function_body)
1622 struct lto_in_decl_state *decl_state;
1623 unsigned from;
1625 gcc_checking_assert (node);
1627 /* Use the function's decl state. */
1628 decl_state = lto_get_function_in_decl_state (file_data, fn_decl);
1629 gcc_assert (decl_state);
1630 file_data->current_decl_state = decl_state;
1633 /* Set up the struct function. */
1634 from = data_in->reader_cache->nodes.length ();
1635 lto_input_block ib_main (data + main_offset, header->main_size,
1636 file_data);
1637 if (TREE_CODE (node->decl) == FUNCTION_DECL)
1639 lto_input_block ib_cfg (data + cfg_offset, header->cfg_size,
1640 file_data);
1641 input_function (fn_decl, data_in, &ib_main, &ib_cfg,
1642 dyn_cast <cgraph_node *>(node));
1644 else
1645 input_constructor (fn_decl, data_in, &ib_main);
1646 data_in->location_cache.apply_location_cache ();
1647 /* And fixup types we streamed locally. */
1649 struct streamer_tree_cache_d *cache = data_in->reader_cache;
1650 unsigned len = cache->nodes.length ();
1651 unsigned i;
1652 for (i = len; i-- > from;)
1654 tree t = streamer_tree_cache_get_tree (cache, i);
1655 if (t == NULL_TREE)
1656 continue;
1658 if (TYPE_P (t))
1660 gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (t));
1661 if (type_with_alias_set_p (t)
1662 && canonical_type_used_p (t))
1663 TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t);
1664 if (TYPE_MAIN_VARIANT (t) != t)
1666 gcc_assert (TYPE_NEXT_VARIANT (t) == NULL_TREE);
1667 TYPE_NEXT_VARIANT (t)
1668 = TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t));
1669 TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t)) = t;
1675 /* Restore decl state */
1676 file_data->current_decl_state = file_data->global_decl_state;
1679 lto_data_in_delete (data_in);
1683 /* Read the body of NODE using DATA. FILE_DATA holds the global
1684 decls and types. */
1686 void
1687 lto_input_function_body (struct lto_file_decl_data *file_data,
1688 struct cgraph_node *node, const char *data)
1690 lto_read_body_or_constructor (file_data, node, data, LTO_section_function_body);
1693 /* Read the body of NODE using DATA. FILE_DATA holds the global
1694 decls and types. */
1696 void
1697 lto_input_variable_constructor (struct lto_file_decl_data *file_data,
1698 struct varpool_node *node, const char *data)
1700 lto_read_body_or_constructor (file_data, node, data, LTO_section_function_body);
1704 /* Queue of acummulated decl -> DIE mappings. Similar to locations those
1705 are only applied to prevailing tree nodes during tree merging. */
1706 vec<dref_entry> dref_queue;
1708 /* Read the physical representation of a tree node EXPR from
1709 input block IB using the per-file context in DATA_IN. */
1711 static void
1712 lto_read_tree_1 (class lto_input_block *ib, class data_in *data_in, tree expr)
1714 /* Read all the bitfield values in EXPR. Note that for LTO, we
1715 only write language-independent bitfields, so no more unpacking is
1716 needed. */
1717 streamer_read_tree_bitfields (ib, data_in, expr);
1719 /* Read all the pointer fields in EXPR. */
1720 streamer_read_tree_body (ib, data_in, expr);
1722 /* Read any LTO-specific data not read by the tree streamer. Do not use
1723 stream_read_tree here since that flushes the dref_queue in mids of
1724 SCC reading. */
1725 if (DECL_P (expr)
1726 && TREE_CODE (expr) != FUNCTION_DECL
1727 && TREE_CODE (expr) != TRANSLATION_UNIT_DECL)
1728 DECL_INITIAL (expr)
1729 = lto_input_tree_1 (ib, data_in, streamer_read_record_start (ib), 0);
1731 /* Stream references to early generated DIEs. Keep in sync with the
1732 trees handled in dwarf2out_register_external_die. */
1733 if ((DECL_P (expr)
1734 && TREE_CODE (expr) != FIELD_DECL
1735 && TREE_CODE (expr) != DEBUG_EXPR_DECL
1736 && TREE_CODE (expr) != TYPE_DECL)
1737 || TREE_CODE (expr) == BLOCK)
1739 const char *str = streamer_read_string (data_in, ib);
1740 if (str)
1742 unsigned HOST_WIDE_INT off = streamer_read_uhwi (ib);
1743 dref_entry e = { expr, str, off };
1744 dref_queue.safe_push (e);
1749 /* Read the physical representation of a tree node with tag TAG from
1750 input block IB using the per-file context in DATA_IN. */
1752 static tree
1753 lto_read_tree (class lto_input_block *ib, class data_in *data_in,
1754 enum LTO_tags tag, hashval_t hash)
1756 /* Instantiate a new tree node. */
1757 tree result = streamer_alloc_tree (ib, data_in, tag);
1759 /* Enter RESULT in the reader cache. This will make RESULT
1760 available so that circular references in the rest of the tree
1761 structure can be resolved in subsequent calls to stream_read_tree. */
1762 streamer_tree_cache_append (data_in->reader_cache, result, hash);
1764 lto_read_tree_1 (ib, data_in, result);
1766 return result;
1770 /* Populate the reader cache with trees materialized from the SCC
1771 following in the IB, DATA_IN stream.
1772 If SHARED_SCC is true we input LTO_tree_scc. */
1774 hashval_t
1775 lto_input_scc (class lto_input_block *ib, class data_in *data_in,
1776 unsigned *len, unsigned *entry_len, bool shared_scc)
1778 unsigned size = streamer_read_uhwi (ib);
1779 hashval_t scc_hash = 0;
1780 unsigned scc_entry_len = 1;
1782 if (shared_scc)
1784 if (size & 1)
1785 scc_entry_len = streamer_read_uhwi (ib);
1786 size /= 2;
1787 scc_hash = streamer_read_uhwi (ib);
1790 if (size == 1)
1792 enum LTO_tags tag = streamer_read_record_start (ib);
1793 lto_input_tree_1 (ib, data_in, tag, scc_hash);
1795 else
1797 unsigned int first = data_in->reader_cache->nodes.length ();
1798 tree result;
1800 /* Materialize size trees by reading their headers. */
1801 for (unsigned i = 0; i < size; ++i)
1803 enum LTO_tags tag = streamer_read_record_start (ib);
1804 if (tag == LTO_null
1805 || tag == LTO_global_stream_ref
1806 || tag == LTO_tree_pickle_reference
1807 || tag == LTO_integer_cst
1808 || tag == LTO_tree_scc
1809 || tag == LTO_trees)
1810 gcc_unreachable ();
1812 result = streamer_alloc_tree (ib, data_in, tag);
1813 streamer_tree_cache_append (data_in->reader_cache, result, 0);
1816 /* Read the tree bitpacks and references. */
1817 for (unsigned i = 0; i < size; ++i)
1819 result = streamer_tree_cache_get_tree (data_in->reader_cache,
1820 first + i);
1821 lto_read_tree_1 (ib, data_in, result);
1825 *len = size;
1826 *entry_len = scc_entry_len;
1827 return scc_hash;
1830 /* Read reference to tree from IB and DATA_IN.
1831 This is used for streaming tree bodies where we know that
1832 the tree is already in cache or is indexable and
1833 must be matched with stream_write_tree_ref. */
1835 tree
1836 stream_read_tree_ref (lto_input_block *ib, data_in *data_in)
1838 int ix = streamer_read_hwi (ib);
1839 if (!ix)
1840 return NULL_TREE;
1841 if (ix > 0)
1842 return streamer_tree_cache_get_tree (data_in->reader_cache, ix - 1);
1844 ix = -ix - 1;
1845 int id = ix & 1;
1846 ix /= 2;
1848 tree ret;
1849 if (!id)
1850 ret = (*data_in->file_data->current_decl_state
1851 ->streams[LTO_DECL_STREAM])[ix];
1852 else
1853 ret = (*SSANAMES (cfun))[ix];
1854 return ret;
1857 /* Read a tree from input block IB using the per-file context in
1858 DATA_IN. This context is used, for example, to resolve references
1859 to previously read nodes. */
1861 tree
1862 lto_input_tree_1 (class lto_input_block *ib, class data_in *data_in,
1863 enum LTO_tags tag, hashval_t hash)
1865 tree result;
1867 gcc_assert ((unsigned) tag < (unsigned) LTO_NUM_TAGS);
1869 if (tag == LTO_null)
1870 result = NULL_TREE;
1871 else if (tag == LTO_global_stream_ref || tag == LTO_ssa_name_ref)
1873 /* If TAG is a reference to an indexable tree, the next value
1874 in IB is the index into the table where we expect to find
1875 that tree. */
1876 result = lto_input_tree_ref (ib, data_in, cfun, tag);
1878 else if (tag == LTO_tree_pickle_reference)
1880 /* If TAG is a reference to a previously read tree, look it up in
1881 the reader cache. */
1882 result = streamer_get_pickled_tree (ib, data_in);
1884 else if (tag == LTO_integer_cst)
1886 /* For shared integer constants in singletons we can use the
1887 existing tree integer constant merging code. */
1888 tree type = stream_read_tree_ref (ib, data_in);
1889 unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
1890 unsigned HOST_WIDE_INT i;
1891 HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
1893 for (i = 0; i < len; i++)
1894 a[i] = streamer_read_hwi (ib);
1895 gcc_assert (TYPE_PRECISION (type) <= WIDE_INT_MAX_PRECISION);
1896 result = wide_int_to_tree (type, wide_int::from_array
1897 (a, len, TYPE_PRECISION (type)));
1898 streamer_tree_cache_append (data_in->reader_cache, result, hash);
1900 else if (tag == LTO_tree_scc || tag == LTO_trees)
1901 gcc_unreachable ();
1902 else
1904 /* Otherwise, materialize a new node from IB. */
1905 result = lto_read_tree (ib, data_in, tag, hash);
1908 return result;
1911 tree
1912 lto_input_tree (class lto_input_block *ib, class data_in *data_in)
1914 enum LTO_tags tag;
1916 /* Input pickled trees needed to stream in the reference. */
1917 while ((tag = streamer_read_record_start (ib)) == LTO_trees)
1919 unsigned len, entry_len;
1920 lto_input_scc (ib, data_in, &len, &entry_len, false);
1922 /* Register DECLs with the debuginfo machinery. */
1923 while (!dref_queue.is_empty ())
1925 dref_entry e = dref_queue.pop ();
1926 debug_hooks->register_external_die (e.decl, e.sym, e.off);
1929 tree t = lto_input_tree_1 (ib, data_in, tag, 0);
1931 if (!dref_queue.is_empty ())
1933 dref_entry e = dref_queue.pop ();
1934 debug_hooks->register_external_die (e.decl, e.sym, e.off);
1935 gcc_checking_assert (dref_queue.is_empty ());
1937 return t;
1941 /* Input toplevel asms. */
1943 void
1944 lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base)
1946 size_t len;
1947 const char *data
1948 = lto_get_summary_section_data (file_data, LTO_section_asm, &len);
1949 const struct lto_simple_header_with_strings *header
1950 = (const struct lto_simple_header_with_strings *) data;
1951 int string_offset;
1952 class data_in *data_in;
1953 tree str;
1955 if (! data)
1956 return;
1958 string_offset = sizeof (*header) + header->main_size;
1960 lto_input_block ib (data + sizeof (*header), header->main_size,
1961 file_data);
1963 data_in = lto_data_in_create (file_data, data + string_offset,
1964 header->string_size, vNULL);
1966 while ((str = streamer_read_string_cst (data_in, &ib)))
1968 asm_node *node = symtab->finalize_toplevel_asm (str);
1969 node->order = streamer_read_hwi (&ib) + order_base;
1970 if (node->order >= symtab->order)
1971 symtab->order = node->order + 1;
1974 lto_data_in_delete (data_in);
1976 lto_free_section_data (file_data, LTO_section_asm, NULL, data, len);
1980 /* Input mode table. */
1982 void
1983 lto_input_mode_table (struct lto_file_decl_data *file_data)
1985 size_t len;
1986 const char *data
1987 = lto_get_summary_section_data (file_data, LTO_section_mode_table, &len);
1988 if (! data)
1989 internal_error ("cannot read LTO mode table from %s",
1990 file_data->file_name);
1992 const struct lto_simple_header_with_strings *header
1993 = (const struct lto_simple_header_with_strings *) data;
1994 int string_offset;
1995 class data_in *data_in;
1996 string_offset = sizeof (*header) + header->main_size;
1998 lto_input_block ib (data + sizeof (*header), header->main_size, NULL);
1999 data_in = lto_data_in_create (file_data, data + string_offset,
2000 header->string_size, vNULL);
2001 bitpack_d bp = streamer_read_bitpack (&ib);
2003 unsigned mode_bits = bp_unpack_value (&bp, 5);
2004 unsigned char *table = ggc_cleared_vec_alloc<unsigned char> (1 << mode_bits);
2006 file_data->mode_table = table;
2007 file_data->mode_bits = mode_bits;
2009 table[VOIDmode] = VOIDmode;
2010 table[BLKmode] = BLKmode;
2011 unsigned int m;
2012 while ((m = bp_unpack_value (&bp, mode_bits)) != VOIDmode)
2014 enum mode_class mclass
2015 = bp_unpack_enum (&bp, mode_class, MAX_MODE_CLASS);
2016 poly_uint16 size = bp_unpack_poly_value (&bp, 16);
2017 poly_uint16 prec = bp_unpack_poly_value (&bp, 16);
2018 machine_mode inner = (machine_mode) bp_unpack_value (&bp, mode_bits);
2019 poly_uint16 nunits = bp_unpack_poly_value (&bp, 16);
2020 unsigned int ibit = 0, fbit = 0;
2021 unsigned int real_fmt_len = 0;
2022 const char *real_fmt_name = NULL;
2023 switch (mclass)
2025 case MODE_FRACT:
2026 case MODE_UFRACT:
2027 case MODE_ACCUM:
2028 case MODE_UACCUM:
2029 ibit = bp_unpack_value (&bp, 8);
2030 fbit = bp_unpack_value (&bp, 8);
2031 break;
2032 case MODE_FLOAT:
2033 case MODE_DECIMAL_FLOAT:
2034 real_fmt_name = bp_unpack_indexed_string (data_in, &bp,
2035 &real_fmt_len);
2036 break;
2037 default:
2038 break;
2040 /* First search just the GET_CLASS_NARROWEST_MODE to wider modes,
2041 if not found, fallback to all modes. */
2042 int pass;
2043 for (pass = 0; pass < 2; pass++)
2044 for (machine_mode mr = pass ? VOIDmode
2045 : GET_CLASS_NARROWEST_MODE (mclass);
2046 pass ? mr < MAX_MACHINE_MODE : mr != VOIDmode;
2047 pass ? mr = (machine_mode) (mr + 1)
2048 : mr = GET_MODE_WIDER_MODE (mr).else_void ())
2049 if (GET_MODE_CLASS (mr) != mclass
2050 || maybe_ne (GET_MODE_SIZE (mr), size)
2051 || maybe_ne (GET_MODE_PRECISION (mr), prec)
2052 || (inner == m
2053 ? GET_MODE_INNER (mr) != mr
2054 : GET_MODE_INNER (mr) != table[(int) inner])
2055 || GET_MODE_IBIT (mr) != ibit
2056 || GET_MODE_FBIT (mr) != fbit
2057 || maybe_ne (GET_MODE_NUNITS (mr), nunits))
2058 continue;
2059 else if ((mclass == MODE_FLOAT || mclass == MODE_DECIMAL_FLOAT)
2060 && strcmp (REAL_MODE_FORMAT (mr)->name, real_fmt_name) != 0)
2061 continue;
2062 else
2064 table[m] = mr;
2065 pass = 2;
2066 break;
2068 unsigned int mname_len;
2069 const char *mname = bp_unpack_indexed_string (data_in, &bp, &mname_len);
2070 if (pass == 2)
2072 switch (mclass)
2074 case MODE_VECTOR_BOOL:
2075 case MODE_VECTOR_INT:
2076 case MODE_VECTOR_FLOAT:
2077 case MODE_VECTOR_FRACT:
2078 case MODE_VECTOR_UFRACT:
2079 case MODE_VECTOR_ACCUM:
2080 case MODE_VECTOR_UACCUM:
2081 /* For unsupported vector modes just use BLKmode,
2082 if the scalar mode is supported. */
2083 if (table[(int) inner] != VOIDmode)
2085 table[m] = BLKmode;
2086 break;
2088 /* FALLTHRU */
2089 default:
2090 /* This is only used for offloading-target compilations and
2091 is a user-facing error. Give a better error message for
2092 the common modes; see also mode-classes.def. */
2093 if (mclass == MODE_FLOAT)
2094 fatal_error (UNKNOWN_LOCATION,
2095 "%s - %u-bit-precision floating-point numbers "
2096 "unsupported (mode %qs)", TARGET_MACHINE,
2097 prec.to_constant (), mname);
2098 else if (mclass == MODE_DECIMAL_FLOAT)
2099 fatal_error (UNKNOWN_LOCATION,
2100 "%s - %u-bit-precision decimal floating-point "
2101 "numbers unsupported (mode %qs)", TARGET_MACHINE,
2102 prec.to_constant (), mname);
2103 else if (mclass == MODE_COMPLEX_FLOAT)
2104 fatal_error (UNKNOWN_LOCATION,
2105 "%s - %u-bit-precision complex floating-point "
2106 "numbers unsupported (mode %qs)", TARGET_MACHINE,
2107 prec.to_constant (), mname);
2108 else if (mclass == MODE_INT)
2109 fatal_error (UNKNOWN_LOCATION,
2110 "%s - %u-bit integer numbers unsupported (mode "
2111 "%qs)", TARGET_MACHINE, prec.to_constant (), mname);
2112 else
2113 fatal_error (UNKNOWN_LOCATION, "%s - unsupported mode %qs",
2114 TARGET_MACHINE, mname);
2115 break;
2119 lto_data_in_delete (data_in);
2121 lto_free_section_data (file_data, LTO_section_mode_table, NULL, data, len);
2125 /* Initialization for the LTO reader. */
2127 void
2128 lto_reader_init (void)
2130 lto_streamer_init ();
2131 file_name_hash_table
2132 = new hash_table<string_slot_hasher> (37);
2133 string_slot_allocator = new object_allocator <struct string_slot>
2134 ("line map file name hash");
2135 gcc_obstack_init (&file_name_obstack);
2138 /* Free hash table used to stream in location file names. */
2140 void
2141 lto_free_file_name_hash (void)
2143 delete file_name_hash_table;
2144 file_name_hash_table = NULL;
2145 delete string_slot_allocator;
2146 string_slot_allocator = NULL;
2147 delete path_name_pair_hash_table;
2148 path_name_pair_hash_table = NULL;
2149 delete string_pair_map_allocator;
2150 string_pair_map_allocator = NULL;
2151 /* file_name_obstack must stay allocated since it is referred to by
2152 line map table. */
2156 /* Create a new data_in object for FILE_DATA. STRINGS is the string
2157 table to use with LEN strings. RESOLUTIONS is the vector of linker
2158 resolutions (NULL if not using a linker plugin). */
2160 class data_in *
2161 lto_data_in_create (struct lto_file_decl_data *file_data, const char *strings,
2162 unsigned len,
2163 vec<ld_plugin_symbol_resolution_t> resolutions)
2165 class data_in *data_in = new (class data_in);
2166 data_in->file_data = file_data;
2167 data_in->strings = strings;
2168 data_in->strings_len = len;
2169 data_in->globals_resolution = resolutions;
2170 data_in->reader_cache = streamer_tree_cache_create (false, false, true);
2171 return data_in;
2175 /* Remove DATA_IN. */
2177 void
2178 lto_data_in_delete (class data_in *data_in)
2180 data_in->globals_resolution.release ();
2181 streamer_tree_cache_delete (data_in->reader_cache);
2182 delete data_in;