GCC Middle and Back End API Reference
|
Data Structures | |
struct | pointer_map_t |
Functions | |
static size_t | hash1 () |
struct pointer_set_t * | pointer_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_t * | pointer_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) |
|
inlinestatic |
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.
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_t::log_slots, pointer_set_t::n_elements, pointer_set_t::n_slots, pointer_map_t::pset, pointer_set_t::slots, and pointer_map_t::values.
Referenced by add_stack_var_conflict(), ao_ref_from_mem(), cgraph_node_set_remove(), check_cond_move_block(), default_rtl_profile(), eliminate_indirect_cycles(), fold_marked_statements(), gimple_predict_edge(), init_lim_data(), lto_tag_is_tree_code_p(), remap_ssa_name(), stmt_cost(), and var_mem_decl_set().
|
read |
Allocate an empty pointer map.
Referenced by add_partitioned_vars_to_ptset(), delete_unreachable_blocks_update_callgraph(), get_base_var(), and idx_contains_abnormal_ssa_name_p().
void pointer_map_destroy | ( | struct pointer_map_t * | pmap | ) |
Reclaims all memory associated with PMAP.
References NULL, pointer_set_lookup(), pointer_map_t::pset, and pointer_map_t::values.
Referenced by adjust_iv_update_pos(), delete_unreachable_blocks_update_callgraph(), dump_cgraph_node_set(), free_var_map_entry(), lto_symtab_encoder_new(), new_omp_context(), update_alias_info_with_stack_vars(), and varpool_node_set_find().
void** pointer_map_insert | ( | ) |
Inserts P into PMAP if it wasn't already there. Returns a pointer to the value. P must be nonnull.
For simplicity, expand the map even if P is already there. This can be superfluous but can happen at most once.
Referenced by bound_index(), cgraph_node_set_new(), current_function_has_exception_handlers(), delete_unreachable_blocks_update_callgraph(), free_cgraph_node_set(), and get_frame_field().
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.
Referenced by adjust_iv_update_pos(), and free_var_map_entry().
int pointer_set_contains | ( | ) |
Returns nonzero if PSET contains P. P must be nonnull.
Collisions are resolved by linear probing.
References pointer_set_t::n_elements, and pointer_set_t::n_slots.
Referenced by function_always_visible_to_compiler_p(), and gimple_move_stmt_histograms().
|
read |
Allocate an empty pointer set.
Referenced by debug_generic_stmt(), devirt_node_removal_hook(), function_always_visible_to_compiler_p(), is_use_properly_guarded(), possible_polymorphic_call_target_p(), odr_hasher::remove(), update_alias_info_with_stack_vars(), visit_hist(), and write_symbol().
void pointer_set_destroy | ( | ) |
Reclaims all memory associated with PSET.
Referenced by odr_hasher::hash(), is_use_properly_guarded(), new_omp_context(), update_alias_info_with_stack_vars(), and write_symbol().
int pointer_set_insert | ( | ) |
Inserts P into PSET if it wasn't already there. Returns nonzero if it was already there. P must be nonnull.
For simplicity, expand the set even if P is already there. This can be superfluous but can happen at most once.
References pointer_set_t::log_slots, pointer_set_t::n_slots, pointer_set_lookup(), and pointer_set_t::slots.
Referenced by annotate_all_with_location(), build_type_inheritance_graph(), canonicalize_component_ref(), go_output_typedef(), is_use_properly_guarded(), maybe_record_node(), odr_hasher::remove(), symtab_remove_unreachable_nodes(), and walk_polymorphic_call_targets().
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 pointer_set_t::n_slots, and pointer_set_t::slots.
Referenced by pointer_map< T >::insert(), pointer_map_destroy(), pointer_set_insert(), and pointer_map< T >::~pointer_map().
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_map_t::pset, and pointer_map_t::values.