xref: /aosp_15_r20/external/llvm/lib/Support/Hashing.cpp (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-------------- lib/Support/Hashing.cpp -------------------------------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file provides implementation bits for the LLVM common hashing
11*9880d681SAndroid Build Coastguard Worker // infrastructure. Documentation and most of the other information is in the
12*9880d681SAndroid Build Coastguard Worker // header file.
13*9880d681SAndroid Build Coastguard Worker //
14*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
15*9880d681SAndroid Build Coastguard Worker 
16*9880d681SAndroid Build Coastguard Worker #include "llvm/ADT/Hashing.h"
17*9880d681SAndroid Build Coastguard Worker 
18*9880d681SAndroid Build Coastguard Worker using namespace llvm;
19*9880d681SAndroid Build Coastguard Worker 
20*9880d681SAndroid Build Coastguard Worker // Provide a definition and static initializer for the fixed seed. This
21*9880d681SAndroid Build Coastguard Worker // initializer should always be zero to ensure its value can never appear to be
22*9880d681SAndroid Build Coastguard Worker // non-zero, even during dynamic initialization.
23*9880d681SAndroid Build Coastguard Worker size_t llvm::hashing::detail::fixed_seed_override = 0;
24*9880d681SAndroid Build Coastguard Worker 
25*9880d681SAndroid Build Coastguard Worker // Implement the function for forced setting of the fixed seed.
26*9880d681SAndroid Build Coastguard Worker // FIXME: Use atomic operations here so that there is no data race.
set_fixed_execution_hash_seed(size_t fixed_value)27*9880d681SAndroid Build Coastguard Worker void llvm::set_fixed_execution_hash_seed(size_t fixed_value) {
28*9880d681SAndroid Build Coastguard Worker   hashing::detail::fixed_seed_override = fixed_value;
29*9880d681SAndroid Build Coastguard Worker }
30