comparison gcc/tree-streamer-out.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 emitting trees to a file stream. 1 /* Routines for emitting trees to 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
127 else if (TREE_CODE (expr) == SSA_NAME) 127 else if (TREE_CODE (expr) == SSA_NAME)
128 { 128 {
129 bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1); 129 bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
130 bp_pack_value (bp, 0, 8); 130 bp_pack_value (bp, 0, 8);
131 } 131 }
132 else if (TREE_CODE (expr) == CALL_EXPR)
133 {
134 bp_pack_value (bp, CALL_EXPR_BY_DESCRIPTOR (expr), 1);
135 bp_pack_value (bp, 0, 8);
136 }
132 else 137 else
133 bp_pack_value (bp, 0, 9); 138 bp_pack_value (bp, 0, 9);
134 } 139 }
135 140
136 141
205 always assume an initial value of -1 so that the 210 always assume an initial value of -1 so that the
206 label_to_block_map is recreated by gimple_set_bb. */ 211 label_to_block_map is recreated by gimple_set_bb. */
207 bp_pack_var_len_unsigned (bp, EH_LANDING_PAD_NR (expr)); 212 bp_pack_var_len_unsigned (bp, EH_LANDING_PAD_NR (expr));
208 } 213 }
209 214
210 if (TREE_CODE (expr) == FIELD_DECL) 215 else if (TREE_CODE (expr) == FIELD_DECL)
211 { 216 {
212 bp_pack_value (bp, DECL_PACKED (expr), 1); 217 bp_pack_value (bp, DECL_PACKED (expr), 1);
213 bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1); 218 bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1);
214 bp_pack_value (bp, DECL_PADDING_P (expr), 1); 219 bp_pack_value (bp, DECL_PADDING_P (expr), 1);
215 bp_pack_value (bp, expr->decl_common.off_align, 8); 220 bp_pack_value (bp, expr->decl_common.off_align, 8);
216 } 221 }
217 222
218 if (VAR_P (expr)) 223 else if (VAR_P (expr))
219 { 224 {
220 bp_pack_value (bp, DECL_HAS_DEBUG_EXPR_P (expr), 1); 225 bp_pack_value (bp, DECL_HAS_DEBUG_EXPR_P (expr), 1);
221 bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1); 226 bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1);
222 } 227 }
228
229 else if (TREE_CODE (expr) == PARM_DECL)
230 bp_pack_value (bp, DECL_HIDDEN_STRING_LENGTH (expr), 1);
223 231
224 if (TREE_CODE (expr) == RESULT_DECL 232 if (TREE_CODE (expr) == RESULT_DECL
225 || TREE_CODE (expr) == PARM_DECL 233 || TREE_CODE (expr) == PARM_DECL
226 || VAR_P (expr)) 234 || VAR_P (expr))
227 { 235 {
285 bp_pack_value (bp, DECL_UNINLINABLE (expr), 1); 293 bp_pack_value (bp, DECL_UNINLINABLE (expr), 1);
286 bp_pack_value (bp, DECL_POSSIBLY_INLINED (expr), 1); 294 bp_pack_value (bp, DECL_POSSIBLY_INLINED (expr), 1);
287 bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1); 295 bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1);
288 bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1); 296 bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1);
289 bp_pack_value (bp, DECL_IS_MALLOC (expr), 1); 297 bp_pack_value (bp, DECL_IS_MALLOC (expr), 1);
290 bp_pack_value (bp, DECL_IS_OPERATOR_NEW (expr), 1); 298 bp_pack_value (bp, DECL_IS_OPERATOR_NEW_P (expr), 1);
299 bp_pack_value (bp, DECL_IS_OPERATOR_DELETE_P (expr), 1);
291 bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1); 300 bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1);
292 bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1); 301 bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1);
293 bp_pack_value (bp, DECL_NO_INLINE_WARNING_P (expr), 1); 302 bp_pack_value (bp, DECL_NO_INLINE_WARNING_P (expr), 1);
294 bp_pack_value (bp, DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr), 1); 303 bp_pack_value (bp, DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr), 1);
295 bp_pack_value (bp, DECL_NO_LIMIT_STACK (expr), 1); 304 bp_pack_value (bp, DECL_NO_LIMIT_STACK (expr), 1);
296 bp_pack_value (bp, DECL_DISREGARD_INLINE_LIMITS (expr), 1); 305 bp_pack_value (bp, DECL_DISREGARD_INLINE_LIMITS (expr), 1);
297 bp_pack_value (bp, DECL_PURE_P (expr), 1); 306 bp_pack_value (bp, DECL_PURE_P (expr), 1);
298 bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1); 307 bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1);
299 if (DECL_BUILT_IN_CLASS (expr) != NOT_BUILT_IN) 308 if (DECL_BUILT_IN_CLASS (expr) != NOT_BUILT_IN)
300 bp_pack_value (bp, DECL_FUNCTION_CODE (expr), 12); 309 bp_pack_value (bp, DECL_UNCHECKED_FUNCTION_CODE (expr), 32);
301 } 310 }
302 311
303 312
304 /* Pack all the non-pointer fields of the TS_TYPE_COMMON structure 313 /* Pack all the non-pointer fields of the TS_TYPE_COMMON structure
305 of expression EXPR into bitpack BP. */ 314 of expression EXPR into bitpack BP. */
309 { 318 {
310 /* for VECTOR_TYPE, TYPE_MODE reevaluates the mode using target_flags 319 /* for VECTOR_TYPE, TYPE_MODE reevaluates the mode using target_flags
311 not necessary valid in a global context. 320 not necessary valid in a global context.
312 Use the raw value previously set by layout_type. */ 321 Use the raw value previously set by layout_type. */
313 bp_pack_machine_mode (bp, TYPE_MODE_RAW (expr)); 322 bp_pack_machine_mode (bp, TYPE_MODE_RAW (expr));
314 bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1);
315 /* TYPE_NO_FORCE_BLK is private to stor-layout and need 323 /* TYPE_NO_FORCE_BLK is private to stor-layout and need
316 no streaming. */ 324 no streaming. */
317 bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1);
318 bp_pack_value (bp, TYPE_PACKED (expr), 1); 325 bp_pack_value (bp, TYPE_PACKED (expr), 1);
319 bp_pack_value (bp, TYPE_RESTRICT (expr), 1); 326 bp_pack_value (bp, TYPE_RESTRICT (expr), 1);
320 bp_pack_value (bp, TYPE_USER_ALIGN (expr), 1); 327 bp_pack_value (bp, TYPE_USER_ALIGN (expr), 1);
321 bp_pack_value (bp, TYPE_READONLY (expr), 1); 328 bp_pack_value (bp, TYPE_READONLY (expr), 1);
329 unsigned vla_p;
330 if (in_lto_p)
331 vla_p = TYPE_LANG_FLAG_0 (TYPE_MAIN_VARIANT (expr));
332 else
333 vla_p = variably_modified_type_p (expr, NULL_TREE);
334 bp_pack_value (bp, vla_p, 1);
322 /* We used to stream TYPE_ALIAS_SET == 0 information to let frontends mark 335 /* We used to stream TYPE_ALIAS_SET == 0 information to let frontends mark
323 types that are opaque for TBAA. This however did not work as intended, 336 types that are opaque for TBAA. This however did not work as intended,
324 because TYPE_ALIAS_SET == 0 was regularly lost in type merging. */ 337 because TYPE_ALIAS_SET == 0 was regularly lost in type merging. */
325 if (RECORD_OR_UNION_TYPE_P (expr)) 338 if (RECORD_OR_UNION_TYPE_P (expr))
326 { 339 {
327 bp_pack_value (bp, TYPE_TRANSPARENT_AGGR (expr), 1); 340 bp_pack_value (bp, TYPE_TRANSPARENT_AGGR (expr), 1);
328 bp_pack_value (bp, TYPE_FINAL_P (expr), 1); 341 bp_pack_value (bp, TYPE_FINAL_P (expr), 1);
342 bp_pack_value (bp, TYPE_CXX_ODR_P (expr), 1);
329 } 343 }
330 else if (TREE_CODE (expr) == ARRAY_TYPE) 344 else if (TREE_CODE (expr) == ARRAY_TYPE)
331 bp_pack_value (bp, TYPE_NONALIASED_COMPONENT (expr), 1); 345 bp_pack_value (bp, TYPE_NONALIASED_COMPONENT (expr), 1);
346 if (TREE_CODE (expr) == ARRAY_TYPE || TREE_CODE (expr) == INTEGER_TYPE)
347 bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1);
332 if (AGGREGATE_TYPE_P (expr)) 348 if (AGGREGATE_TYPE_P (expr))
333 bp_pack_value (bp, TYPE_TYPELESS_STORAGE (expr), 1); 349 bp_pack_value (bp, TYPE_TYPELESS_STORAGE (expr), 1);
334 bp_pack_value (bp, TYPE_EMPTY_P (expr), 1); 350 bp_pack_value (bp, TYPE_EMPTY_P (expr), 1);
335 bp_pack_var_len_unsigned (bp, TYPE_PRECISION (expr)); 351 bp_pack_var_len_unsigned (bp, TYPE_PRECISION (expr));
336 bp_pack_var_len_unsigned (bp, TYPE_ALIGN (expr)); 352 bp_pack_var_len_unsigned (bp, TYPE_ALIGN (expr));
394 case OMP_CLAUSE_PROC_BIND: 410 case OMP_CLAUSE_PROC_BIND:
395 bp_pack_enum (bp, omp_clause_proc_bind_kind, OMP_CLAUSE_PROC_BIND_LAST, 411 bp_pack_enum (bp, omp_clause_proc_bind_kind, OMP_CLAUSE_PROC_BIND_LAST,
396 OMP_CLAUSE_PROC_BIND_KIND (expr)); 412 OMP_CLAUSE_PROC_BIND_KIND (expr));
397 break; 413 break;
398 case OMP_CLAUSE_REDUCTION: 414 case OMP_CLAUSE_REDUCTION:
415 case OMP_CLAUSE_TASK_REDUCTION:
416 case OMP_CLAUSE_IN_REDUCTION:
399 bp_pack_enum (bp, tree_code, MAX_TREE_CODES, 417 bp_pack_enum (bp, tree_code, MAX_TREE_CODES,
400 OMP_CLAUSE_REDUCTION_CODE (expr)); 418 OMP_CLAUSE_REDUCTION_CODE (expr));
401 break; 419 break;
402 default: 420 default:
403 break; 421 break;
454 { 472 {
455 bp_pack_value (&bp, MR_DEPENDENCE_CLIQUE (expr), sizeof (short) * 8); 473 bp_pack_value (&bp, MR_DEPENDENCE_CLIQUE (expr), sizeof (short) * 8);
456 if (MR_DEPENDENCE_CLIQUE (expr) != 0) 474 if (MR_DEPENDENCE_CLIQUE (expr) != 0)
457 bp_pack_value (&bp, MR_DEPENDENCE_BASE (expr), sizeof (short) * 8); 475 bp_pack_value (&bp, MR_DEPENDENCE_BASE (expr), sizeof (short) * 8);
458 } 476 }
477 else if (code == CALL_EXPR)
478 bp_pack_enum (&bp, internal_fn, IFN_LAST, CALL_EXPR_IFN (expr));
459 } 479 }
460 480
461 if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) 481 if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
462 pack_ts_block_value_fields (ob, &bp, expr); 482 pack_ts_block_value_fields (ob, &bp, expr);
463 483
566 bool ref_p) 586 bool ref_p)
567 { 587 {
568 /* Drop names that were created for anonymous entities. */ 588 /* Drop names that were created for anonymous entities. */
569 if (DECL_NAME (expr) 589 if (DECL_NAME (expr)
570 && TREE_CODE (DECL_NAME (expr)) == IDENTIFIER_NODE 590 && TREE_CODE (DECL_NAME (expr)) == IDENTIFIER_NODE
571 && anon_aggrname_p (DECL_NAME (expr))) 591 && IDENTIFIER_ANON_P (DECL_NAME (expr)))
572 stream_write_tree (ob, NULL_TREE, ref_p); 592 stream_write_tree (ob, NULL_TREE, ref_p);
573 else 593 else
574 stream_write_tree (ob, DECL_NAME (expr), ref_p); 594 stream_write_tree (ob, DECL_NAME (expr), ref_p);
575 if (TREE_CODE (expr) != TRANSLATION_UNIT_DECL 595 if (TREE_CODE (expr) != TRANSLATION_UNIT_DECL
576 && ! DECL_CONTEXT (expr)) 596 && ! DECL_CONTEXT (expr))
593 613
594 /* Note, DECL_INITIAL is not handled here. Since DECL_INITIAL needs 614 /* Note, DECL_INITIAL is not handled here. Since DECL_INITIAL needs
595 special handling in LTO, it must be handled by streamer hooks. */ 615 special handling in LTO, it must be handled by streamer hooks. */
596 616
597 stream_write_tree (ob, DECL_ATTRIBUTES (expr), ref_p); 617 stream_write_tree (ob, DECL_ATTRIBUTES (expr), ref_p);
598 stream_write_tree (ob, DECL_ABSTRACT_ORIGIN (expr), ref_p); 618
619 /* On non-early-LTO enabled targets we claim we compiled with -g0
620 but dwarf2out still did its set_decl_origin_self game fooling
621 itself late. Und that here since we won't have access to the
622 early generated abstract DIEs. */
623 tree ao = DECL_ABSTRACT_ORIGIN (expr);
624 if (debug_info_level == DINFO_LEVEL_NONE
625 && ao == expr)
626 ao = NULL_TREE;
627 stream_write_tree (ob, ao, ref_p);
599 628
600 if ((VAR_P (expr) || TREE_CODE (expr) == PARM_DECL) 629 if ((VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
601 && DECL_HAS_VALUE_EXPR_P (expr)) 630 && DECL_HAS_VALUE_EXPR_P (expr))
602 stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p); 631 stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p);
603 632
684 stream_write_tree (ob, TYPE_MAIN_VARIANT (expr), ref_p); 713 stream_write_tree (ob, TYPE_MAIN_VARIANT (expr), ref_p);
685 stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p); 714 stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p);
686 /* TYPE_CANONICAL is re-computed during type merging, so no need 715 /* TYPE_CANONICAL is re-computed during type merging, so no need
687 to stream it here. */ 716 to stream it here. */
688 /* Do not stream TYPE_STUB_DECL; it is not needed by LTO but currently 717 /* Do not stream TYPE_STUB_DECL; it is not needed by LTO but currently
689 it can not be freed by free_lang_data without triggering ICEs in 718 it cannot be freed by free_lang_data without triggering ICEs in
690 langhooks. */ 719 langhooks. */
691 } 720 }
692 721
693 /* Write all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR 722 /* Write all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR
694 to output block OB. If REF_P is true, write a reference to EXPR's 723 to output block OB. If REF_P is true, write a reference to EXPR's
835 bool ref_p) 864 bool ref_p)
836 { 865 {
837 int i; 866 int i;
838 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (expr)]; i++) 867 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (expr)]; i++)
839 stream_write_tree (ob, OMP_CLAUSE_OPERAND (expr, i), ref_p); 868 stream_write_tree (ob, OMP_CLAUSE_OPERAND (expr, i), ref_p);
840 if (OMP_CLAUSE_CODE (expr) == OMP_CLAUSE_REDUCTION) 869 switch (OMP_CLAUSE_CODE (expr))
841 { 870 {
871 case OMP_CLAUSE_REDUCTION:
872 case OMP_CLAUSE_TASK_REDUCTION:
873 case OMP_CLAUSE_IN_REDUCTION:
842 /* We don't stream these right now, handle it if streaming 874 /* We don't stream these right now, handle it if streaming
843 of them is needed. */ 875 of them is needed. */
844 gcc_assert (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (expr) == NULL); 876 gcc_assert (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (expr) == NULL);
845 gcc_assert (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (expr) == NULL); 877 gcc_assert (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (expr) == NULL);
878 break;
879 default:
880 break;
846 } 881 }
847 stream_write_tree (ob, OMP_CLAUSE_CHAIN (expr), ref_p); 882 stream_write_tree (ob, OMP_CLAUSE_CHAIN (expr), ref_p);
848 } 883 }
849 884
850 885