GCC Middle and Back End API Reference
tree-streamer-out.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "diagnostic.h"
#include "tree.h"
#include "gimple.h"
#include "tree-streamer.h"
#include "data-streamer.h"
#include "streamer-hooks.h"
Include dependency graph for tree-streamer-out.c:

Functions

void streamer_write_string_cst (struct output_block *ob, struct lto_output_stream *index_stream, tree string)
static void write_identifier (struct output_block *ob, struct lto_output_stream *index_stream, tree id)
static void pack_ts_base_value_fields ()
static void pack_ts_int_cst_value_fields ()
static void pack_ts_real_cst_value_fields ()
static void pack_ts_fixed_cst_value_fields ()
static void pack_ts_decl_common_value_fields ()
static void pack_ts_decl_wrtl_value_fields ()
static void pack_ts_decl_with_vis_value_fields ()
static void pack_ts_function_decl_value_fields ()
static void pack_ts_type_common_value_fields ()
static void pack_ts_block_value_fields (struct output_block *ob, struct bitpack_d *bp, tree expr)
static void pack_ts_translation_unit_decl_value_fields (struct output_block *ob, struct bitpack_d *bp, tree expr)
static void pack_ts_target_option ()
static void pack_ts_optimization ()
void streamer_pack_tree_bitfields (struct output_block *ob, struct bitpack_d *bp, tree expr)
void streamer_write_builtin ()
void streamer_write_chain ()
static void write_ts_common_tree_pointers ()
static void write_ts_vector_tree_pointers ()
static void write_ts_complex_tree_pointers ()
static void write_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_decl_common_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_decl_non_common_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_decl_with_vis_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_field_decl_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_type_common_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_type_non_common_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
static void write_ts_list_tree_pointers ()
static void write_ts_vec_tree_pointers ()
static void write_ts_exp_tree_pointers ()
static void write_ts_block_tree_pointers ()
static void write_ts_binfo_tree_pointers ()
static void write_ts_constructor_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
void streamer_write_tree_body ()
void streamer_write_tree_header ()
void streamer_write_integer_cst ()

Function Documentation

static void pack_ts_base_value_fields ( )
static

Pack all the non-pointer fields of the TS_BASE structure of expression EXPR into bitpack BP.

TREE_PUBLIC is used on types to indicate that the type
has a TYPE_CACHED_VALUES vector.  This is not streamed out,
so we skip it here.   

We write debug info two times, do not confuse the second one. The only relevant TREE_ASM_WRITTEN use is on SSA names.

References bp_pack_value(), TREE_CONSTANT, TREE_PUBLIC, TREE_READONLY, and TREE_SIDE_EFFECTS.

static void pack_ts_block_value_fields ( struct output_block ob,
struct bitpack_d bp,
tree  expr 
)
static

Pack all the non-pointer fields of the TS_BLOCK structure of expression EXPR into bitpack BP.

BLOCK_NUMBER is recomputed.

 Stream BLOCK_SOURCE_LOCATION for the limited cases we can handle - those
 that represent inlined function scopes.
 For the rest them on the floor instead of ICEing in dwarf2out.c.   

References bp_pack_string(), and TRANSLATION_UNIT_LANGUAGE.

static void pack_ts_decl_common_value_fields ( )
static

Pack all the non-pointer fields of the TS_DECL_COMMON structure of expression EXPR into bitpack BP.

Note that we do not write LABEL_DECL_UID. The reader will always assume an initial value of -1 so that the label_to_block_map is recreated by gimple_set_bb.

static void pack_ts_decl_with_vis_value_fields ( )
static

Pack all the non-pointer fields of the TS_DECL_WITH_VIS structure of expression EXPR into bitpack BP.

DECL_IN_TEXT_SECTION is set during final asm output only.

static void pack_ts_decl_wrtl_value_fields ( )
static

Pack all the non-pointer fields of the TS_DECL_WRTL structure of expression EXPR into bitpack BP.

static void pack_ts_fixed_cst_value_fields ( )
static

Pack all the non-pointer fields of the TS_FIXED_CST structure of expression EXPR into bitpack BP.

References bp_pack_enum, bp_pack_value(), DECL_ABSTRACT, DECL_ARTIFICIAL, DECL_IGNORED_P, DECL_MODE, DECL_NONLOCAL, DECL_PRESERVE_P, DECL_USER_ALIGN, and DECL_VIRTUAL_P.

static void pack_ts_function_decl_value_fields ( )
static

Pack all the non-pointer fields of the TS_FUNCTION_DECL structure of expression EXPR into bitpack BP.

For normal/md builtins we only write the class and code, so they should never be handled here.

static void pack_ts_int_cst_value_fields ( )
static

Pack all the non-pointer fields of the TS_INTEGER_CST structure of expression EXPR into bitpack BP.

References bp_pack_value(), REAL_VALUE_TYPE, and TREE_REAL_CST.

static void pack_ts_optimization ( )
static

Pack a TS_OPTIMIZATION tree in EXPR to BP.

The cl_optimization is generated by the options awk script, so we just recreate a byte-by-byte copy here.

 Catch struct size mismatches between reader and writer.  
static void pack_ts_real_cst_value_fields ( )
static

Pack all the non-pointer fields of the TS_REAL_CST structure of expression EXPR into bitpack BP.

static void pack_ts_target_option ( )
static

Pack a TS_TARGET_OPTION tree in EXPR to BP.

The cl_target_option is target specific and generated by the options awk script, so we just recreate a byte-by-byte copy here.

 Catch struct size mismatches between reader and writer.  
static void pack_ts_translation_unit_decl_value_fields ( struct output_block ob,
struct bitpack_d bp,
tree  expr 
)
static

Pack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL structure of expression EXPR into bitpack BP.

static void pack_ts_type_common_value_fields ( )
static

Pack all the non-pointer fields of the TS_TYPE_COMMON structure of expression EXPR into bitpack BP.

Make sure to preserve the fact whether the frontend would assign alias-set zero to this type.

void streamer_pack_tree_bitfields ( struct output_block ob,
struct bitpack_d bp,
tree  expr 
)

Pack all the bitfields in EXPR into a bit pack.

Note that all these functions are highly sensitive to changes in the types and sizes of each of the fields being packed.

void streamer_write_builtin ( )

Write the code and class of builtin EXPR to output block OB. IX is the index into the streamer cache where EXPR is stored.

When the assembler name of a builtin gets a user name, the new name is always prefixed with '*' by set_builtin_user_assembler_name. So, to prevent the reader side from adding a second '*', we omit it here.

References DECL_EXTERNAL, NULL_TREE, stream_write_tree, TREE_CHAIN, and VAR_OR_FUNCTION_DECL_P.

Referenced by lto_write_tree().

void streamer_write_chain ( )

Emit the chain of tree nodes starting at T. OB is the output block to write to. REF_P is true if chain elements should be emitted as references.

     Clear TREE_CHAIN to avoid blindly recursing into the rest
     of the list.   
     We avoid outputting external vars or functions by reference
     to the global decls section as we do not want to have them
     enter decl merging.  This is, of course, only for the call
     for streaming BLOCK_VARS, but other callers are safe.   
     ???  FIXME wrt SCC streaming.  Drop these for now.   
 Write a sentinel to terminate the chain.   

References gdbhooks::IDENTIFIER_NODE, stream_write_tree, TREE_CODE, and TREE_TYPE.

Referenced by write_ts_field_decl_tree_pointers().

void streamer_write_integer_cst ( )

Emit the integer constant CST to output block OB. If REF_P is true, CST's type will be emitted as a reference.

void streamer_write_string_cst ( struct output_block ob,
struct lto_output_stream index_stream,
tree  string 
)

Routines for emitting trees to a file stream.

Copyright (C) 2011-2013 Free Software Foundation, Inc. Contributed by Diego Novillo dnovi.nosp@m.llo@.nosp@m.googl.nosp@m.e.co.nosp@m.m

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. Output the STRING constant to the string table in OB. Then put the index onto the INDEX_STREAM.

References NULL, streamer_write_string_with_length(), TREE_STRING_LENGTH, and TREE_STRING_POINTER.

void streamer_write_tree_body ( )

Write all pointer fields in EXPR to output block OB. If REF_P is true, the leaves of EXPR are emitted as references.

void streamer_write_tree_header ( )

Emit header information for tree EXPR to output block OB. The header contains everything needed to instantiate an empty skeleton for EXPR on the reading side. IX is the index into the streamer cache where EXPR is stored.

 We should not see any tree nodes not handled by the streamer.   
 The header of a tree node consists of its tag, the size of
 the node, and any other information needed to instantiate
 EXPR on the reading side (such as the number of slots in
 variable sized nodes).   
 The following will cause bootstrap miscomparisons.  Enable with care.   
 The text in strings and identifiers are completely emitted in
 the header.   
static void write_identifier ( struct output_block ob,
struct lto_output_stream index_stream,
tree  id 
)
static

Output the identifier ID to the string table in OB. Then put the index onto the INDEX_STREAM.

References IDENTIFIER_LENGTH, IDENTIFIER_POINTER, and streamer_write_string_with_length().

static void write_ts_binfo_tree_pointers ( )
static

Write all pointer fields in the TS_BINFO structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

 Note that the number of BINFO slots has already been emitted in
 EXPR's header (see streamer_write_tree_header) because this length
 is needed to build the empty BINFO node on the reader side.   
 The number of BINFO_BASE_ACCESSES has already been emitted in
 EXPR's bitfield section.   
 Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
 and BINFO_VPTR_INDEX; these are used by C++ FE only.   
static void write_ts_block_tree_pointers ( )
static

Write all pointer fields in the TS_BLOCK structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

 Stream BLOCK_ABSTRACT_ORIGIN for the limited cases we can handle - those
 that represent inlined function scopes.
 For the rest them on the floor instead of ICEing in dwarf2out.c.   
 Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug information
 for early inlined BLOCKs so drop it on the floor instead of ICEing in
 dwarf2out.c.   
 BLOCK_FRAGMENT_ORIGIN and BLOCK_FRAGMENT_CHAIN is not live at LTO
 streaming time.   
 Do not output BLOCK_SUBBLOCKS.  Instead on streaming-in this
 list is re-constructed from BLOCK_SUPERCONTEXT.   

References CONSTRUCTOR_ELTS, FOR_EACH_CONSTRUCTOR_ELT, and stream_write_tree.

static void write_ts_common_tree_pointers ( )
static

Write all pointer fields in the TS_COMMON structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

References ANON_AGGRNAME_P, DECL_CONTEXT, DECL_NAME, gdbhooks::IDENTIFIER_NODE, NULL_TREE, stream_write_tree, and TREE_CODE.

static void write_ts_complex_tree_pointers ( )
static

Write all pointer fields in the TS_COMPLEX structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

static void write_ts_constructor_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_CONSTRUCTOR structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

static void write_ts_decl_common_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_DECL_COMMON structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

Note, DECL_INITIAL is not handled here. Since DECL_INITIAL needs special handling in LTO, it must be handled by streamer hooks.

 Do not stream DECL_ABSTRACT_ORIGIN.  We cannot handle debug information
 for early inlining so drop it on the floor instead of ICEing in
 dwarf2out.c.   

References DECL_ASSEMBLER_NAME, DECL_ASSEMBLER_NAME_SET_P, DECL_COMDAT_GROUP, DECL_SECTION_NAME, NULL_TREE, and stream_write_tree.

static void write_ts_decl_minimal_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_DECL_MINIMAL structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

Drop names that were created for anonymous entities.

References DECL_ORIGINAL_TYPE, DECL_VINDEX, stream_write_tree, TREE_CODE, and gdbhooks::TYPE_DECL.

static void write_ts_decl_non_common_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_DECL_NON_COMMON structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

References DECL_FUNCTION_PERSONALITY, DECL_FUNCTION_SPECIFIC_OPTIMIZATION, DECL_FUNCTION_SPECIFIC_TARGET, and stream_write_tree.

static void write_ts_decl_with_vis_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_DECL_WITH_VIS structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

Make sure we don't inadvertently set the assembler name.

References stream_write_tree, TYPE_ATTRIBUTES, TYPE_CONTEXT, TYPE_MAIN_VARIANT, TYPE_NAME, TYPE_SIZE, TYPE_SIZE_UNIT, and TYPE_STUB_DECL.

static void write_ts_exp_tree_pointers ( )
static

Write all pointer fields in the TS_EXP structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

static void write_ts_field_decl_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_FIELD_DECL structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

References RECORD_OR_UNION_TYPE_P, stream_write_tree, streamer_write_chain(), TREE_CODE, TYPE_ARG_TYPES, TYPE_DOMAIN, TYPE_FIELDS, and TYPE_VALUES.

static void write_ts_function_decl_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_FUNCTION_DECL structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

DECL_STRUCT_FUNCTION is handled by lto_output_function. FIXME lto, maybe it should be handled here?

static void write_ts_list_tree_pointers ( )
static

Write all pointer fields in the TS_LIST structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

static void write_ts_type_common_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_TYPE_COMMON structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

 Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO.  They will be
 reconstructed during fixup.   
 Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
 during fixup.   
 TYPE_CANONICAL is re-computed during type merging, so no need
 to stream it here.   
static void write_ts_type_non_common_tree_pointers ( struct output_block ob,
tree  expr,
bool  ref_p 
)
static

Write all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

static void write_ts_vec_tree_pointers ( )
static

Write all pointer fields in the TS_VEC structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

Note that the number of slots for EXPR has already been emitted in EXPR's header (see streamer_write_tree_header).

References BINFO_BASE_BINFOS, BINFO_OFFSET, FOR_EACH_VEC_ELT, NULL_TREE, and stream_write_tree.

static void write_ts_vector_tree_pointers ( )
static

Write all pointer fields in the TS_VECTOR structure of EXPR to output block OB. If REF_P is true, write a reference to EXPR's pointer fields.

Note that the number of elements for EXPR has already been emitted in EXPR's header (see streamer_write_tree_header).

References DECL_ATTRIBUTES, DECL_SIZE, DECL_SIZE_UNIT, and stream_write_tree.