LLVM API Documentation
Classes | |
struct | hash_state |
The intermediate state used during hashing. Currently, the algorithm for computing hash codes is based on CityHash and keeps 56 bytes of arbitrary state. More... | |
struct | is_hashable_data |
Trait to indicate whether a type's bits can be hashed directly. More... | |
struct | is_hashable_data< std::pair< T, U > > |
struct | hash_combine_recursive_helper |
Helper class to manage the recursive combining of hash_combine arguments. More... | |
Functions | |
uint64_t | fetch64 (const char *p) |
uint32_t | fetch32 (const char *p) |
uint64_t | rotate (uint64_t val, size_t shift) |
Bitwise right rotate. Normally this will compile to a single instruction, especially if the shift is a manifest constant. | |
uint64_t | shift_mix (uint64_t val) |
uint64_t | hash_16_bytes (uint64_t low, uint64_t high) |
uint64_t | hash_1to3_bytes (const char *s, size_t len, uint64_t seed) |
uint64_t | hash_4to8_bytes (const char *s, size_t len, uint64_t seed) |
uint64_t | hash_9to16_bytes (const char *s, size_t len, uint64_t seed) |
uint64_t | hash_17to32_bytes (const char *s, size_t len, uint64_t seed) |
uint64_t | hash_33to64_bytes (const char *s, size_t len, uint64_t seed) |
uint64_t | hash_short (const char *s, size_t length, uint64_t seed) |
size_t | get_execution_seed () |
template<typename T > | |
std::enable_if < is_hashable_data< T >::value, T >::type | get_hashable_data (const T &value) |
Helper to get the hashable data representation for a type. This variant is enabled when the type itself can be used. | |
template<typename T > | |
bool | store_and_advance (char *&buffer_ptr, char *buffer_end, const T &value, size_t offset=0) |
Helper to store data from a value into a buffer and advance the pointer into that buffer. | |
template<typename InputIteratorT > | |
hash_code | hash_combine_range_impl (InputIteratorT first, InputIteratorT last) |
Implement the combining of integral values into a hash_code. | |
template<typename ValueT > | |
std::enable_if < is_hashable_data< ValueT > ::value, hash_code >::type | hash_combine_range_impl (ValueT *first, ValueT *last) |
Implement the combining of integral values into a hash_code. | |
hash_code | hash_integer_value (uint64_t value) |
Helper to hash the value of a single integer. | |
Variables | |
static const uint64_t | k0 = 0xc3a5c85c97cb3127ULL |
Some primes between 2^63 and 2^64 for various uses. | |
static const uint64_t | k1 = 0xb492b66fbe98f273ULL |
static const uint64_t | k2 = 0x9ae16a3b2f90404fULL |
static const uint64_t | k3 = 0xc949d7c7509e6557ULL |
size_t | fixed_seed_override = 0 |
A global, fixed seed-override variable. |
uint32_t llvm::hashing::detail::fetch32 | ( | const char * | p | ) | [inline] |
Definition at line 159 of file Hashing.h.
References llvm::sys::IsBigEndianHost, llvm::LibFunc::memcpy, and llvm::sys::swapByteOrder().
Referenced by hash_4to8_bytes(), and hash_integer_value().
uint64_t llvm::hashing::detail::fetch64 | ( | const char * | p | ) | [inline] |
Definition at line 151 of file Hashing.h.
References llvm::sys::IsBigEndianHost, llvm::LibFunc::memcpy, and llvm::sys::swapByteOrder().
Referenced by hash_17to32_bytes(), hash_33to64_bytes(), hash_9to16_bytes(), llvm::hashing::detail::hash_state::mix(), and llvm::hashing::detail::hash_state::mix_32_bytes().
size_t llvm::hashing::detail::get_execution_seed | ( | ) | [inline] |
Definition at line 327 of file Hashing.h.
References fixed_seed_override.
Referenced by hash_combine_range_impl(), and hash_integer_value().
std::enable_if<!is_hashable_data< T >::value, size_t >::type llvm::hashing::detail::get_hashable_data | ( | const T & | value | ) |
Helper to get the hashable data representation for a type. This variant is enabled when the type itself can be used.
Helper to get the hashable data representation for a type. This variant is enabled when we must first call hash_value and use the result as our data.
Definition at line 372 of file Hashing.h.
Referenced by llvm::hashing::detail::hash_combine_recursive_helper::combine(), and hash_combine_range_impl().
uint64_t llvm::hashing::detail::hash_16_bytes | ( | uint64_t | low, |
uint64_t | high | ||
) | [inline] |
Definition at line 185 of file Hashing.h.
Referenced by llvm::hashing::detail::hash_state::create(), llvm::hashing::detail::hash_state::finalize(), hash_17to32_bytes(), hash_4to8_bytes(), hash_9to16_bytes(), and hash_integer_value().
uint64_t llvm::hashing::detail::hash_17to32_bytes | ( | const char * | s, |
size_t | len, | ||
uint64_t | seed | ||
) | [inline] |
Definition at line 216 of file Hashing.h.
References fetch64(), hash_16_bytes(), k0, k1, k2, k3, and rotate().
Referenced by hash_short().
uint64_t llvm::hashing::detail::hash_1to3_bytes | ( | const char * | s, |
size_t | len, | ||
uint64_t | seed | ||
) | [inline] |
Definition at line 196 of file Hashing.h.
References k2, k3, and shift_mix().
Referenced by hash_short().
uint64_t llvm::hashing::detail::hash_33to64_bytes | ( | const char * | s, |
size_t | len, | ||
uint64_t | seed | ||
) | [inline] |
Definition at line 225 of file Hashing.h.
References fetch64(), k0, k2, rotate(), and shift_mix().
Referenced by hash_short().
uint64_t llvm::hashing::detail::hash_4to8_bytes | ( | const char * | s, |
size_t | len, | ||
uint64_t | seed | ||
) | [inline] |
Definition at line 205 of file Hashing.h.
References fetch32(), and hash_16_bytes().
Referenced by hash_short().
uint64_t llvm::hashing::detail::hash_9to16_bytes | ( | const char * | s, |
size_t | len, | ||
uint64_t | seed | ||
) | [inline] |
Definition at line 210 of file Hashing.h.
References fetch64(), hash_16_bytes(), and rotate().
Referenced by hash_short().
hash_code llvm::hashing::detail::hash_combine_range_impl | ( | InputIteratorT | first, |
InputIteratorT | last | ||
) |
Implement the combining of integral values into a hash_code.
This overload is selected when the value type of the iterator is integral. Rather than computing a hash_code for each object and then combining them, this (as an optimization) directly combines the integers.
Definition at line 410 of file Hashing.h.
References llvm::hashing::detail::hash_state::create(), llvm::sys::path::end(), llvm::hashing::detail::hash_state::finalize(), get_execution_seed(), get_hashable_data(), hash_short(), llvm::hashing::detail::hash_state::mix(), rotate(), and store_and_advance().
Referenced by llvm::hash_combine_range().
std::enable_if<is_hashable_data<ValueT>::value, hash_code>::type llvm::hashing::detail::hash_combine_range_impl | ( | ValueT * | first, |
ValueT * | last | ||
) |
Implement the combining of integral values into a hash_code.
This overload is selected when the value type of the iterator is integral and when the input iterator is actually a pointer. Rather than computing a hash_code for each object and then combining them, this (as an optimization) directly combines the integers. Also, because the integers are stored in contiguous memory, this routine avoids copying each value and directly reads from the underlying memory.
Definition at line 454 of file Hashing.h.
References llvm::hashing::detail::hash_state::create(), get_execution_seed(), hash_short(), and llvm::hashing::detail::hash_state::mix().
hash_code llvm::hashing::detail::hash_integer_value | ( | uint64_t | value | ) | [inline] |
Helper to hash the value of a single integer.
Overloads for smaller integer types are not provided to ensure consistent behavior in the presence of integral promotions. Essentially, "hash_value('4')" and "hash_value('0' + 4)" should be the same.
Definition at line 722 of file Hashing.h.
References fetch32(), get_execution_seed(), and hash_16_bytes().
Referenced by llvm::hash_value().
uint64_t llvm::hashing::detail::hash_short | ( | const char * | s, |
size_t | length, | ||
uint64_t | seed | ||
) | [inline] |
Definition at line 248 of file Hashing.h.
References hash_17to32_bytes(), hash_1to3_bytes(), hash_33to64_bytes(), hash_4to8_bytes(), hash_9to16_bytes(), and k2.
Referenced by llvm::hashing::detail::hash_combine_recursive_helper::combine(), and hash_combine_range_impl().
uint64_t llvm::hashing::detail::rotate | ( | uint64_t | val, |
size_t | shift | ||
) | [inline] |
Bitwise right rotate. Normally this will compile to a single instruction, especially if the shift is a manifest constant.
Definition at line 176 of file Hashing.h.
Referenced by llvm::hashing::detail::hash_combine_recursive_helper::combine(), llvm::hashing::detail::hash_state::create(), hash_17to32_bytes(), hash_33to64_bytes(), hash_9to16_bytes(), hash_combine_range_impl(), llvm::hashing::detail::hash_state::mix(), and llvm::hashing::detail::hash_state::mix_32_bytes().
uint64_t llvm::hashing::detail::shift_mix | ( | uint64_t | val | ) | [inline] |
Definition at line 181 of file Hashing.h.
Referenced by llvm::hashing::detail::hash_state::create(), llvm::hashing::detail::hash_state::finalize(), hash_1to3_bytes(), and hash_33to64_bytes().
bool llvm::hashing::detail::store_and_advance | ( | char *& | buffer_ptr, |
char * | buffer_end, | ||
const T & | value, | ||
size_t | offset = 0 |
||
) |
Helper to store data from a value into a buffer and advance the pointer into that buffer.
This routine first checks whether there is enough space in the provided buffer, and if not immediately returns false. If there is space, it copies the underlying bytes of value into the buffer, advances the buffer_ptr past the copied bytes, and returns true.
Definition at line 393 of file Hashing.h.
References llvm::LibFunc::memcpy.
Referenced by llvm::hashing::detail::hash_combine_recursive_helper::combine_data(), and hash_combine_range_impl().
size_t llvm::hashing::detail::fixed_seed_override = 0 |
A global, fixed seed-override variable.
This variable can be set using the
Definition at line 23 of file Hashing.cpp.
Referenced by get_execution_seed(), and llvm::set_fixed_execution_hash_seed().
const uint64_t llvm::hashing::detail::k0 = 0xc3a5c85c97cb3127ULL [static] |
Some primes between 2^63 and 2^64 for various uses.
Definition at line 168 of file Hashing.h.
Referenced by hash_17to32_bytes(), and hash_33to64_bytes().
const uint64_t llvm::hashing::detail::k1 = 0xb492b66fbe98f273ULL [static] |
Definition at line 169 of file Hashing.h.
Referenced by llvm::hashing::detail::hash_state::create(), llvm::hashing::detail::hash_state::finalize(), hash_17to32_bytes(), and llvm::hashing::detail::hash_state::mix().
const uint64_t llvm::hashing::detail::k2 = 0x9ae16a3b2f90404fULL [static] |
Definition at line 170 of file Hashing.h.
Referenced by hash_17to32_bytes(), hash_1to3_bytes(), hash_33to64_bytes(), and hash_short().
const uint64_t llvm::hashing::detail::k3 = 0xc949d7c7509e6557ULL [static] |
Definition at line 171 of file Hashing.h.
Referenced by hash_17to32_bytes(), and hash_1to3_bytes().