]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/tree-streamer-in.c
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / tree-streamer-in.c
1 /* Routines for reading trees from a file stream.
2
3 Copyright (C) 2011-2021 Free Software Foundation, Inc.
4 Contributed by Diego Novillo <dnovillo@google.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "backend.h"
26 #include "target.h"
27 #include "tree.h"
28 #include "gimple.h"
29 #include "stringpool.h"
30 #include "tree-streamer.h"
31 #include "cgraph.h"
32 #include "builtins.h"
33 #include "gomp-constants.h"
34 #include "stringpool.h"
35 #include "attribs.h"
36 #include "asan.h"
37 #include "opts.h"
38
39
40 /* Read a STRING_CST from the string table in DATA_IN using input
41 block IB. */
42
43 tree
44 streamer_read_string_cst (class data_in *data_in, class lto_input_block *ib)
45 {
46 unsigned int len;
47 const char * ptr;
48
49 ptr = streamer_read_indexed_string (data_in, ib, &len);
50 if (!ptr)
51 return NULL;
52 return build_string (len, ptr);
53 }
54
55
56 /* Read an IDENTIFIER from the string table in DATA_IN using input
57 block IB. */
58
59 static tree
60 input_identifier (class data_in *data_in, class lto_input_block *ib)
61 {
62 unsigned int len;
63 const char *ptr;
64
65 ptr = streamer_read_indexed_string (data_in, ib, &len);
66 if (!ptr)
67 return NULL;
68 return get_identifier_with_length (ptr, len);
69 }
70
71
72 /* Read a chain of tree nodes from input block IB. DATA_IN contains
73 tables and descriptors for the file being read. */
74
75 static tree
76 streamer_read_chain (class lto_input_block *ib, class data_in *data_in)
77 {
78 tree first, prev, curr;
79
80 /* The chain is written as NULL terminated list of trees. */
81 first = prev = NULL_TREE;
82 do
83 {
84 curr = stream_read_tree_ref (ib, data_in);
85 if (prev)
86 TREE_CHAIN (prev) = curr;
87 else
88 first = curr;
89
90 prev = curr;
91 }
92 while (curr);
93
94 return first;
95 }
96
97
98 /* Unpack all the non-pointer fields of the TS_BASE structure of
99 expression EXPR from bitpack BP. */
100
101 static inline void
102 unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
103 {
104 /* Note that the code for EXPR has already been unpacked to create EXPR in
105 streamer_alloc_tree. */
106 if (!TYPE_P (expr))
107 {
108 TREE_SIDE_EFFECTS (expr) = (unsigned) bp_unpack_value (bp, 1);
109 TREE_CONSTANT (expr) = (unsigned) bp_unpack_value (bp, 1);
110 TREE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
111
112 /* TREE_PUBLIC is used on types to indicate that the type
113 has a TYPE_CACHED_VALUES vector. This is not streamed out,
114 so we skip it here. */
115 TREE_PUBLIC (expr) = (unsigned) bp_unpack_value (bp, 1);
116 }
117 else
118 bp_unpack_value (bp, 4);
119 TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
120 TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1);
121 if (DECL_P (expr))
122 {
123 DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
124 DECL_NAMELESS (expr) = (unsigned) bp_unpack_value (bp, 1);
125 }
126 else if (TYPE_P (expr))
127 TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
128 else
129 bp_unpack_value (bp, 1);
130 TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1);
131 if (TYPE_P (expr))
132 TYPE_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
133 else
134 TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
135 TREE_NOTHROW (expr) = (unsigned) bp_unpack_value (bp, 1);
136 TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1);
137 if (TREE_CODE (expr) != TREE_BINFO)
138 TREE_PRIVATE (expr) = (unsigned) bp_unpack_value (bp, 1);
139 else
140 bp_unpack_value (bp, 1);
141 TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1);
142 TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1);
143 if (TYPE_P (expr))
144 {
145 if (AGGREGATE_TYPE_P (expr))
146 TYPE_REVERSE_STORAGE_ORDER (expr) = (unsigned) bp_unpack_value (bp, 1);
147 else
148 TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
149 TYPE_ADDR_SPACE (expr) = (unsigned) bp_unpack_value (bp, 8);
150 }
151 else if (TREE_CODE (expr) == BIT_FIELD_REF || TREE_CODE (expr) == MEM_REF)
152 {
153 REF_REVERSE_STORAGE_ORDER (expr) = (unsigned) bp_unpack_value (bp, 1);
154 bp_unpack_value (bp, 8);
155 }
156 else if (TREE_CODE (expr) == SSA_NAME)
157 {
158 SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
159 bp_unpack_value (bp, 8);
160 }
161 else if (TREE_CODE (expr) == CALL_EXPR)
162 {
163 CALL_EXPR_BY_DESCRIPTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
164 bp_unpack_value (bp, 8);
165 }
166 else
167 bp_unpack_value (bp, 9);
168 }
169
170
171 /* Unpack all the non-pointer fields of the TS_INT_CST structure of
172 expression EXPR from bitpack BP. */
173
174 static void
175 unpack_ts_int_cst_value_fields (struct bitpack_d *bp, tree expr)
176 {
177 int i;
178 for (i = 0; i < TREE_INT_CST_EXT_NUNITS (expr); i++)
179 TREE_INT_CST_ELT (expr, i) = bp_unpack_var_len_int (bp);
180 }
181
182
183 /* Unpack all the non-pointer fields of the TS_REAL_CST structure of
184 expression EXPR from bitpack BP. */
185
186 static void
187 unpack_ts_real_cst_value_fields (struct bitpack_d *bp, tree expr)
188 {
189 unsigned i;
190 REAL_VALUE_TYPE r;
191 REAL_VALUE_TYPE *rp;
192
193 /* Clear all bits of the real value type so that we can later do
194 bitwise comparisons to see if two values are the same. */
195 memset (&r, 0, sizeof r);
196 r.cl = (unsigned) bp_unpack_value (bp, 2);
197 r.decimal = (unsigned) bp_unpack_value (bp, 1);
198 r.sign = (unsigned) bp_unpack_value (bp, 1);
199 r.signalling = (unsigned) bp_unpack_value (bp, 1);
200 r.canonical = (unsigned) bp_unpack_value (bp, 1);
201 r.uexp = (unsigned) bp_unpack_value (bp, EXP_BITS);
202 for (i = 0; i < SIGSZ; i++)
203 r.sig[i] = (unsigned long) bp_unpack_value (bp, HOST_BITS_PER_LONG);
204
205 rp = ggc_alloc<real_value> ();
206 memcpy (rp, &r, sizeof (REAL_VALUE_TYPE));
207 TREE_REAL_CST_PTR (expr) = rp;
208 }
209
210
211 /* Unpack all the non-pointer fields of the TS_FIXED_CST structure of
212 expression EXPR from bitpack BP. */
213
214 static void
215 unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr)
216 {
217 FIXED_VALUE_TYPE *fp = ggc_alloc<fixed_value> ();
218 fp->mode = as_a <scalar_mode> (bp_unpack_machine_mode (bp));
219 fp->data.low = bp_unpack_var_len_int (bp);
220 fp->data.high = bp_unpack_var_len_int (bp);
221 TREE_FIXED_CST_PTR (expr) = fp;
222 }
223
224 /* Unpack all the non-pointer fields of the TS_DECL_COMMON structure
225 of expression EXPR from bitpack BP. */
226
227 static void
228 unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr)
229 {
230 SET_DECL_MODE (expr, bp_unpack_machine_mode (bp));
231 DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1);
232 DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);
233 DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1);
234 DECL_ABSTRACT_P (expr) = (unsigned) bp_unpack_value (bp, 1);
235 DECL_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
236 DECL_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);
237 DECL_PRESERVE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
238 DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1);
239 DECL_NOT_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1);
240 SET_DECL_ALIGN (expr, (unsigned) bp_unpack_var_len_unsigned (bp));
241 #ifdef ACCEL_COMPILER
242 if (DECL_ALIGN (expr) > targetm.absolute_biggest_alignment)
243 SET_DECL_ALIGN (expr, targetm.absolute_biggest_alignment);
244 #endif
245 if (TREE_CODE (expr) == LABEL_DECL)
246 {
247 EH_LANDING_PAD_NR (expr) = (int) bp_unpack_var_len_unsigned (bp);
248
249 /* Always assume an initial value of -1 for LABEL_DECL_UID to
250 force gimple_set_bb to recreate label_to_block_map. */
251 LABEL_DECL_UID (expr) = -1;
252 }
253
254 else if (TREE_CODE (expr) == FIELD_DECL)
255 {
256 DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
257 DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
258 DECL_PADDING_P (expr) = (unsigned) bp_unpack_value (bp, 1);
259 unsigned val = (unsigned) bp_unpack_value (bp, 1);
260 if (DECL_BIT_FIELD (expr))
261 SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD (expr, val);
262 else
263 SET_DECL_FIELD_ABI_IGNORED (expr, val);
264 expr->decl_common.off_align = bp_unpack_value (bp, 8);
265 }
266
267 else if (VAR_P (expr))
268 {
269 DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
270 DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);
271 }
272
273 else if (TREE_CODE (expr) == PARM_DECL)
274 DECL_HIDDEN_STRING_LENGTH (expr) = (unsigned) bp_unpack_value (bp, 1);
275
276 if (TREE_CODE (expr) == RESULT_DECL
277 || TREE_CODE (expr) == PARM_DECL
278 || VAR_P (expr))
279 {
280 DECL_BY_REFERENCE (expr) = (unsigned) bp_unpack_value (bp, 1);
281 if (VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
282 DECL_HAS_VALUE_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
283 }
284 }
285
286
287 /* Unpack all the non-pointer fields of the TS_DECL_WRTL structure
288 of expression EXPR from bitpack BP. */
289
290 static void
291 unpack_ts_decl_wrtl_value_fields (struct bitpack_d *bp, tree expr)
292 {
293 DECL_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1);
294 }
295
296
297 /* Unpack all the non-pointer fields of the TS_DECL_WITH_VIS structure
298 of expression EXPR from bitpack BP. */
299
300 static void
301 unpack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr)
302 {
303 DECL_COMMON (expr) = (unsigned) bp_unpack_value (bp, 1);
304 DECL_DLLIMPORT_P (expr) = (unsigned) bp_unpack_value (bp, 1);
305 DECL_WEAK (expr) = (unsigned) bp_unpack_value (bp, 1);
306 DECL_SEEN_IN_BIND_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
307 DECL_COMDAT (expr) = (unsigned) bp_unpack_value (bp, 1);
308 DECL_VISIBILITY (expr) = (enum symbol_visibility) bp_unpack_value (bp, 2);
309 DECL_VISIBILITY_SPECIFIED (expr) = (unsigned) bp_unpack_value (bp, 1);
310
311 if (VAR_P (expr))
312 {
313 DECL_HARD_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1);
314 DECL_IN_CONSTANT_POOL (expr) = (unsigned) bp_unpack_value (bp, 1);
315 }
316
317 if (TREE_CODE (expr) == FUNCTION_DECL)
318 {
319 DECL_FINAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);
320 DECL_CXX_CONSTRUCTOR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
321 DECL_CXX_DESTRUCTOR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
322 }
323 }
324
325
326 /* Unpack all the non-pointer fields of the TS_FUNCTION_DECL structure
327 of expression EXPR from bitpack BP. */
328
329 static void
330 unpack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
331 {
332 built_in_class cl = bp_unpack_enum (bp, built_in_class, BUILT_IN_LAST);
333 DECL_STATIC_CONSTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
334 DECL_STATIC_DESTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
335 DECL_UNINLINABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
336 DECL_POSSIBLY_INLINED (expr) = (unsigned) bp_unpack_value (bp, 1);
337 DECL_IS_NOVOPS (expr) = (unsigned) bp_unpack_value (bp, 1);
338 DECL_IS_RETURNS_TWICE (expr) = (unsigned) bp_unpack_value (bp, 1);
339 DECL_IS_MALLOC (expr) = (unsigned) bp_unpack_value (bp, 1);
340 FUNCTION_DECL_DECL_TYPE (expr) = (function_decl_type) bp_unpack_value (bp, 2);
341 DECL_SET_IS_OPERATOR_DELETE (expr, (unsigned) bp_unpack_value (bp, 1));
342 DECL_DECLARED_INLINE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
343 DECL_STATIC_CHAIN (expr) = (unsigned) bp_unpack_value (bp, 1);
344 DECL_NO_INLINE_WARNING_P (expr) = (unsigned) bp_unpack_value (bp, 1);
345 DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr)
346 = (unsigned) bp_unpack_value (bp, 1);
347 DECL_NO_LIMIT_STACK (expr) = (unsigned) bp_unpack_value (bp, 1);
348 DECL_DISREGARD_INLINE_LIMITS (expr) = (unsigned) bp_unpack_value (bp, 1);
349 DECL_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
350 DECL_LOOPING_CONST_OR_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
351 DECL_IS_REPLACEABLE_OPERATOR (expr) = (unsigned) bp_unpack_value (bp, 1);
352 unsigned int fcode = 0;
353 if (cl != NOT_BUILT_IN)
354 {
355 fcode = bp_unpack_value (bp, 32);
356 if (cl == BUILT_IN_NORMAL && fcode >= END_BUILTINS)
357 fatal_error (input_location,
358 "machine independent builtin code out of range");
359 else if (cl == BUILT_IN_MD)
360 {
361 tree result = targetm.builtin_decl (fcode, true);
362 if (!result || result == error_mark_node)
363 fatal_error (input_location,
364 "target specific builtin not available");
365 }
366 }
367 set_decl_built_in_function (expr, cl, fcode);
368 }
369
370
371 /* Unpack all the non-pointer fields of the TS_TYPE_COMMON structure
372 of expression EXPR from bitpack BP. */
373
374 static void
375 unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
376 {
377 machine_mode mode;
378
379 mode = bp_unpack_machine_mode (bp);
380 SET_TYPE_MODE (expr, mode);
381 /* TYPE_NO_FORCE_BLK is private to stor-layout and need
382 no streaming. */
383 TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
384 TYPE_RESTRICT (expr) = (unsigned) bp_unpack_value (bp, 1);
385 TYPE_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);
386 TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
387 TYPE_LANG_FLAG_0 (expr) = (unsigned) bp_unpack_value (bp, 1);
388 if (RECORD_OR_UNION_TYPE_P (expr))
389 {
390 TYPE_TRANSPARENT_AGGR (expr) = (unsigned) bp_unpack_value (bp, 1);
391 TYPE_FINAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);
392 TYPE_CXX_ODR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
393 }
394 else if (TREE_CODE (expr) == ARRAY_TYPE)
395 TYPE_NONALIASED_COMPONENT (expr) = (unsigned) bp_unpack_value (bp, 1);
396 if (TREE_CODE (expr) == ARRAY_TYPE || TREE_CODE (expr) == INTEGER_TYPE)
397 TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1);
398 if (AGGREGATE_TYPE_P (expr))
399 TYPE_TYPELESS_STORAGE (expr) = (unsigned) bp_unpack_value (bp, 1);
400 TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1);
401 TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp);
402 SET_TYPE_ALIGN (expr, bp_unpack_var_len_unsigned (bp));
403 #ifdef ACCEL_COMPILER
404 if (TYPE_ALIGN (expr) > targetm.absolute_biggest_alignment)
405 SET_TYPE_ALIGN (expr, targetm.absolute_biggest_alignment);
406 #endif
407 }
408
409
410 /* Unpack all the non-pointer fields of the TS_BLOCK structure
411 of expression EXPR from bitpack BP. */
412
413 static void
414 unpack_ts_block_value_fields (class data_in *data_in,
415 struct bitpack_d *bp, tree expr)
416 {
417 /* BLOCK_NUMBER is recomputed. */
418 stream_input_location (&BLOCK_SOURCE_LOCATION (expr), bp, data_in);
419 }
420
421 /* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
422 structure of expression EXPR from bitpack BP. */
423
424 static void
425 unpack_ts_translation_unit_decl_value_fields (class data_in *data_in,
426 struct bitpack_d *bp, tree expr)
427 {
428 TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (bp_unpack_string (data_in, bp));
429 vec_safe_push (all_translation_units, expr);
430 }
431
432
433 /* Unpack all the non-pointer fields of the TS_OMP_CLAUSE
434 structure of expression EXPR from bitpack BP. */
435
436 static void
437 unpack_ts_omp_clause_value_fields (class data_in *data_in,
438 struct bitpack_d *bp, tree expr)
439 {
440 stream_input_location (&OMP_CLAUSE_LOCATION (expr), bp, data_in);
441 switch (OMP_CLAUSE_CODE (expr))
442 {
443 case OMP_CLAUSE_DEFAULT:
444 OMP_CLAUSE_DEFAULT_KIND (expr)
445 = bp_unpack_enum (bp, omp_clause_default_kind,
446 OMP_CLAUSE_DEFAULT_LAST);
447 break;
448 case OMP_CLAUSE_SCHEDULE:
449 OMP_CLAUSE_SCHEDULE_KIND (expr)
450 = bp_unpack_enum (bp, omp_clause_schedule_kind,
451 OMP_CLAUSE_SCHEDULE_LAST);
452 break;
453 case OMP_CLAUSE_DEPEND:
454 OMP_CLAUSE_DEPEND_KIND (expr)
455 = bp_unpack_enum (bp, omp_clause_depend_kind, OMP_CLAUSE_DEPEND_LAST);
456 break;
457 case OMP_CLAUSE_MAP:
458 OMP_CLAUSE_SET_MAP_KIND (expr, bp_unpack_enum (bp, gomp_map_kind,
459 GOMP_MAP_LAST));
460 break;
461 case OMP_CLAUSE_PROC_BIND:
462 OMP_CLAUSE_PROC_BIND_KIND (expr)
463 = bp_unpack_enum (bp, omp_clause_proc_bind_kind,
464 OMP_CLAUSE_PROC_BIND_LAST);
465 break;
466 case OMP_CLAUSE_REDUCTION:
467 case OMP_CLAUSE_TASK_REDUCTION:
468 case OMP_CLAUSE_IN_REDUCTION:
469 OMP_CLAUSE_REDUCTION_CODE (expr)
470 = bp_unpack_enum (bp, tree_code, MAX_TREE_CODES);
471 break;
472 default:
473 break;
474 }
475 }
476
477
478 /* Read all the language-independent bitfield values for EXPR from IB.
479 Return the partially unpacked bitpack so the caller can unpack any other
480 bitfield values that the writer may have written. */
481
482 void
483 streamer_read_tree_bitfields (class lto_input_block *ib,
484 class data_in *data_in, tree expr)
485 {
486 enum tree_code code;
487 struct bitpack_d bp;
488
489 /* Read the bitpack of non-pointer values from IB. */
490 bp = streamer_read_bitpack (ib);
491
492 /* The first word in BP contains the code of the tree that we
493 are about to read. */
494 if (streamer_debugging)
495 {
496 code = (enum tree_code) bp_unpack_value (&bp, 16);
497 lto_tag_check (lto_tree_code_to_tag (code),
498 lto_tree_code_to_tag (TREE_CODE (expr)));
499 }
500 code = TREE_CODE (expr);
501
502 /* Note that all these functions are highly sensitive to changes in
503 the types and sizes of each of the fields being packed. */
504 unpack_ts_base_value_fields (&bp, expr);
505
506 if (CODE_CONTAINS_STRUCT (code, TS_INT_CST))
507 unpack_ts_int_cst_value_fields (&bp, expr);
508
509 if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST))
510 unpack_ts_real_cst_value_fields (&bp, expr);
511
512 if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST))
513 unpack_ts_fixed_cst_value_fields (&bp, expr);
514
515 if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL))
516 stream_input_location (&DECL_SOURCE_LOCATION (expr), &bp, data_in);
517
518 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
519 unpack_ts_decl_common_value_fields (&bp, expr);
520
521 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
522 unpack_ts_decl_wrtl_value_fields (&bp, expr);
523
524 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
525 unpack_ts_decl_with_vis_value_fields (&bp, expr);
526
527 if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
528 unpack_ts_function_decl_value_fields (&bp, expr);
529
530 if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
531 unpack_ts_type_common_value_fields (&bp, expr);
532
533 if (CODE_CONTAINS_STRUCT (code, TS_EXP))
534 {
535 stream_input_location (&EXPR_CHECK (expr)->exp.locus, &bp, data_in);
536 if (code == MEM_REF
537 || code == TARGET_MEM_REF)
538 {
539 MR_DEPENDENCE_CLIQUE (expr)
540 = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8);
541 if (MR_DEPENDENCE_CLIQUE (expr) != 0)
542 MR_DEPENDENCE_BASE (expr)
543 = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8);
544 }
545 else if (code == CALL_EXPR)
546 CALL_EXPR_IFN (expr) = bp_unpack_enum (&bp, internal_fn, IFN_LAST);
547 }
548
549 if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
550 unpack_ts_block_value_fields (data_in, &bp, expr);
551
552 if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
553 unpack_ts_translation_unit_decl_value_fields (data_in, &bp, expr);
554
555 if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
556 cl_optimization_stream_in (data_in, &bp, TREE_OPTIMIZATION (expr));
557
558 if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
559 {
560 unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp);
561 if (length > 0)
562 vec_safe_grow (CONSTRUCTOR_ELTS (expr), length, true);
563 }
564
565 #ifndef ACCEL_COMPILER
566 if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
567 {
568 cl_target_option_stream_in (data_in, &bp, TREE_TARGET_OPTION (expr));
569 if (targetm.target_option.post_stream_in)
570 targetm.target_option.post_stream_in (TREE_TARGET_OPTION (expr));
571 }
572 #endif
573
574 if (code == OMP_CLAUSE)
575 unpack_ts_omp_clause_value_fields (data_in, &bp, expr);
576 }
577
578
579 /* Materialize a new tree from input block IB using descriptors in
580 DATA_IN. The code for the new tree should match TAG. Store in
581 *IX_P the index into the reader cache where the new tree is stored. */
582
583 tree
584 streamer_alloc_tree (class lto_input_block *ib, class data_in *data_in,
585 enum LTO_tags tag)
586 {
587 enum tree_code code;
588 tree result;
589
590 result = NULL_TREE;
591
592 code = lto_tag_to_tree_code (tag);
593
594 /* We should never see an SSA_NAME tree. Only the version numbers of
595 SSA names are ever written out. See input_ssa_names. */
596 gcc_assert (code != SSA_NAME);
597
598 /* Instantiate a new tree using the header data. */
599 if (CODE_CONTAINS_STRUCT (code, TS_STRING))
600 result = streamer_read_string_cst (data_in, ib);
601 else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER))
602 result = input_identifier (data_in, ib);
603 else if (CODE_CONTAINS_STRUCT (code, TS_VEC))
604 {
605 HOST_WIDE_INT len = streamer_read_hwi (ib);
606 result = make_tree_vec (len);
607 }
608 else if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
609 {
610 bitpack_d bp = streamer_read_bitpack (ib);
611 unsigned int log2_npatterns = bp_unpack_value (&bp, 8);
612 unsigned int nelts_per_pattern = bp_unpack_value (&bp, 8);
613 result = make_vector (log2_npatterns, nelts_per_pattern);
614 }
615 else if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
616 {
617 unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
618 result = make_tree_binfo (len);
619 }
620 else if (CODE_CONTAINS_STRUCT (code, TS_INT_CST))
621 {
622 unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
623 unsigned HOST_WIDE_INT ext_len = streamer_read_uhwi (ib);
624 result = make_int_cst (len, ext_len);
625 }
626 else if (code == CALL_EXPR)
627 {
628 unsigned HOST_WIDE_INT nargs = streamer_read_uhwi (ib);
629 return build_vl_exp (CALL_EXPR, nargs + 3);
630 }
631 else if (code == OMP_CLAUSE)
632 {
633 enum omp_clause_code subcode
634 = (enum omp_clause_code) streamer_read_uhwi (ib);
635 return build_omp_clause (UNKNOWN_LOCATION, subcode);
636 }
637 else
638 {
639 /* For all other nodes, materialize the tree with a raw
640 make_node call. */
641 result = make_node (code);
642 }
643
644 return result;
645 }
646
647
648 /* Read all pointer fields in the TS_COMMON structure of EXPR from input
649 block IB. DATA_IN contains tables and descriptors for the
650 file being read. */
651
652
653 static void
654 lto_input_ts_common_tree_pointers (class lto_input_block *ib,
655 class data_in *data_in, tree expr)
656 {
657 if (TREE_CODE (expr) != IDENTIFIER_NODE)
658 TREE_TYPE (expr) = stream_read_tree_ref (ib, data_in);
659 }
660
661
662 /* Read all pointer fields in the TS_VECTOR structure of EXPR from input
663 block IB. DATA_IN contains tables and descriptors for the
664 file being read. */
665
666 static void
667 lto_input_ts_vector_tree_pointers (class lto_input_block *ib,
668 class data_in *data_in, tree expr)
669 {
670 unsigned int count = vector_cst_encoded_nelts (expr);
671 for (unsigned int i = 0; i < count; ++i)
672 VECTOR_CST_ENCODED_ELT (expr, i) = stream_read_tree_ref (ib, data_in);
673 }
674
675
676 /* Read all pointer fields in the TS_POLY_INT_CST structure of EXPR from
677 input block IB. DATA_IN contains tables and descriptors for the
678 file being read. */
679
680 static void
681 lto_input_ts_poly_tree_pointers (class lto_input_block *ib,
682 class data_in *data_in, tree expr)
683 {
684 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
685 POLY_INT_CST_COEFF (expr, i) = stream_read_tree_ref (ib, data_in);
686 }
687
688
689 /* Read all pointer fields in the TS_COMPLEX structure of EXPR from input
690 block IB. DATA_IN contains tables and descriptors for the
691 file being read. */
692
693 static void
694 lto_input_ts_complex_tree_pointers (class lto_input_block *ib,
695 class data_in *data_in, tree expr)
696 {
697 TREE_REALPART (expr) = stream_read_tree_ref (ib, data_in);
698 TREE_IMAGPART (expr) = stream_read_tree_ref (ib, data_in);
699 }
700
701
702 /* Read all pointer fields in the TS_DECL_MINIMAL structure of EXPR
703 from input block IB. DATA_IN contains tables and descriptors for the
704 file being read. */
705
706 static void
707 lto_input_ts_decl_minimal_tree_pointers (class lto_input_block *ib,
708 class data_in *data_in, tree expr)
709 {
710 DECL_NAME (expr) = stream_read_tree_ref (ib, data_in);
711 DECL_CONTEXT (expr) = stream_read_tree_ref (ib, data_in);
712 }
713
714
715 /* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from
716 input block IB. DATA_IN contains tables and descriptors for the
717 file being read. */
718
719 static void
720 lto_input_ts_decl_common_tree_pointers (class lto_input_block *ib,
721 class data_in *data_in, tree expr)
722 {
723 DECL_SIZE (expr) = stream_read_tree_ref (ib, data_in);
724 DECL_SIZE_UNIT (expr) = stream_read_tree_ref (ib, data_in);
725 DECL_ATTRIBUTES (expr) = stream_read_tree_ref (ib, data_in);
726 DECL_ABSTRACT_ORIGIN (expr) = stream_read_tree_ref (ib, data_in);
727
728 if ((VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
729 && DECL_HAS_VALUE_EXPR_P (expr))
730 SET_DECL_VALUE_EXPR (expr, stream_read_tree_ref (ib, data_in));
731
732 if (VAR_P (expr)
733 && DECL_HAS_DEBUG_EXPR_P (expr))
734 {
735 tree dexpr = stream_read_tree_ref (ib, data_in);
736 if (dexpr)
737 SET_DECL_DEBUG_EXPR (expr, dexpr);
738 }
739 }
740
741
742 /* Read all pointer fields in the TS_DECL_NON_COMMON structure of
743 EXPR from input block IB. DATA_IN contains tables and descriptors for the
744 file being read. */
745
746 static void
747 lto_input_ts_decl_non_common_tree_pointers (class lto_input_block *,
748 class data_in *, tree)
749 {
750 }
751
752
753 /* Read all pointer fields in the TS_DECL_WITH_VIS structure of EXPR
754 from input block IB. DATA_IN contains tables and descriptors for the
755 file being read. */
756
757 static void
758 lto_input_ts_decl_with_vis_tree_pointers (class lto_input_block *ib,
759 class data_in *data_in, tree expr)
760 {
761 tree id;
762
763 id = stream_read_tree_ref (ib, data_in);
764 if (id)
765 {
766 gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE);
767 SET_DECL_ASSEMBLER_NAME (expr, id);
768 }
769 }
770
771
772 /* Read all pointer fields in the TS_FIELD_DECL structure of EXPR from
773 input block IB. DATA_IN contains tables and descriptors for the
774 file being read. */
775
776 static void
777 lto_input_ts_field_decl_tree_pointers (class lto_input_block *ib,
778 class data_in *data_in, tree expr)
779 {
780 DECL_FIELD_OFFSET (expr) = stream_read_tree_ref (ib, data_in);
781 DECL_BIT_FIELD_TYPE (expr) = stream_read_tree_ref (ib, data_in);
782 DECL_BIT_FIELD_REPRESENTATIVE (expr) = stream_read_tree_ref (ib, data_in);
783 DECL_FIELD_BIT_OFFSET (expr) = stream_read_tree_ref (ib, data_in);
784 }
785
786
787 /* Read all pointer fields in the TS_FUNCTION_DECL structure of EXPR
788 from input block IB. DATA_IN contains tables and descriptors for the
789 file being read. */
790
791 static void
792 lto_input_ts_function_decl_tree_pointers (class lto_input_block *ib,
793 class data_in *data_in, tree expr)
794 {
795 /* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body. */
796 DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree_ref (ib, data_in);
797 #ifndef ACCEL_COMPILER
798 DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree_ref (ib, data_in);
799 #endif
800 DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr)
801 = stream_read_tree_ref (ib, data_in);
802 #ifdef ACCEL_COMPILER
803 {
804 tree opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr);
805 if (opts)
806 {
807 struct gcc_options tmp, tmp_set;
808 init_options_struct (&tmp, NULL);
809 memset (&tmp_set, 0, sizeof (tmp_set));
810 cl_optimization_restore (&tmp, &tmp_set, TREE_OPTIMIZATION (opts));
811 finish_options (&tmp, &tmp_set, UNKNOWN_LOCATION);
812 opts = build_optimization_node (&tmp, &tmp_set);
813 DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = opts;
814 }
815 }
816 #endif
817 }
818
819
820 /* Read all pointer fields in the TS_TYPE_COMMON structure of EXPR from
821 input block IB. DATA_IN contains tables and descriptors for the file
822 being read. */
823
824 static void
825 lto_input_ts_type_common_tree_pointers (class lto_input_block *ib,
826 class data_in *data_in, tree expr)
827 {
828 TYPE_SIZE (expr) = stream_read_tree_ref (ib, data_in);
829 TYPE_SIZE_UNIT (expr) = stream_read_tree_ref (ib, data_in);
830 TYPE_ATTRIBUTES (expr) = stream_read_tree_ref (ib, data_in);
831 TYPE_NAME (expr) = stream_read_tree_ref (ib, data_in);
832 /* Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO. They will be
833 reconstructed during fixup. */
834 /* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
835 during fixup. */
836 TYPE_MAIN_VARIANT (expr) = stream_read_tree_ref (ib, data_in);
837 TYPE_CONTEXT (expr) = stream_read_tree_ref (ib, data_in);
838 /* TYPE_CANONICAL gets re-computed during type merging. */
839 TYPE_CANONICAL (expr) = NULL_TREE;
840 }
841
842 /* Read all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR
843 from input block IB. DATA_IN contains tables and descriptors for the
844 file being read. */
845
846 static void
847 lto_input_ts_type_non_common_tree_pointers (class lto_input_block *ib,
848 class data_in *data_in,
849 tree expr)
850 {
851 if (TREE_CODE (expr) == ARRAY_TYPE)
852 TYPE_DOMAIN (expr) = stream_read_tree_ref (ib, data_in);
853 else if (RECORD_OR_UNION_TYPE_P (expr))
854 TYPE_FIELDS (expr) = streamer_read_chain (ib, data_in);
855 else if (TREE_CODE (expr) == FUNCTION_TYPE
856 || TREE_CODE (expr) == METHOD_TYPE)
857 TYPE_ARG_TYPES (expr) = stream_read_tree_ref (ib, data_in);
858
859 if (!POINTER_TYPE_P (expr))
860 TYPE_MIN_VALUE_RAW (expr) = stream_read_tree_ref (ib, data_in);
861 TYPE_MAX_VALUE_RAW (expr) = stream_read_tree_ref (ib, data_in);
862 }
863
864
865 /* Read all pointer fields in the TS_LIST structure of EXPR from input
866 block IB. DATA_IN contains tables and descriptors for the
867 file being read. */
868
869 static void
870 lto_input_ts_list_tree_pointers (class lto_input_block *ib,
871 class data_in *data_in, tree expr)
872 {
873 TREE_PURPOSE (expr) = stream_read_tree_ref (ib, data_in);
874 TREE_VALUE (expr) = stream_read_tree_ref (ib, data_in);
875 TREE_CHAIN (expr) = stream_read_tree_ref (ib, data_in);
876 }
877
878
879 /* Read all pointer fields in the TS_VEC structure of EXPR from input
880 block IB. DATA_IN contains tables and descriptors for the
881 file being read. */
882
883 static void
884 lto_input_ts_vec_tree_pointers (class lto_input_block *ib,
885 class data_in *data_in, tree expr)
886 {
887 int i;
888
889 /* Note that TREE_VEC_LENGTH was read by streamer_alloc_tree to
890 instantiate EXPR. */
891 for (i = 0; i < TREE_VEC_LENGTH (expr); i++)
892 TREE_VEC_ELT (expr, i) = stream_read_tree_ref (ib, data_in);
893 }
894
895
896 /* Read all pointer fields in the TS_EXP structure of EXPR from input
897 block IB. DATA_IN contains tables and descriptors for the
898 file being read. */
899
900
901 static void
902 lto_input_ts_exp_tree_pointers (class lto_input_block *ib,
903 class data_in *data_in, tree expr)
904 {
905 int i;
906 tree block;
907
908 for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
909 TREE_OPERAND (expr, i) = stream_read_tree_ref (ib, data_in);
910
911 block = stream_read_tree_ref (ib, data_in);
912
913 /* TODO: Block is stored in the locus information. It may make more sense to
914 to make it go via the location cache. */
915 if (block)
916 {
917 data_in->location_cache.apply_location_cache ();
918 TREE_SET_BLOCK (expr, block);
919 }
920 }
921
922
923 /* Read all pointer fields in the TS_BLOCK structure of EXPR from input
924 block IB. DATA_IN contains tables and descriptors for the
925 file being read. */
926
927 static void
928 lto_input_ts_block_tree_pointers (class lto_input_block *ib,
929 class data_in *data_in, tree expr)
930 {
931 BLOCK_VARS (expr) = streamer_read_chain (ib, data_in);
932
933 BLOCK_SUPERCONTEXT (expr) = stream_read_tree_ref (ib, data_in);
934 BLOCK_ABSTRACT_ORIGIN (expr) = stream_read_tree_ref (ib, data_in);
935 /* We may end up prevailing a decl with DECL_ORIGIN (t) != t here
936 which breaks the invariant that BLOCK_ABSTRACT_ORIGIN is the
937 ultimate origin. Fixup here.
938 ??? This should get fixed with moving to DIE references. */
939 if (DECL_P (BLOCK_ORIGIN (expr)))
940 BLOCK_ABSTRACT_ORIGIN (expr) = DECL_ORIGIN (BLOCK_ABSTRACT_ORIGIN (expr));
941 /* Do not stream BLOCK_NONLOCALIZED_VARS. We cannot handle debug information
942 for early inlined BLOCKs so drop it on the floor instead of ICEing in
943 dwarf2out.c. */
944
945 /* BLOCK_FRAGMENT_ORIGIN and BLOCK_FRAGMENT_CHAIN is not live at LTO
946 streaming time. */
947
948 /* We re-compute BLOCK_SUBBLOCKS of our parent here instead
949 of streaming it. For non-BLOCK BLOCK_SUPERCONTEXTs we still
950 stream the child relationship explicitly. */
951 if (BLOCK_SUPERCONTEXT (expr)
952 && TREE_CODE (BLOCK_SUPERCONTEXT (expr)) == BLOCK)
953 {
954 BLOCK_CHAIN (expr) = BLOCK_SUBBLOCKS (BLOCK_SUPERCONTEXT (expr));
955 BLOCK_SUBBLOCKS (BLOCK_SUPERCONTEXT (expr)) = expr;
956 }
957
958 /* The global block is rooted at the TU decl. Hook it here to
959 avoid the need to stream in this block during WPA time. */
960 else if (BLOCK_SUPERCONTEXT (expr)
961 && TREE_CODE (BLOCK_SUPERCONTEXT (expr)) == TRANSLATION_UNIT_DECL)
962 DECL_INITIAL (BLOCK_SUPERCONTEXT (expr)) = expr;
963
964 /* The function-level block is connected at the time we read in
965 function bodies for the same reason. */
966 }
967
968
969 /* Read all pointer fields in the TS_BINFO structure of EXPR from input
970 block IB. DATA_IN contains tables and descriptors for the
971 file being read. */
972
973 static void
974 lto_input_ts_binfo_tree_pointers (class lto_input_block *ib,
975 class data_in *data_in, tree expr)
976 {
977 tree t;
978
979 /* Note that the number of slots in EXPR was read in
980 streamer_alloc_tree when instantiating EXPR. However, the
981 vector is empty so we cannot rely on vec::length to know how many
982 elements to read. So, this list is emitted as a 0-terminated
983 list on the writer side. */
984 do
985 {
986 t = stream_read_tree_ref (ib, data_in);
987 if (t)
988 BINFO_BASE_BINFOS (expr)->quick_push (t);
989 }
990 while (t);
991
992 BINFO_OFFSET (expr) = stream_read_tree_ref (ib, data_in);
993 BINFO_VTABLE (expr) = stream_read_tree_ref (ib, data_in);
994
995 /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
996 BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used by C++ FE
997 only. */
998 }
999
1000
1001 /* Read all pointer fields in the TS_CONSTRUCTOR structure of EXPR from
1002 input block IB. DATA_IN contains tables and descriptors for the
1003 file being read. */
1004
1005 static void
1006 lto_input_ts_constructor_tree_pointers (class lto_input_block *ib,
1007 class data_in *data_in, tree expr)
1008 {
1009 unsigned i;
1010
1011 for (i = 0; i < CONSTRUCTOR_NELTS (expr); i++)
1012 {
1013 constructor_elt e;
1014 e.index = stream_read_tree_ref (ib, data_in);
1015 e.value = stream_read_tree_ref (ib, data_in);
1016 (*CONSTRUCTOR_ELTS (expr))[i] = e;
1017 }
1018 }
1019
1020
1021 /* Read all pointer fields in the TS_OMP_CLAUSE structure of EXPR from
1022 input block IB. DATA_IN contains tables and descriptors for the
1023 file being read. */
1024
1025 static void
1026 lto_input_ts_omp_clause_tree_pointers (class lto_input_block *ib,
1027 class data_in *data_in, tree expr)
1028 {
1029 int i;
1030
1031 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (expr)]; i++)
1032 OMP_CLAUSE_OPERAND (expr, i) = stream_read_tree_ref (ib, data_in);
1033 OMP_CLAUSE_CHAIN (expr) = stream_read_tree_ref (ib, data_in);
1034 }
1035
1036
1037 /* Read all pointer fields in EXPR from input block IB. DATA_IN
1038 contains tables and descriptors for the file being read. */
1039
1040 void
1041 streamer_read_tree_body (class lto_input_block *ib, class data_in *data_in,
1042 tree expr)
1043 {
1044 enum tree_code code;
1045
1046 code = TREE_CODE (expr);
1047
1048 if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
1049 lto_input_ts_common_tree_pointers (ib, data_in, expr);
1050
1051 if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
1052 lto_input_ts_vector_tree_pointers (ib, data_in, expr);
1053
1054 if (CODE_CONTAINS_STRUCT (code, TS_POLY_INT_CST))
1055 lto_input_ts_poly_tree_pointers (ib, data_in, expr);
1056
1057 if (CODE_CONTAINS_STRUCT (code, TS_COMPLEX))
1058 lto_input_ts_complex_tree_pointers (ib, data_in, expr);
1059
1060 if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL))
1061 lto_input_ts_decl_minimal_tree_pointers (ib, data_in, expr);
1062
1063 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
1064 lto_input_ts_decl_common_tree_pointers (ib, data_in, expr);
1065
1066 if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
1067 lto_input_ts_decl_non_common_tree_pointers (ib, data_in, expr);
1068
1069 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
1070 lto_input_ts_decl_with_vis_tree_pointers (ib, data_in, expr);
1071
1072 if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
1073 lto_input_ts_field_decl_tree_pointers (ib, data_in, expr);
1074
1075 if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
1076 lto_input_ts_function_decl_tree_pointers (ib, data_in, expr);
1077
1078 if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
1079 lto_input_ts_type_common_tree_pointers (ib, data_in, expr);
1080
1081 if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
1082 lto_input_ts_type_non_common_tree_pointers (ib, data_in, expr);
1083
1084 if (CODE_CONTAINS_STRUCT (code, TS_LIST))
1085 lto_input_ts_list_tree_pointers (ib, data_in, expr);
1086
1087 if (CODE_CONTAINS_STRUCT (code, TS_VEC))
1088 lto_input_ts_vec_tree_pointers (ib, data_in, expr);
1089
1090 if (CODE_CONTAINS_STRUCT (code, TS_EXP))
1091 lto_input_ts_exp_tree_pointers (ib, data_in, expr);
1092
1093 if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
1094 lto_input_ts_block_tree_pointers (ib, data_in, expr);
1095
1096 if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
1097 lto_input_ts_binfo_tree_pointers (ib, data_in, expr);
1098
1099 if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
1100 lto_input_ts_constructor_tree_pointers (ib, data_in, expr);
1101
1102 if (code == OMP_CLAUSE)
1103 lto_input_ts_omp_clause_tree_pointers (ib, data_in, expr);
1104 }
1105
1106
1107 /* Read an index IX from input block IB and return the tree node at
1108 DATA_IN->FILE_DATA->GLOBALS_INDEX[IX]. */
1109
1110 tree
1111 streamer_get_pickled_tree (class lto_input_block *ib, class data_in *data_in)
1112 {
1113 unsigned HOST_WIDE_INT ix;
1114 tree result;
1115 enum LTO_tags expected_tag;
1116
1117 ix = streamer_read_uhwi (ib);
1118 result = streamer_tree_cache_get_tree (data_in->reader_cache, ix);
1119
1120 if (streamer_debugging)
1121 {
1122 expected_tag = streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS);
1123 gcc_assert (result
1124 && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag));
1125 }
1126
1127 return result;
1128 }