GCC Middle and Back End API Reference
pointer-set.c File Reference

Data Structures

struct  pointer_map_t

Functions

static size_t hash1 ()
struct pointer_set_tpointer_set_create ()
void pointer_set_destroy ()
bool pointer_set_lookup ()
int pointer_set_contains ()
int pointer_set_insert ()
void pointer_set_traverse (const struct pointer_set_t *pset, bool(*fn)(const void *, void *), void *data)
struct pointer_map_tpointer_map_create ()
void pointer_map_destroy (struct pointer_map_t *pmap)
void ** pointer_map_contains ()
void ** pointer_map_insert ()
void pointer_map_traverse (const struct pointer_map_t *pmap, bool(*fn)(const void *, void **, void *), void *data)

Function Documentation

static size_t hash1 ( )
inlinestatic
@verbatim Set operations on pointers

Copyright (C) 2004-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/.

Use the multiplicative method, as described in Knuth 6.4, to obtain
   a hash code for P in the range [0, MAX).  MAX == 2^LOGMAX.

   Summary of this method: Multiply p by some number A that's
   relatively prime to 2^sizeof(size_t).  The result is two words.
   Discard the most significant word, and return the most significant
   N bits of the least significant word.  As suggested by Knuth, our
   choice for A is the integer part of (ULONG_MAX + 1.0) / phi, where phi
   is the golden ratio.

   We don't need to do anything special for full-width multiplication
   because we're only interested in the least significant word of the
   product, and unsigned arithmetic in C is modulo the word size.   

References HOST_BITS_PER_LONG, shift, and ul.

Referenced by pointer_set_lookup().

void** pointer_map_contains ( )
Returns a pointer to the value to which P maps, if PMAP contains P.  P
   must be nonnull.  Return NULL if PMAP does not contain P.

   Collisions are resolved by linear probing.   

References pointer_set_lookup(), pointer_map_t::pset, and pointer_map_t::values.

Referenced by add_partitioned_vars_to_ptset(), add_scope_conflicts_1(), ao_ref_from_mem(), base_cand_from_table(), cgraph_node_set_find(), cgraph_node_set_remove(), check_cond_move_block(), clear_bb_predictions(), clear_lim_data(), combine_predictions_for_bb(), cond_move_convert_if_block(), cond_move_process_if_block(), contains_remapped_vars(), convert_nl_goto_receiver(), copy_arguments_for_versioning(), copy_debug_stmt(), copy_phis_for_bb(), copy_tree_body_r(), create_access_1(), create_task_copyfn(), discover_iteration_bound_by_body_walk(), expand_gimple_basic_block(), find_func_by_profile_id(), find_goto_replacement(), find_operand_rank(), get_addr_from_global_cache(), get_addr_from_local_cache(), get_base_access_vector(), get_cases_for_edge(), get_lim_data(), get_vi_for_tree(), gimple_predicted_by_p(), init_node_map(), initialize_inlined_parameters(), label_rtx_for_bb(), local_variable_can_escape(), lookup_call_use_vi(), lookup_decl(), lookup_field_for_decl(), lookup_tramp_for_decl(), lookup_vi_for_tree(), lower_resx(), lower_try_finally_switch(), lto_symtab_encoder_delete_node(), lto_symtab_encoder_encode(), lto_symtab_encoder_lookup(), mark_addressable(), maybe_duplicate_eh_stmt_fn(), maybe_lookup_decl(), move_stmt_eh_region_nr(), nesting_copy_decl(), niter_for_exit(), redirect_edge_var_map_clear(), redirect_edge_var_map_dup(), redirect_edge_var_map_vector(), remap_decl(), remap_eh_region_nr(), remap_gimple_op_r(), remap_gimple_stmt(), remap_save_expr(), remap_ssa_name(), remap_type(), remap_vla_decls(), remove_predictions_associated_with_edge(), replace_by_duplicate_decl(), replace_locals_op(), replace_ssa_name(), val_reset(), varpool_node_set_find(), varpool_node_set_remove(), visit_conflict(), and visit_op().

void pointer_map_traverse ( const struct pointer_map_t pmap,
bool(*)(const void *, void **, void *)  fn,
void *  data 
)
Pass each pointer in PMAP to the function in FN, together with the pointer
   to the value and the fixed parameter DATA.  If FN returns false, the
   iteration stops.   

References pointer_set_t::n_slots, pointer_map_t::pset, pointer_set_t::slots, and pointer_map_t::values.

Referenced by end_recording_case_labels(), free_affine_expand_cache(), free_loop_data(), redirect_edge_var_map_destroy(), sra_deinitialize(), tree_estimate_probability(), and val_reset().

bool pointer_set_lookup ( )
Lookup the slot for the pointer P and return true if it exists,
   otherwise return false in which case *IX points to the slot that
   would be used on insertion.   

References hash1(), pointer_set_t::log_slots, pointer_set_t::n_slots, and pointer_set_t::slots.

Referenced by pointer_map< T >::contains(), pointer_map< T >::insert(), pointer_map_contains(), pointer_map_insert(), pointer_set_contains(), and pointer_set_insert().

void pointer_set_traverse ( const struct pointer_set_t pset,
bool(*)(const void *, void *)  fn,
void *  data 
)
Pass each pointer in PSET to the function in FN, together with the fixed
   parameter DATA.  If FN returns false, the iteration stops.   

References pointer_set_t::n_slots, and pointer_set_t::slots.

Referenced by finalize_nesting_tree_1(), and go_finish().