|
LLVM 23.0.0git
|
Classes | |
| 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 > > |
Functions | |
| uint32_t | fetch32 (const char *p) |
| constexpr uint64_t | hash_16_bytes (uint64_t low, uint64_t high) |
| uint64_t | get_execution_seed () |
| In LLVM_ENABLE_ABI_BREAKING_CHECKS builds, the seed is non-deterministic per process (address of a function in LLVMSupport) to prevent having users depend on the particular hash values. | |
| hash_code | combine_bytes (const char *data, size_t len) |
| Hash a contiguous byte buffer to a hash_code. | |
| template<typename T> | |
| auto | get_hashable_data (const T &value) |
| Helper to get the hashable data representation for a type. | |
| 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_t< is_hashable_data< ValueT >::value, hash_code > | hash_combine_range_impl (ValueT *first, ValueT *last) |
| Implement the combining of integral values into a hash_code. | |
| template<typename... Ts> | |
| constexpr size_t | total_hashable_size () |
| Sum of sizeof(get_hashable_data(arg)) across a parameter pack. | |
| template<typename T> | |
| void | store_hashable_data (char *buf, size_t &off, const T &arg) |
| Copy get_hashable_data(arg) into buf at offset off, advancing off. | |
| hash_code | hash_integer_value (uint64_t value) |
| Helper to hash the value of a single integer. | |
Hash a contiguous byte buffer to a hash_code.
The execution seed is XORed into the result (not propagated through the avalanche), so a given byte stream produces the same xxh3 output modulo the per-process seed.
Definition at line 180 of file Hashing.h.
References data, get_execution_seed(), and llvm::xxh3_64bits().
Referenced by llvm::hash_combine(), hash_combine_range_impl(), and hash_combine_range_impl().
Definition at line 141 of file Hashing.h.
References llvm::sys::IsBigEndianHost, and llvm::sys::swapByteOrder().
Referenced by hash_integer_value().
|
inline |
In LLVM_ENABLE_ABI_BREAKING_CHECKS builds, the seed is non-deterministic per process (address of a function in LLVMSupport) to prevent having users depend on the particular hash values.
On platforms without ASLR, this is still likely non-deterministic per build.
Definition at line 164 of file Hashing.h.
References llvm::install_fatal_error_handler().
Referenced by combine_bytes(), and hash_integer_value().
Helper to get the hashable data representation for a type.
Definition at line 214 of file Hashing.h.
References llvm::hash_value(), and T.
Referenced by hash_combine_range_impl(), store_hashable_data(), and total_hashable_size().
Definition at line 149 of file Hashing.h.
Referenced by hash_integer_value().
| 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.
xxh3 has no streaming entry point in libLLVMSupport, so the byte stream is flattened to a buffer and hashed in one shot. The 256-byte on-stack buffer holds 32 pointer-sized values, which covers virtually all in-tree non-contiguous callers. The prior chunked CityHash impl streamed and never allocated.
Definition at line 238 of file Hashing.h.
References combine_bytes(), data, and get_hashable_data().
| std::enable_if_t< is_hashable_data< ValueT >::value, hash_code > 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 275 of file Hashing.h.
References combine_bytes().
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 345 of file Hashing.h.
References fetch32(), get_execution_seed(), and hash_16_bytes().
|
inline |
Copy get_hashable_data(arg) into buf at offset off, advancing off.
Definition at line 288 of file Hashing.h.
References data, get_hashable_data(), and T.
Referenced by llvm::hash_combine().
|
constexpr |
Sum of sizeof(get_hashable_data(arg)) across a parameter pack.
Definition at line 281 of file Hashing.h.
References get_hashable_data().
Referenced by llvm::hash_combine().