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