comparison gcc/tree-streamer-in.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Routines for reading trees from a file stream. 1 /* Routines for reading trees from a file stream.
2 2
3 Copyright (C) 2011-2018 Free Software Foundation, Inc. 3 Copyright (C) 2011-2020 Free Software Foundation, Inc.
4 Contributed by Diego Novillo <dnovillo@google.com> 4 Contributed by Diego Novillo <dnovillo@google.com>
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
39 39
40 /* Read a STRING_CST from the string table in DATA_IN using input 40 /* Read a STRING_CST from the string table in DATA_IN using input
41 block IB. */ 41 block IB. */
42 42
43 tree 43 tree
44 streamer_read_string_cst (struct data_in *data_in, struct lto_input_block *ib) 44 streamer_read_string_cst (class data_in *data_in, class lto_input_block *ib)
45 { 45 {
46 unsigned int len; 46 unsigned int len;
47 const char * ptr; 47 const char * ptr;
48 48
49 ptr = streamer_read_indexed_string (data_in, ib, &len); 49 ptr = streamer_read_indexed_string (data_in, ib, &len);
55 55
56 /* Read an IDENTIFIER from the string table in DATA_IN using input 56 /* Read an IDENTIFIER from the string table in DATA_IN using input
57 block IB. */ 57 block IB. */
58 58
59 static tree 59 static tree
60 input_identifier (struct data_in *data_in, struct lto_input_block *ib) 60 input_identifier (class data_in *data_in, class lto_input_block *ib)
61 { 61 {
62 unsigned int len; 62 unsigned int len;
63 const char *ptr; 63 const char *ptr;
64 64
65 ptr = streamer_read_indexed_string (data_in, ib, &len); 65 ptr = streamer_read_indexed_string (data_in, ib, &len);
71 71
72 /* Read a chain of tree nodes from input block IB. DATA_IN contains 72 /* Read a chain of tree nodes from input block IB. DATA_IN contains
73 tables and descriptors for the file being read. */ 73 tables and descriptors for the file being read. */
74 74
75 tree 75 tree
76 streamer_read_chain (struct lto_input_block *ib, struct data_in *data_in) 76 streamer_read_chain (class lto_input_block *ib, class data_in *data_in)
77 { 77 {
78 tree first, prev, curr; 78 tree first, prev, curr;
79 79
80 /* The chain is written as NULL terminated list of trees. */ 80 /* The chain is written as NULL terminated list of trees. */
81 first = prev = NULL_TREE; 81 first = prev = NULL_TREE;
156 else if (TREE_CODE (expr) == SSA_NAME) 156 else if (TREE_CODE (expr) == SSA_NAME)
157 { 157 {
158 SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1); 158 SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
159 bp_unpack_value (bp, 8); 159 bp_unpack_value (bp, 8);
160 } 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 }
161 else 166 else
162 bp_unpack_value (bp, 9); 167 bp_unpack_value (bp, 9);
163 } 168 }
164 169
165 170
244 /* Always assume an initial value of -1 for LABEL_DECL_UID to 249 /* Always assume an initial value of -1 for LABEL_DECL_UID to
245 force gimple_set_bb to recreate label_to_block_map. */ 250 force gimple_set_bb to recreate label_to_block_map. */
246 LABEL_DECL_UID (expr) = -1; 251 LABEL_DECL_UID (expr) = -1;
247 } 252 }
248 253
249 if (TREE_CODE (expr) == FIELD_DECL) 254 else if (TREE_CODE (expr) == FIELD_DECL)
250 { 255 {
251 DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); 256 DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
252 DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1); 257 DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
253 DECL_PADDING_P (expr) = (unsigned) bp_unpack_value (bp, 1); 258 DECL_PADDING_P (expr) = (unsigned) bp_unpack_value (bp, 1);
254 expr->decl_common.off_align = bp_unpack_value (bp, 8); 259 expr->decl_common.off_align = bp_unpack_value (bp, 8);
255 } 260 }
256 261
257 if (VAR_P (expr)) 262 else if (VAR_P (expr))
258 { 263 {
259 DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1); 264 DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
260 DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1); 265 DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);
261 } 266 }
267
268 else if (TREE_CODE (expr) == PARM_DECL)
269 DECL_HIDDEN_STRING_LENGTH (expr) = (unsigned) bp_unpack_value (bp, 1);
262 270
263 if (TREE_CODE (expr) == RESULT_DECL 271 if (TREE_CODE (expr) == RESULT_DECL
264 || TREE_CODE (expr) == PARM_DECL 272 || TREE_CODE (expr) == PARM_DECL
265 || VAR_P (expr)) 273 || VAR_P (expr))
266 { 274 {
314 of expression EXPR from bitpack BP. */ 322 of expression EXPR from bitpack BP. */
315 323
316 static void 324 static void
317 unpack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr) 325 unpack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
318 { 326 {
319 DECL_BUILT_IN_CLASS (expr) = bp_unpack_enum (bp, built_in_class, 327 built_in_class cl = bp_unpack_enum (bp, built_in_class, BUILT_IN_LAST);
320 BUILT_IN_LAST);
321 DECL_STATIC_CONSTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1); 328 DECL_STATIC_CONSTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
322 DECL_STATIC_DESTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1); 329 DECL_STATIC_DESTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
323 DECL_UNINLINABLE (expr) = (unsigned) bp_unpack_value (bp, 1); 330 DECL_UNINLINABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
324 DECL_POSSIBLY_INLINED (expr) = (unsigned) bp_unpack_value (bp, 1); 331 DECL_POSSIBLY_INLINED (expr) = (unsigned) bp_unpack_value (bp, 1);
325 DECL_IS_NOVOPS (expr) = (unsigned) bp_unpack_value (bp, 1); 332 DECL_IS_NOVOPS (expr) = (unsigned) bp_unpack_value (bp, 1);
326 DECL_IS_RETURNS_TWICE (expr) = (unsigned) bp_unpack_value (bp, 1); 333 DECL_IS_RETURNS_TWICE (expr) = (unsigned) bp_unpack_value (bp, 1);
327 DECL_IS_MALLOC (expr) = (unsigned) bp_unpack_value (bp, 1); 334 DECL_IS_MALLOC (expr) = (unsigned) bp_unpack_value (bp, 1);
328 DECL_IS_OPERATOR_NEW (expr) = (unsigned) bp_unpack_value (bp, 1); 335 DECL_SET_IS_OPERATOR_NEW (expr, (unsigned) bp_unpack_value (bp, 1));
336 DECL_SET_IS_OPERATOR_DELETE (expr, (unsigned) bp_unpack_value (bp, 1));
329 DECL_DECLARED_INLINE_P (expr) = (unsigned) bp_unpack_value (bp, 1); 337 DECL_DECLARED_INLINE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
330 DECL_STATIC_CHAIN (expr) = (unsigned) bp_unpack_value (bp, 1); 338 DECL_STATIC_CHAIN (expr) = (unsigned) bp_unpack_value (bp, 1);
331 DECL_NO_INLINE_WARNING_P (expr) = (unsigned) bp_unpack_value (bp, 1); 339 DECL_NO_INLINE_WARNING_P (expr) = (unsigned) bp_unpack_value (bp, 1);
332 DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr) 340 DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr)
333 = (unsigned) bp_unpack_value (bp, 1); 341 = (unsigned) bp_unpack_value (bp, 1);
334 DECL_NO_LIMIT_STACK (expr) = (unsigned) bp_unpack_value (bp, 1); 342 DECL_NO_LIMIT_STACK (expr) = (unsigned) bp_unpack_value (bp, 1);
335 DECL_DISREGARD_INLINE_LIMITS (expr) = (unsigned) bp_unpack_value (bp, 1); 343 DECL_DISREGARD_INLINE_LIMITS (expr) = (unsigned) bp_unpack_value (bp, 1);
336 DECL_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1); 344 DECL_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
337 DECL_LOOPING_CONST_OR_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1); 345 DECL_LOOPING_CONST_OR_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
338 if (DECL_BUILT_IN_CLASS (expr) != NOT_BUILT_IN) 346 unsigned int fcode = 0;
339 { 347 if (cl != NOT_BUILT_IN)
340 DECL_FUNCTION_CODE (expr) = (enum built_in_function) bp_unpack_value (bp, 348 {
341 12); 349 fcode = bp_unpack_value (bp, 32);
342 if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_NORMAL 350 if (cl == BUILT_IN_NORMAL && fcode >= END_BUILTINS)
343 && DECL_FUNCTION_CODE (expr) >= END_BUILTINS)
344 fatal_error (input_location, 351 fatal_error (input_location,
345 "machine independent builtin code out of range"); 352 "machine independent builtin code out of range");
346 else if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_MD) 353 else if (cl == BUILT_IN_MD)
347 { 354 {
348 tree result = targetm.builtin_decl (DECL_FUNCTION_CODE (expr), true); 355 tree result = targetm.builtin_decl (fcode, true);
349 if (!result || result == error_mark_node) 356 if (!result || result == error_mark_node)
350 fatal_error (input_location, 357 fatal_error (input_location,
351 "target specific builtin not available"); 358 "target specific builtin not available");
352 } 359 }
353 } 360 }
361 set_decl_built_in_function (expr, cl, fcode);
354 } 362 }
355 363
356 364
357 /* Unpack all the non-pointer fields of the TS_TYPE_COMMON structure 365 /* Unpack all the non-pointer fields of the TS_TYPE_COMMON structure
358 of expression EXPR from bitpack BP. */ 366 of expression EXPR from bitpack BP. */
362 { 370 {
363 machine_mode mode; 371 machine_mode mode;
364 372
365 mode = bp_unpack_machine_mode (bp); 373 mode = bp_unpack_machine_mode (bp);
366 SET_TYPE_MODE (expr, mode); 374 SET_TYPE_MODE (expr, mode);
367 TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1);
368 /* TYPE_NO_FORCE_BLK is private to stor-layout and need 375 /* TYPE_NO_FORCE_BLK is private to stor-layout and need
369 no streaming. */ 376 no streaming. */
370 TYPE_NEEDS_CONSTRUCTING (expr) = (unsigned) bp_unpack_value (bp, 1);
371 TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); 377 TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
372 TYPE_RESTRICT (expr) = (unsigned) bp_unpack_value (bp, 1); 378 TYPE_RESTRICT (expr) = (unsigned) bp_unpack_value (bp, 1);
373 TYPE_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1); 379 TYPE_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);
374 TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1); 380 TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
381 TYPE_LANG_FLAG_0 (expr) = (unsigned) bp_unpack_value (bp, 1);
375 if (RECORD_OR_UNION_TYPE_P (expr)) 382 if (RECORD_OR_UNION_TYPE_P (expr))
376 { 383 {
377 TYPE_TRANSPARENT_AGGR (expr) = (unsigned) bp_unpack_value (bp, 1); 384 TYPE_TRANSPARENT_AGGR (expr) = (unsigned) bp_unpack_value (bp, 1);
378 TYPE_FINAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); 385 TYPE_FINAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);
386 TYPE_CXX_ODR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
379 } 387 }
380 else if (TREE_CODE (expr) == ARRAY_TYPE) 388 else if (TREE_CODE (expr) == ARRAY_TYPE)
381 TYPE_NONALIASED_COMPONENT (expr) = (unsigned) bp_unpack_value (bp, 1); 389 TYPE_NONALIASED_COMPONENT (expr) = (unsigned) bp_unpack_value (bp, 1);
390 if (TREE_CODE (expr) == ARRAY_TYPE || TREE_CODE (expr) == INTEGER_TYPE)
391 TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1);
382 if (AGGREGATE_TYPE_P (expr)) 392 if (AGGREGATE_TYPE_P (expr))
383 TYPE_TYPELESS_STORAGE (expr) = (unsigned) bp_unpack_value (bp, 1); 393 TYPE_TYPELESS_STORAGE (expr) = (unsigned) bp_unpack_value (bp, 1);
384 TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1); 394 TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1);
385 TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp); 395 TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp);
386 SET_TYPE_ALIGN (expr, bp_unpack_var_len_unsigned (bp)); 396 SET_TYPE_ALIGN (expr, bp_unpack_var_len_unsigned (bp));
393 403
394 /* Unpack all the non-pointer fields of the TS_BLOCK structure 404 /* Unpack all the non-pointer fields of the TS_BLOCK structure
395 of expression EXPR from bitpack BP. */ 405 of expression EXPR from bitpack BP. */
396 406
397 static void 407 static void
398 unpack_ts_block_value_fields (struct data_in *data_in, 408 unpack_ts_block_value_fields (class data_in *data_in,
399 struct bitpack_d *bp, tree expr) 409 struct bitpack_d *bp, tree expr)
400 { 410 {
401 /* BLOCK_NUMBER is recomputed. */ 411 /* BLOCK_NUMBER is recomputed. */
402 stream_input_location (&BLOCK_SOURCE_LOCATION (expr), bp, data_in); 412 stream_input_location (&BLOCK_SOURCE_LOCATION (expr), bp, data_in);
403 } 413 }
404 414
405 /* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL 415 /* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
406 structure of expression EXPR from bitpack BP. */ 416 structure of expression EXPR from bitpack BP. */
407 417
408 static void 418 static void
409 unpack_ts_translation_unit_decl_value_fields (struct data_in *data_in, 419 unpack_ts_translation_unit_decl_value_fields (class data_in *data_in,
410 struct bitpack_d *bp, tree expr) 420 struct bitpack_d *bp, tree expr)
411 { 421 {
412 TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (bp_unpack_string (data_in, bp)); 422 TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (bp_unpack_string (data_in, bp));
413 vec_safe_push (all_translation_units, expr); 423 vec_safe_push (all_translation_units, expr);
414 } 424 }
416 426
417 /* Unpack all the non-pointer fields of the TS_OMP_CLAUSE 427 /* Unpack all the non-pointer fields of the TS_OMP_CLAUSE
418 structure of expression EXPR from bitpack BP. */ 428 structure of expression EXPR from bitpack BP. */
419 429
420 static void 430 static void
421 unpack_ts_omp_clause_value_fields (struct data_in *data_in, 431 unpack_ts_omp_clause_value_fields (class data_in *data_in,
422 struct bitpack_d *bp, tree expr) 432 struct bitpack_d *bp, tree expr)
423 { 433 {
424 stream_input_location (&OMP_CLAUSE_LOCATION (expr), bp, data_in); 434 stream_input_location (&OMP_CLAUSE_LOCATION (expr), bp, data_in);
425 switch (OMP_CLAUSE_CODE (expr)) 435 switch (OMP_CLAUSE_CODE (expr))
426 { 436 {
446 OMP_CLAUSE_PROC_BIND_KIND (expr) 456 OMP_CLAUSE_PROC_BIND_KIND (expr)
447 = bp_unpack_enum (bp, omp_clause_proc_bind_kind, 457 = bp_unpack_enum (bp, omp_clause_proc_bind_kind,
448 OMP_CLAUSE_PROC_BIND_LAST); 458 OMP_CLAUSE_PROC_BIND_LAST);
449 break; 459 break;
450 case OMP_CLAUSE_REDUCTION: 460 case OMP_CLAUSE_REDUCTION:
461 case OMP_CLAUSE_TASK_REDUCTION:
462 case OMP_CLAUSE_IN_REDUCTION:
451 OMP_CLAUSE_REDUCTION_CODE (expr) 463 OMP_CLAUSE_REDUCTION_CODE (expr)
452 = bp_unpack_enum (bp, tree_code, MAX_TREE_CODES); 464 = bp_unpack_enum (bp, tree_code, MAX_TREE_CODES);
453 break; 465 break;
454 default: 466 default:
455 break; 467 break;
460 /* Read all the language-independent bitfield values for EXPR from IB. 472 /* Read all the language-independent bitfield values for EXPR from IB.
461 Return the partially unpacked bitpack so the caller can unpack any other 473 Return the partially unpacked bitpack so the caller can unpack any other
462 bitfield values that the writer may have written. */ 474 bitfield values that the writer may have written. */
463 475
464 void 476 void
465 streamer_read_tree_bitfields (struct lto_input_block *ib, 477 streamer_read_tree_bitfields (class lto_input_block *ib,
466 struct data_in *data_in, tree expr) 478 class data_in *data_in, tree expr)
467 { 479 {
468 enum tree_code code; 480 enum tree_code code;
469 struct bitpack_d bp; 481 struct bitpack_d bp;
470 482
471 /* Read the bitpack of non-pointer values from IB. */ 483 /* Read the bitpack of non-pointer values from IB. */
518 = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8); 530 = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8);
519 if (MR_DEPENDENCE_CLIQUE (expr) != 0) 531 if (MR_DEPENDENCE_CLIQUE (expr) != 0)
520 MR_DEPENDENCE_BASE (expr) 532 MR_DEPENDENCE_BASE (expr)
521 = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8); 533 = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8);
522 } 534 }
535 else if (code == CALL_EXPR)
536 CALL_EXPR_IFN (expr) = bp_unpack_enum (&bp, internal_fn, IFN_LAST);
523 } 537 }
524 538
525 if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) 539 if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
526 unpack_ts_block_value_fields (data_in, &bp, expr); 540 unpack_ts_block_value_fields (data_in, &bp, expr);
527 541
555 /* Materialize a new tree from input block IB using descriptors in 569 /* Materialize a new tree from input block IB using descriptors in
556 DATA_IN. The code for the new tree should match TAG. Store in 570 DATA_IN. The code for the new tree should match TAG. Store in
557 *IX_P the index into the reader cache where the new tree is stored. */ 571 *IX_P the index into the reader cache where the new tree is stored. */
558 572
559 tree 573 tree
560 streamer_alloc_tree (struct lto_input_block *ib, struct data_in *data_in, 574 streamer_alloc_tree (class lto_input_block *ib, class data_in *data_in,
561 enum LTO_tags tag) 575 enum LTO_tags tag)
562 { 576 {
563 enum tree_code code; 577 enum tree_code code;
564 tree result; 578 tree result;
565 579
625 block IB. DATA_IN contains tables and descriptors for the 639 block IB. DATA_IN contains tables and descriptors for the
626 file being read. */ 640 file being read. */
627 641
628 642
629 static void 643 static void
630 lto_input_ts_common_tree_pointers (struct lto_input_block *ib, 644 lto_input_ts_common_tree_pointers (class lto_input_block *ib,
631 struct data_in *data_in, tree expr) 645 class data_in *data_in, tree expr)
632 { 646 {
633 if (TREE_CODE (expr) != IDENTIFIER_NODE) 647 if (TREE_CODE (expr) != IDENTIFIER_NODE)
634 TREE_TYPE (expr) = stream_read_tree (ib, data_in); 648 TREE_TYPE (expr) = stream_read_tree (ib, data_in);
635 } 649 }
636 650
638 /* Read all pointer fields in the TS_VECTOR structure of EXPR from input 652 /* Read all pointer fields in the TS_VECTOR structure of EXPR from input
639 block IB. DATA_IN contains tables and descriptors for the 653 block IB. DATA_IN contains tables and descriptors for the
640 file being read. */ 654 file being read. */
641 655
642 static void 656 static void
643 lto_input_ts_vector_tree_pointers (struct lto_input_block *ib, 657 lto_input_ts_vector_tree_pointers (class lto_input_block *ib,
644 struct data_in *data_in, tree expr) 658 class data_in *data_in, tree expr)
645 { 659 {
646 unsigned int count = vector_cst_encoded_nelts (expr); 660 unsigned int count = vector_cst_encoded_nelts (expr);
647 for (unsigned int i = 0; i < count; ++i) 661 for (unsigned int i = 0; i < count; ++i)
648 VECTOR_CST_ENCODED_ELT (expr, i) = stream_read_tree (ib, data_in); 662 VECTOR_CST_ENCODED_ELT (expr, i) = stream_read_tree (ib, data_in);
649 } 663 }
652 /* Read all pointer fields in the TS_POLY_INT_CST structure of EXPR from 666 /* Read all pointer fields in the TS_POLY_INT_CST structure of EXPR from
653 input block IB. DATA_IN contains tables and descriptors for the 667 input block IB. DATA_IN contains tables and descriptors for the
654 file being read. */ 668 file being read. */
655 669
656 static void 670 static void
657 lto_input_ts_poly_tree_pointers (struct lto_input_block *ib, 671 lto_input_ts_poly_tree_pointers (class lto_input_block *ib,
658 struct data_in *data_in, tree expr) 672 class data_in *data_in, tree expr)
659 { 673 {
660 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i) 674 for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
661 POLY_INT_CST_COEFF (expr, i) = stream_read_tree (ib, data_in); 675 POLY_INT_CST_COEFF (expr, i) = stream_read_tree (ib, data_in);
662 } 676 }
663 677
665 /* Read all pointer fields in the TS_COMPLEX structure of EXPR from input 679 /* Read all pointer fields in the TS_COMPLEX structure of EXPR from input
666 block IB. DATA_IN contains tables and descriptors for the 680 block IB. DATA_IN contains tables and descriptors for the
667 file being read. */ 681 file being read. */
668 682
669 static void 683 static void
670 lto_input_ts_complex_tree_pointers (struct lto_input_block *ib, 684 lto_input_ts_complex_tree_pointers (class lto_input_block *ib,
671 struct data_in *data_in, tree expr) 685 class data_in *data_in, tree expr)
672 { 686 {
673 TREE_REALPART (expr) = stream_read_tree (ib, data_in); 687 TREE_REALPART (expr) = stream_read_tree (ib, data_in);
674 TREE_IMAGPART (expr) = stream_read_tree (ib, data_in); 688 TREE_IMAGPART (expr) = stream_read_tree (ib, data_in);
675 } 689 }
676 690
678 /* Read all pointer fields in the TS_DECL_MINIMAL structure of EXPR 692 /* Read all pointer fields in the TS_DECL_MINIMAL structure of EXPR
679 from input block IB. DATA_IN contains tables and descriptors for the 693 from input block IB. DATA_IN contains tables and descriptors for the
680 file being read. */ 694 file being read. */
681 695
682 static void 696 static void
683 lto_input_ts_decl_minimal_tree_pointers (struct lto_input_block *ib, 697 lto_input_ts_decl_minimal_tree_pointers (class lto_input_block *ib,
684 struct data_in *data_in, tree expr) 698 class data_in *data_in, tree expr)
685 { 699 {
686 DECL_NAME (expr) = stream_read_tree (ib, data_in); 700 DECL_NAME (expr) = stream_read_tree (ib, data_in);
687 DECL_CONTEXT (expr) = stream_read_tree (ib, data_in); 701 DECL_CONTEXT (expr) = stream_read_tree (ib, data_in);
688 } 702 }
689 703
691 /* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from 705 /* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from
692 input block IB. DATA_IN contains tables and descriptors for the 706 input block IB. DATA_IN contains tables and descriptors for the
693 file being read. */ 707 file being read. */
694 708
695 static void 709 static void
696 lto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib, 710 lto_input_ts_decl_common_tree_pointers (class lto_input_block *ib,
697 struct data_in *data_in, tree expr) 711 class data_in *data_in, tree expr)
698 { 712 {
699 DECL_SIZE (expr) = stream_read_tree (ib, data_in); 713 DECL_SIZE (expr) = stream_read_tree (ib, data_in);
700 DECL_SIZE_UNIT (expr) = stream_read_tree (ib, data_in); 714 DECL_SIZE_UNIT (expr) = stream_read_tree (ib, data_in);
701 DECL_ATTRIBUTES (expr) = stream_read_tree (ib, data_in); 715 DECL_ATTRIBUTES (expr) = stream_read_tree (ib, data_in);
702 DECL_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in); 716 DECL_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in);
718 /* Read all pointer fields in the TS_DECL_NON_COMMON structure of 732 /* Read all pointer fields in the TS_DECL_NON_COMMON structure of
719 EXPR from input block IB. DATA_IN contains tables and descriptors for the 733 EXPR from input block IB. DATA_IN contains tables and descriptors for the
720 file being read. */ 734 file being read. */
721 735
722 static void 736 static void
723 lto_input_ts_decl_non_common_tree_pointers (struct lto_input_block *, 737 lto_input_ts_decl_non_common_tree_pointers (class lto_input_block *,
724 struct data_in *, tree) 738 class data_in *, tree)
725 { 739 {
726 } 740 }
727 741
728 742
729 /* Read all pointer fields in the TS_DECL_WITH_VIS structure of EXPR 743 /* Read all pointer fields in the TS_DECL_WITH_VIS structure of EXPR
730 from input block IB. DATA_IN contains tables and descriptors for the 744 from input block IB. DATA_IN contains tables and descriptors for the
731 file being read. */ 745 file being read. */
732 746
733 static void 747 static void
734 lto_input_ts_decl_with_vis_tree_pointers (struct lto_input_block *ib, 748 lto_input_ts_decl_with_vis_tree_pointers (class lto_input_block *ib,
735 struct data_in *data_in, tree expr) 749 class data_in *data_in, tree expr)
736 { 750 {
737 tree id; 751 tree id;
738 752
739 id = stream_read_tree (ib, data_in); 753 id = stream_read_tree (ib, data_in);
740 if (id) 754 if (id)
748 /* Read all pointer fields in the TS_FIELD_DECL structure of EXPR from 762 /* Read all pointer fields in the TS_FIELD_DECL structure of EXPR from
749 input block IB. DATA_IN contains tables and descriptors for the 763 input block IB. DATA_IN contains tables and descriptors for the
750 file being read. */ 764 file being read. */
751 765
752 static void 766 static void
753 lto_input_ts_field_decl_tree_pointers (struct lto_input_block *ib, 767 lto_input_ts_field_decl_tree_pointers (class lto_input_block *ib,
754 struct data_in *data_in, tree expr) 768 class data_in *data_in, tree expr)
755 { 769 {
756 DECL_FIELD_OFFSET (expr) = stream_read_tree (ib, data_in); 770 DECL_FIELD_OFFSET (expr) = stream_read_tree (ib, data_in);
757 DECL_BIT_FIELD_TYPE (expr) = stream_read_tree (ib, data_in); 771 DECL_BIT_FIELD_TYPE (expr) = stream_read_tree (ib, data_in);
758 DECL_BIT_FIELD_REPRESENTATIVE (expr) = stream_read_tree (ib, data_in); 772 DECL_BIT_FIELD_REPRESENTATIVE (expr) = stream_read_tree (ib, data_in);
759 DECL_FIELD_BIT_OFFSET (expr) = stream_read_tree (ib, data_in); 773 DECL_FIELD_BIT_OFFSET (expr) = stream_read_tree (ib, data_in);
763 /* Read all pointer fields in the TS_FUNCTION_DECL structure of EXPR 777 /* Read all pointer fields in the TS_FUNCTION_DECL structure of EXPR
764 from input block IB. DATA_IN contains tables and descriptors for the 778 from input block IB. DATA_IN contains tables and descriptors for the
765 file being read. */ 779 file being read. */
766 780
767 static void 781 static void
768 lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib, 782 lto_input_ts_function_decl_tree_pointers (class lto_input_block *ib,
769 struct data_in *data_in, tree expr) 783 class data_in *data_in, tree expr)
770 { 784 {
771 /* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body. */ 785 /* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body. */
772 DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in); 786 DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in);
773 #ifndef ACCEL_COMPILER 787 #ifndef ACCEL_COMPILER
774 DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in); 788 DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);
782 struct gcc_options tmp; 796 struct gcc_options tmp;
783 init_options_struct (&tmp, NULL); 797 init_options_struct (&tmp, NULL);
784 cl_optimization_restore (&tmp, TREE_OPTIMIZATION (opts)); 798 cl_optimization_restore (&tmp, TREE_OPTIMIZATION (opts));
785 finish_options (&tmp, &global_options_set, UNKNOWN_LOCATION); 799 finish_options (&tmp, &global_options_set, UNKNOWN_LOCATION);
786 opts = build_optimization_node (&tmp); 800 opts = build_optimization_node (&tmp);
787 finalize_options_struct (&tmp);
788 DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = opts; 801 DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = opts;
789 } 802 }
790 } 803 }
791 #endif 804 #endif
792
793 /* If the file contains a function with an EH personality set,
794 then it was compiled with -fexceptions. In that case, initialize
795 the backend EH machinery. */
796 if (DECL_FUNCTION_PERSONALITY (expr))
797 lto_init_eh ();
798 } 805 }
799 806
800 807
801 /* Read all pointer fields in the TS_TYPE_COMMON structure of EXPR from 808 /* Read all pointer fields in the TS_TYPE_COMMON structure of EXPR from
802 input block IB. DATA_IN contains tables and descriptors for the file 809 input block IB. DATA_IN contains tables and descriptors for the file
803 being read. */ 810 being read. */
804 811
805 static void 812 static void
806 lto_input_ts_type_common_tree_pointers (struct lto_input_block *ib, 813 lto_input_ts_type_common_tree_pointers (class lto_input_block *ib,
807 struct data_in *data_in, tree expr) 814 class data_in *data_in, tree expr)
808 { 815 {
809 TYPE_SIZE (expr) = stream_read_tree (ib, data_in); 816 TYPE_SIZE (expr) = stream_read_tree (ib, data_in);
810 TYPE_SIZE_UNIT (expr) = stream_read_tree (ib, data_in); 817 TYPE_SIZE_UNIT (expr) = stream_read_tree (ib, data_in);
811 TYPE_ATTRIBUTES (expr) = stream_read_tree (ib, data_in); 818 TYPE_ATTRIBUTES (expr) = stream_read_tree (ib, data_in);
812 TYPE_NAME (expr) = stream_read_tree (ib, data_in); 819 TYPE_NAME (expr) = stream_read_tree (ib, data_in);
823 /* Read all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR 830 /* Read all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR
824 from input block IB. DATA_IN contains tables and descriptors for the 831 from input block IB. DATA_IN contains tables and descriptors for the
825 file being read. */ 832 file being read. */
826 833
827 static void 834 static void
828 lto_input_ts_type_non_common_tree_pointers (struct lto_input_block *ib, 835 lto_input_ts_type_non_common_tree_pointers (class lto_input_block *ib,
829 struct data_in *data_in, 836 class data_in *data_in,
830 tree expr) 837 tree expr)
831 { 838 {
832 if (TREE_CODE (expr) == ENUMERAL_TYPE) 839 if (TREE_CODE (expr) == ENUMERAL_TYPE)
833 TYPE_VALUES (expr) = stream_read_tree (ib, data_in); 840 TYPE_VALUES (expr) = stream_read_tree (ib, data_in);
834 else if (TREE_CODE (expr) == ARRAY_TYPE) 841 else if (TREE_CODE (expr) == ARRAY_TYPE)
848 /* Read all pointer fields in the TS_LIST structure of EXPR from input 855 /* Read all pointer fields in the TS_LIST structure of EXPR from input
849 block IB. DATA_IN contains tables and descriptors for the 856 block IB. DATA_IN contains tables and descriptors for the
850 file being read. */ 857 file being read. */
851 858
852 static void 859 static void
853 lto_input_ts_list_tree_pointers (struct lto_input_block *ib, 860 lto_input_ts_list_tree_pointers (class lto_input_block *ib,
854 struct data_in *data_in, tree expr) 861 class data_in *data_in, tree expr)
855 { 862 {
856 TREE_PURPOSE (expr) = stream_read_tree (ib, data_in); 863 TREE_PURPOSE (expr) = stream_read_tree (ib, data_in);
857 TREE_VALUE (expr) = stream_read_tree (ib, data_in); 864 TREE_VALUE (expr) = stream_read_tree (ib, data_in);
858 TREE_CHAIN (expr) = stream_read_tree (ib, data_in); 865 TREE_CHAIN (expr) = stream_read_tree (ib, data_in);
859 } 866 }
862 /* Read all pointer fields in the TS_VEC structure of EXPR from input 869 /* Read all pointer fields in the TS_VEC structure of EXPR from input
863 block IB. DATA_IN contains tables and descriptors for the 870 block IB. DATA_IN contains tables and descriptors for the
864 file being read. */ 871 file being read. */
865 872
866 static void 873 static void
867 lto_input_ts_vec_tree_pointers (struct lto_input_block *ib, 874 lto_input_ts_vec_tree_pointers (class lto_input_block *ib,
868 struct data_in *data_in, tree expr) 875 class data_in *data_in, tree expr)
869 { 876 {
870 int i; 877 int i;
871 878
872 /* Note that TREE_VEC_LENGTH was read by streamer_alloc_tree to 879 /* Note that TREE_VEC_LENGTH was read by streamer_alloc_tree to
873 instantiate EXPR. */ 880 instantiate EXPR. */
880 block IB. DATA_IN contains tables and descriptors for the 887 block IB. DATA_IN contains tables and descriptors for the
881 file being read. */ 888 file being read. */
882 889
883 890
884 static void 891 static void
885 lto_input_ts_exp_tree_pointers (struct lto_input_block *ib, 892 lto_input_ts_exp_tree_pointers (class lto_input_block *ib,
886 struct data_in *data_in, tree expr) 893 class data_in *data_in, tree expr)
887 { 894 {
888 int i; 895 int i;
889 tree block; 896 tree block;
890 897
891 for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++) 898 for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
906 /* Read all pointer fields in the TS_BLOCK structure of EXPR from input 913 /* Read all pointer fields in the TS_BLOCK structure of EXPR from input
907 block IB. DATA_IN contains tables and descriptors for the 914 block IB. DATA_IN contains tables and descriptors for the
908 file being read. */ 915 file being read. */
909 916
910 static void 917 static void
911 lto_input_ts_block_tree_pointers (struct lto_input_block *ib, 918 lto_input_ts_block_tree_pointers (class lto_input_block *ib,
912 struct data_in *data_in, tree expr) 919 class data_in *data_in, tree expr)
913 { 920 {
914 BLOCK_VARS (expr) = streamer_read_chain (ib, data_in); 921 BLOCK_VARS (expr) = streamer_read_chain (ib, data_in);
915 922
916 BLOCK_SUPERCONTEXT (expr) = stream_read_tree (ib, data_in); 923 BLOCK_SUPERCONTEXT (expr) = stream_read_tree (ib, data_in);
917 BLOCK_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in); 924 BLOCK_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in);
925 /* We may end up prevailing a decl with DECL_ORIGIN (t) != t here
926 which breaks the invariant that BLOCK_ABSTRACT_ORIGIN is the
927 ultimate origin. Fixup here.
928 ??? This should get fixed with moving to DIE references. */
929 if (DECL_P (BLOCK_ORIGIN (expr)))
930 BLOCK_ABSTRACT_ORIGIN (expr) = DECL_ORIGIN (BLOCK_ABSTRACT_ORIGIN (expr));
918 /* Do not stream BLOCK_NONLOCALIZED_VARS. We cannot handle debug information 931 /* Do not stream BLOCK_NONLOCALIZED_VARS. We cannot handle debug information
919 for early inlined BLOCKs so drop it on the floor instead of ICEing in 932 for early inlined BLOCKs so drop it on the floor instead of ICEing in
920 dwarf2out.c. */ 933 dwarf2out.c. */
921 934
922 /* BLOCK_FRAGMENT_ORIGIN and BLOCK_FRAGMENT_CHAIN is not live at LTO 935 /* BLOCK_FRAGMENT_ORIGIN and BLOCK_FRAGMENT_CHAIN is not live at LTO
946 /* Read all pointer fields in the TS_BINFO structure of EXPR from input 959 /* Read all pointer fields in the TS_BINFO structure of EXPR from input
947 block IB. DATA_IN contains tables and descriptors for the 960 block IB. DATA_IN contains tables and descriptors for the
948 file being read. */ 961 file being read. */
949 962
950 static void 963 static void
951 lto_input_ts_binfo_tree_pointers (struct lto_input_block *ib, 964 lto_input_ts_binfo_tree_pointers (class lto_input_block *ib,
952 struct data_in *data_in, tree expr) 965 class data_in *data_in, tree expr)
953 { 966 {
954 tree t; 967 tree t;
955 968
956 /* Note that the number of slots in EXPR was read in 969 /* Note that the number of slots in EXPR was read in
957 streamer_alloc_tree when instantiating EXPR. However, the 970 streamer_alloc_tree when instantiating EXPR. However, the
978 /* Read all pointer fields in the TS_CONSTRUCTOR structure of EXPR from 991 /* Read all pointer fields in the TS_CONSTRUCTOR structure of EXPR from
979 input block IB. DATA_IN contains tables and descriptors for the 992 input block IB. DATA_IN contains tables and descriptors for the
980 file being read. */ 993 file being read. */
981 994
982 static void 995 static void
983 lto_input_ts_constructor_tree_pointers (struct lto_input_block *ib, 996 lto_input_ts_constructor_tree_pointers (class lto_input_block *ib,
984 struct data_in *data_in, tree expr) 997 class data_in *data_in, tree expr)
985 { 998 {
986 unsigned i; 999 unsigned i;
987 1000
988 for (i = 0; i < CONSTRUCTOR_NELTS (expr); i++) 1001 for (i = 0; i < CONSTRUCTOR_NELTS (expr); i++)
989 { 1002 {
998 /* Read all pointer fields in the TS_OMP_CLAUSE structure of EXPR from 1011 /* Read all pointer fields in the TS_OMP_CLAUSE structure of EXPR from
999 input block IB. DATA_IN contains tables and descriptors for the 1012 input block IB. DATA_IN contains tables and descriptors for the
1000 file being read. */ 1013 file being read. */
1001 1014
1002 static void 1015 static void
1003 lto_input_ts_omp_clause_tree_pointers (struct lto_input_block *ib, 1016 lto_input_ts_omp_clause_tree_pointers (class lto_input_block *ib,
1004 struct data_in *data_in, tree expr) 1017 class data_in *data_in, tree expr)
1005 { 1018 {
1006 int i; 1019 int i;
1007 1020
1008 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (expr)]; i++) 1021 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (expr)]; i++)
1009 OMP_CLAUSE_OPERAND (expr, i) = stream_read_tree (ib, data_in); 1022 OMP_CLAUSE_OPERAND (expr, i) = stream_read_tree (ib, data_in);
1013 1026
1014 /* Read all pointer fields in EXPR from input block IB. DATA_IN 1027 /* Read all pointer fields in EXPR from input block IB. DATA_IN
1015 contains tables and descriptors for the file being read. */ 1028 contains tables and descriptors for the file being read. */
1016 1029
1017 void 1030 void
1018 streamer_read_tree_body (struct lto_input_block *ib, struct data_in *data_in, 1031 streamer_read_tree_body (class lto_input_block *ib, class data_in *data_in,
1019 tree expr) 1032 tree expr)
1020 { 1033 {
1021 enum tree_code code; 1034 enum tree_code code;
1022 1035
1023 code = TREE_CODE (expr); 1036 code = TREE_CODE (expr);
1083 1096
1084 /* Read an index IX from input block IB and return the tree node at 1097 /* Read an index IX from input block IB and return the tree node at
1085 DATA_IN->FILE_DATA->GLOBALS_INDEX[IX]. */ 1098 DATA_IN->FILE_DATA->GLOBALS_INDEX[IX]. */
1086 1099
1087 tree 1100 tree
1088 streamer_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in) 1101 streamer_get_pickled_tree (class lto_input_block *ib, class data_in *data_in)
1089 { 1102 {
1090 unsigned HOST_WIDE_INT ix; 1103 unsigned HOST_WIDE_INT ix;
1091 tree result; 1104 tree result;
1092 enum LTO_tags expected_tag; 1105 enum LTO_tags expected_tag;
1093 1106