GCC Middle and Back End API Reference
stringpool.c File Reference

Data Structures

struct  string_pool_data

Functions

static hashnode alloc_node (cpp_hash_table *)
static int mark_ident (struct cpp_reader *, hashnode, const void *)
static void * stringpool_ggc_alloc ()
void init_stringpool ()
static hashnode alloc_node ()
const char * ggc_alloc_string_stat ()
tree get_identifier ()
tree get_identifier_with_length ()
tree maybe_get_identifier ()
void stringpool_statistics ()
static int maybe_delete_ident (struct cpp_reader *pfile, hashnode h, const void *v)
void ggc_mark_stringpool ()
void ggc_purge_stringpool ()
void gt_pch_p_S (void *obj, void *x, gt_pointer_operator op, void *cookie)
void gt_pch_n_S ()
void gt_pch_nx ()
void gt_pch_save_stringpool ()
void gt_pch_fixup_stringpool ()
void gt_pch_restore_stringpool ()

Variables

const char empty_string [] = ""
static const char digit_vector []
struct ht * ident_hash
static struct string_pool_dataspd

Function Documentation

static hashnode alloc_node ( cpp_hash_table *  )
static

Referenced by stringpool_ggc_alloc().

static hashnode alloc_node ( )
static
   Allocate a hash node.  

References strlen().

tree get_identifier ( )
   Return an IDENTIFIER_NODE whose name is TEXT (a null-terminated string).
   If an identifier with that name has previously been referred to,
   the same node is returned this time.  
     ht_node can't be NULL here.  

References ident_hash.

Referenced by complex_visit_phi(), copy_ssa_name(), coverage_obj_init(), decl_attributes(), default_function_arg_round_boundary(), default_stack_protect_guard(), expand_builtin_fabs(), gen_int_to_fp_nondecimal_conv_libfunc(), get_emutls_object_name(), gimple_init_edge_profiler(), lhd_omp_predetermined_sharing(), lhd_set_decl_assembler_name(), lookup_tramp_for_decl(), output_constructor_bitfield(), and ubsan_source_location_type().

tree get_identifier_with_length ( )
   Identical to get_identifier, except that the length is assumed
   known.  
     ht_node can't be NULL here.  

References ident_hash, and strlen().

const char* ggc_alloc_string_stat ( )
   Allocate and return a string constant of length LENGTH, containing
   CONTENTS.  If LENGTH is -1, CONTENTS is assumed to be a
   nul-terminated string, and the length is calculated using strlen.  
void ggc_mark_stringpool ( void  )
   Mark the trees hanging off the identifier node for GGC.  These are
   handled specially (not using gengtype) because identifiers are only
   roots during one part of compilation.  
void ggc_purge_stringpool ( void  )
   Purge the identifier hash of identifiers which are no longer
   referenced.  

References gt_pch_note_object(), and gt_pch_p_S().

void gt_pch_fixup_stringpool ( void  )
   Return the stringpool to its state before gt_pch_save_stringpool
   was called.  
void gt_pch_n_S ( )
   PCH pointer-walking routine for strings.  
void gt_pch_nx ( )
   User-callable entry point for marking string X.  
void gt_pch_p_S ( void *  obj,
void *  x,
gt_pointer_operator  op,
void *  cookie 
)
   Pointer-walking routine for strings (not very interesting, since
   strings don't contain pointers).  

References gt_pch_n_S().

Referenced by ggc_purge_stringpool().

void gt_pch_restore_stringpool ( void  )
   A PCH file has been restored, which loaded SPD; fill the real hash table
   from SPD.  
void gt_pch_save_stringpool ( void  )
void init_stringpool ( void  )
   Initialize the string pool.  
     Create with 16K (2^14) entries.  
static int mark_ident ( struct cpp_reader *  pfile,
hashnode  h,
const void *  v 
)
static
   Mark an identifier for GC.  

References ident_hash.

static int maybe_delete_ident ( struct cpp_reader *  pfile,
hashnode  h,
const void *  v 
)
static
   Return true if an identifier should be removed from the table.  

References ident_hash.

tree maybe_get_identifier ( )
   If an identifier with the name TEXT (a null-terminated string) has
   previously been referred to, return that node; otherwise return
   NULL_TREE.  

References ident_hash.

Referenced by assemble_external_real().

static void* stringpool_ggc_alloc ( )
static

References alloc_node(), and ident_hash.

void stringpool_statistics ( void  )
   Report some basic statistics about the string pool.  

References ggc_marked_p().


Variable Documentation

const char digit_vector[]
static
Initial value:
{
'0', 0, '1', 0, '2', 0, '3', 0, '4', 0,
'5', 0, '6', 0, '7', 0, '8', 0, '9', 0
}
   Character strings, each containing a single decimal digit.
   Written this way to save space.  
const char empty_string[] = ""
@verbatim 

String pool for GCC. Copyright (C) 2000-2013 Free Software Foundation, Inc.

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

   String text, identifier text and identifier node allocator.
   Identifiers are uniquely stored in a hash table.

   We use cpplib's hash table implementation.  libiberty's
   hashtab.c is not used because it requires 100% average space
   overhead per string, which is unacceptable.  Also, this algorithm
   is faster.  
   The "" allocated string.  

Referenced by maybe_emit_atomic_exchange().

struct ht* ident_hash
   The hashtable, so that the C front ends can pass it to cpplib.  

Referenced by get_identifier(), get_identifier_with_length(), gt_pch_save_stringpool(), mark_ident(), maybe_delete_ident(), maybe_get_identifier(), and stringpool_ggc_alloc().

struct string_pool_data* spd
static