GCC Middle and Back End API Reference
tree-streamer.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "tree-streamer.h"
#include "cgraph.h"
Include dependency graph for tree-streamer.cc:

Functions

void streamer_check_handled_ts_structures (void)
 
static void streamer_tree_cache_add_to_node_array (struct streamer_tree_cache_d *cache, unsigned ix, tree t, hashval_t hash)
 
static bool streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache, tree t, hashval_t hash, unsigned *ix_p, bool insert_at_next_slot_p)
 
bool streamer_tree_cache_insert (struct streamer_tree_cache_d *cache, tree t, hashval_t hash, unsigned *ix_p)
 
void streamer_tree_cache_replace_tree (struct streamer_tree_cache_d *cache, tree t, unsigned ix)
 
void streamer_tree_cache_append (struct streamer_tree_cache_d *cache, tree t, hashval_t hash)
 
bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t, unsigned *ix_p)
 
static void verify_common_node_recorded (struct streamer_tree_cache_d *cache, tree node)
 
static void record_common_node (struct streamer_tree_cache_d *cache, tree node)
 
static void preload_common_nodes (struct streamer_tree_cache_d *cache)
 
struct streamer_tree_cache_dstreamer_tree_cache_create (bool with_hashes, bool with_map, bool with_vec)
 
void streamer_tree_cache_delete (struct streamer_tree_cache_d *c)
 

Variables

unsigned char streamer_mode_table [MAX_MACHINE_MODE]
 

Function Documentation

◆ preload_common_nodes()

◆ record_common_node()

◆ streamer_check_handled_ts_structures()

void streamer_check_handled_ts_structures ( void )
Check that all the TS_* structures handled by the streamer_write_* and
streamer_read_* routines are exactly ALL the structures defined in
treestruct.def.   

References gcc_assert, ggc_alloc(), i, and LAST_TS_ENUM.

Referenced by lto_streamer_init().

◆ streamer_tree_cache_add_to_node_array()

static void streamer_tree_cache_add_to_node_array ( struct streamer_tree_cache_d * cache,
unsigned ix,
tree t,
hashval_t hash )
static
Helper for streamer_tree_cache_insert_1.  Add T to CACHE->NODES at
slot IX.   

References cache, and ggc_alloc().

Referenced by streamer_tree_cache_append(), streamer_tree_cache_insert_1(), and streamer_tree_cache_replace_tree().

◆ streamer_tree_cache_append()

void streamer_tree_cache_append ( struct streamer_tree_cache_d * cache,
tree t,
hashval_t hash )
Appends tree node T to CACHE, even if T already existed in it.   

References cache, ggc_alloc(), streamer_tree_cache_add_to_node_array(), and streamer_tree_cache_insert_1().

Referenced by lto_input_scc(), lto_input_tree_1(), lto_read_tree(), and record_common_node().

◆ streamer_tree_cache_create()

struct streamer_tree_cache_d * streamer_tree_cache_create ( bool with_hashes,
bool with_map,
bool with_vec )
Create a cache of pickled nodes.   

References cache, ggc_alloc(), and preload_common_nodes().

Referenced by create_output_block(), and lto_data_in_create().

◆ streamer_tree_cache_delete()

void streamer_tree_cache_delete ( struct streamer_tree_cache_d * c)

◆ streamer_tree_cache_insert()

bool streamer_tree_cache_insert ( struct streamer_tree_cache_d * cache,
tree t,
hashval_t hash,
unsigned * ix_p )
Insert tree node T in CACHE.  If T already existed in the cache
return true.  Otherwise, return false.

If IX_P is non-null, update it with the index into the cache where
T has been stored.   

References cache, ggc_alloc(), and streamer_tree_cache_insert_1().

Referenced by DFS::DFS(), and lto_output_tree_1().

◆ streamer_tree_cache_insert_1()

static bool streamer_tree_cache_insert_1 ( struct streamer_tree_cache_d * cache,
tree t,
hashval_t hash,
unsigned * ix_p,
bool insert_at_next_slot_p )
static
Helper for streamer_tree_cache_insert and streamer_tree_cache_insert_at.
CACHE, T, and IX_P are as in streamer_tree_cache_insert.

If INSERT_AT_NEXT_SLOT_P is true, T is inserted at the next available
slot in the cache.  Otherwise, T is inserted at the position indicated
in *IX_P.

If T already existed in CACHE, return true.  Otherwise,
return false.   

References cache, gcc_assert, ggc_alloc(), and streamer_tree_cache_add_to_node_array().

Referenced by streamer_tree_cache_append(), streamer_tree_cache_insert(), and streamer_tree_cache_replace_tree().

◆ streamer_tree_cache_lookup()

bool streamer_tree_cache_lookup ( struct streamer_tree_cache_d * cache,
tree t,
unsigned * ix_p )
Return true if tree node T exists in CACHE, otherwise false.  If IX_P is
not NULL, write to *IX_P the index into the cache where T is stored
((unsigned)-1 if T is not found).   

References cache, gcc_assert, ggc_alloc(), and NULL.

Referenced by DFS::DFS_write_tree(), lto_output_decl_state_refs(), lto_output_tree(), stream_write_tree_ref(), verify_common_node_recorded(), write_global_references(), write_global_stream(), and write_symbol().

◆ streamer_tree_cache_replace_tree()

void streamer_tree_cache_replace_tree ( struct streamer_tree_cache_d * cache,
tree t,
unsigned ix )

◆ verify_common_node_recorded()

static void verify_common_node_recorded ( struct streamer_tree_cache_d * cache,
tree node )
static
Verify that NODE is in CACHE.   

References cache, gcc_assert, ggc_alloc(), i, NULL, and streamer_tree_cache_lookup().

Referenced by record_common_node().

Variable Documentation

◆ streamer_mode_table

unsigned char streamer_mode_table[MAX_MACHINE_MODE]
Miscellaneous utilities for tree streaming.  Things that are used
   in both input and output are here.

   Copyright (C) 2011-2024 Free Software Foundation, Inc.
   Contributed by Diego Novillo <dnovillo@google.com>

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/>.   
Table indexed by machine_mode, used for 2 different purposes.
During streaming out we record there non-zero value for all modes
that were streamed out.
During streaming in, we translate the on the disk mode using this
table.  For normal LTO it is set to identity, for ACCEL_COMPILER
depending on the mode_table content.   

Referenced by bp_pack_machine_mode(), lto_output_init_mode_table(), and lto_write_mode_table().