GCC Middle and Back End API Reference
tree-streamer.c File Reference

Functions

void streamer_check_handled_ts_structures ()
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 record_common_node ()
static void preload_common_nodes ()
struct streamer_tree_cache_dstreamer_tree_cache_create ()
void streamer_tree_cache_delete ()

Function Documentation

static void preload_common_nodes ( )
static
   Preload common nodes into CACHE and make sure they are merged
   properly according to the gimple type table.  
       Skip itk_char.  char_type_node is dependent on -f[un]signed-char.  
       Skip boolean type and constants, they are frontend dependent.  

References cache, streamer_tree_cache_d::hashes, streamer_tree_cache_d::node_map, and streamer_tree_cache_d::nodes.

static void record_common_node ( )
static
   Record NODE in CACHE.  
     If we recursively end up at nodes we do not want to preload simply don't.
     ???  We'd want to verify that this doesn't happen, or alternatively
     do not recurse at all.  
     We have to make sure to fill exactly the same number of
     elements for all frontends.  That can include NULL trees.
     As our hash table can't deal with zero entries we'll simply stream
     a random other tree.  A NULL tree never will be looked up so it
     doesn't matter which tree we replace it with, just to be sure
     use error_mark_node.  
     ???  FIXME, devise a better hash value.  But the hash needs to be equal
     for all frontend and lto1 invocations.  So just use the position
     in the cache as hash value.  
         The FIELD_DECLs of structures should be shared, so that every
         COMPONENT_REF uses the same tree node when referencing a field.
         Pointer equality between FIELD_DECLs is used by the alias
         machinery to compute overlapping component references (see
         nonoverlapping_component_refs_p and
         nonoverlapping_component_refs_of_decl_p).  
void streamer_check_handled_ts_structures ( void  )
@verbatim 

Miscellaneous utilities for tree streaming. Things that are used in both input and output are here.

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/.

   Check that all the TS_* structures handled by the streamer_write_* and
   streamer_read_* routines are exactly ALL the structures defined in
   treestruct.def.  
     These are the TS_* structures that are either handled or
     explicitly ignored by the streamer routines.  
     Anything not marked above will trigger the following assertion.
     If this assertion triggers, it means that there is a new TS_*
     structure that should be handled by the streamer.  
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.  
     Make sure we're either replacing an old element or
     appending consecutively.  

References streamer_tree_cache_d::hashes, and streamer_tree_cache_d::nodes.

Referenced by streamer_tree_cache_insert(), and streamer_tree_cache_replace_tree().

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 pointer_map< T >::contains(), and streamer_tree_cache_d::node_map.

Referenced by lto_read_tree_1().

struct streamer_tree_cache_d* streamer_tree_cache_create ( )
read
   Create a cache of pickled nodes.  
     Load all the well-known tree nodes that are always created by
     the compiler on startup.  This prevents writing them out
     unnecessarily.  

References free(), streamer_tree_cache_d::hashes, streamer_tree_cache_d::node_map, and streamer_tree_cache_d::nodes.

void streamer_tree_cache_delete ( )
   Delete the streamer cache C.  
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 streamer_tree_cache_d::hashes, streamer_tree_cache_d::node_map, streamer_tree_cache_add_to_node_array(), streamer_tree_cache_get_hash(), and streamer_tree_cache_insert_1().

Referenced by lto_write_tree().

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.  
         Determine the next slot to use in the cache.  
             If the caller wants to insert T at a specific slot
             location, and ENTRY->TO does not match *IX_P, add T to
             the requested location slot.  

Referenced by streamer_tree_cache_insert(), and streamer_tree_cache_replace_tree().

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).  

Referenced by lto_output().

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