GCC Middle and Back End API Reference
hash-table.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "hash-table.h"
Include dependency graph for hash-table.cc:

Functions

unsigned int hash_table_higher_prime_index (unsigned long n)
 
mem_alloc_description< mem_usage > & hash_table_usage ()
 
void dump_hash_table_loc_statistics (void)
 
ATTRIBUTE_NORETURN ATTRIBUTE_COLD void hashtab_chk_error ()
 

Variables

struct prime_ent const prime_tab []
 
unsigned int hash_table_sanitize_eq_limit
 

Function Documentation

◆ dump_hash_table_loc_statistics()

void dump_hash_table_loc_statistics ( void )

◆ hash_table_higher_prime_index()

unsigned int hash_table_higher_prime_index ( unsigned long n)
The following function returns an index into the above table of the
nearest prime number which is at least N, and near a power of two.  

References gcc_assert, ggc_alloc(), prime_ent::prime, and prime_tab.

Referenced by hash_table< Descriptor, Lazy, Allocator >::empty_slow(), hash_table< Descriptor, Lazy, Allocator >::expand(), and hash_table< Descriptor, Lazy, Allocator >::hash_table().

◆ hash_table_usage()

mem_alloc_description< mem_usage > & hash_table_usage ( void )
Return a reference to the lazily initialized hash-table usage description.
This needs to be a function rather than a simple global variable so that it
is reliably initialized before hash table variables in other files such as
sem_item::m_type_hash_cache.   

References usage().

Referenced by hash_table< Descriptor, Lazy, Allocator >::alloc_entries(), dump_hash_table_loc_statistics(), hash_table< Descriptor, Lazy, Allocator >::expand(), hash_table< Descriptor, Lazy, Allocator >::hash_table(), hash_table< Descriptor, Lazy, Allocator >::hash_table(), and hash_table< Descriptor, Lazy, Allocator >::~hash_table().

◆ hashtab_chk_error()

ATTRIBUTE_NORETURN ATTRIBUTE_COLD void hashtab_chk_error ( )
Report a hash table checking error.   

References gcc_unreachable, and ggc_alloc().

Referenced by hash_table< Descriptor, Lazy, Allocator >::verify().

Variable Documentation

◆ hash_table_sanitize_eq_limit

unsigned int hash_table_sanitize_eq_limit
Limit number of comparisons when calling hash_table<>::verify.   

Referenced by process_options(), and hash_table< Descriptor, Lazy, Allocator >::verify().

◆ prime_tab

struct prime_ent const prime_tab[]
A type-safe hash table template.
   Copyright (C) 2012-2024 Free Software Foundation, Inc.
   Contributed by Lawrence Crowl <crowl@google.com>

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/>.   
This file implements a typed hash table.
The implementation borrows from libiberty's hashtab.   
Table of primes and multiplicative inverses.

Note that these are not minimally reduced inverses.  Unlike when generating
code to divide by a constant, we want to be able to use the same algorithm
all the time.  All of these inverses (are implied to) have bit 32 set.

For the record, here's the function that computed the table; it's a 
vastly simplified version of the function of the same name from gcc.   

Referenced by hash_table< Descriptor, Lazy, Allocator >::empty_slow(), hash_table< Descriptor, Lazy, Allocator >::expand(), hash_table< Descriptor, Lazy, Allocator >::hash_table(), hash_table_higher_prime_index(), hash_table_mod1(), and hash_table_mod2().