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

static hashnode alloc_node ( )
static
Allocate a hash node.   
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.   

References ident_hash, and strlen().

Referenced by add_builtin_function_common(), add_builtin_type(), asan_add_global(), asan_finish_file(), asan_global_struct(), assign_parms_augmented_arg_list(), build_common_tree_nodes(), build_complex_type(), build_constant_desc(), build_fn_decl(), build_info(), build_init_ctor(), build_libfunc_function(), build_personality_function(), build_var(), clone_function_name(), coverage_obj_finish(), coverage_obj_init(), create_access_replacement(), create_loop_fn(), create_omp_child_function(), create_one_component_var(), create_tmp_var_name(), create_vop_var(), decl_attributes(), declare_weak(), default_emutls_var_fields(), default_external_stack_protect_fail(), default_hidden_stack_protect_fail(), default_mangle_assembler_name(), default_stack_protect_guard(), dw2_force_const_mem(), emit_library_call_value_1(), expand_builtin_fork_or_exec(), finish_builtin_struct(), get_alias_symbol(), get_attribute_namespace(), get_chain_field(), get_emutls_object_type(), get_file_function_name(), get_frame_type(), get_nl_goto_field(), get_replaced_param_substitute(), get_spill_slot_decl(), get_trampoline_type(), gimple_init_edge_profiler(), init_block_clear_fn(), init_block_move_fn(), init_eh(), init_ic_make_global_vars(), init_one_libfunc(), initialize_sizetypes(), lhd_set_decl_assembler_name(), lookup_attribute_spec(), lower_omp_critical(), lower_rec_simd_input_clauses(), make_temp_ssa_name(), mf_make_builtin(), mf_make_mf_cache_struct_type(), output_comdat_type_unit(), output_macinfo(), prefix_name(), rest_of_decl_compilation(), self_referential_size(), set_call_expr_flags(), set_user_assembler_libfunc(), set_user_assembler_name(), and tm_mangle().

tree get_identifier_with_length ( )
Identical to get_identifier, except that the length is assumed
   known.   

References ident_hash.

Referenced by input_identifier().

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.   

References empty_string, ggc_alloc_atomic_stat(), memcpy(), and 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.   

References ident_hash, and mark_ident().

Referenced by ggc_mark_roots().

void ggc_purge_stringpool ( void  )
Purge the identifier hash of identifiers which are no longer
   referenced.   

References ident_hash, and maybe_delete_ident().

Referenced by ggc_mark_roots().

void gt_pch_fixup_stringpool ( void  )
Return the stringpool to its state before gt_pch_save_stringpool
   was called.   

Referenced by gt_pch_save().

void gt_pch_n_S ( )
PCH pointer-walking routine for strings.   

References gt_pch_note_object(), and gt_pch_p_S().

void gt_pch_nx ( )
User-callable entry point for marking string X.   

References gt_pch_n_S().

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

Referenced by ggc_call_alloc(), ggc_call_count(), gt_pch_n_S(), gt_pch_note_object(), and gt_pch_save().

void gt_pch_restore_stringpool ( void  )
A PCH file has been restored, which loaded SPD; fill the real hash table
   from SPD.   

References ident_hash, and spd.

Referenced by gt_pch_restore().

void gt_pch_save_stringpool ( void  )
Save the stringpool data in SPD.   

References ident_hash, and memcpy().

Referenced by gt_pch_save().

void init_stringpool ( void  )
Initialize the string pool.   

References alloc_node(), ident_hash, and stringpool_ggc_alloc().

Referenced by general_init().

static int mark_ident ( struct cpp_reader *  pfile,
hashnode  h,
const void *  v 
)
static
Mark an identifier for GC.   

Referenced by ggc_mark_stringpool().

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

Referenced by ggc_purge_stringpool().

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, and strlen().

Referenced by assemble_name(), and dw2_force_const_mem().

static void* stringpool_ggc_alloc ( )
static

Referenced by init_stringpool().

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

References ident_hash.

Referenced by dump_memory_report().


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 expand_asm_memory_barrier(), expand_asm_operands(), and ggc_alloc_string_stat().

struct string_pool_data* spd
static