1*0b57cec5SDimitry Andric //===-------------- lib/Support/Hashing.cpp -------------------------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric //
9*0b57cec5SDimitry Andric // This file provides implementation bits for the LLVM common hashing
10*0b57cec5SDimitry Andric // infrastructure. Documentation and most of the other information is in the
11*0b57cec5SDimitry Andric // header file.
12*0b57cec5SDimitry Andric //
13*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
14*0b57cec5SDimitry Andric 
15*0b57cec5SDimitry Andric #include "llvm/ADT/Hashing.h"
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric using namespace llvm;
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric // Provide a definition and static initializer for the fixed seed. This
20*0b57cec5SDimitry Andric // initializer should always be zero to ensure its value can never appear to be
21*0b57cec5SDimitry Andric // non-zero, even during dynamic initialization.
22*0b57cec5SDimitry Andric uint64_t llvm::hashing::detail::fixed_seed_override = 0;
23*0b57cec5SDimitry Andric 
24*0b57cec5SDimitry Andric // Implement the function for forced setting of the fixed seed.
25*0b57cec5SDimitry Andric // FIXME: Use atomic operations here so that there is no data race.
set_fixed_execution_hash_seed(uint64_t fixed_value)26*0b57cec5SDimitry Andric void llvm::set_fixed_execution_hash_seed(uint64_t fixed_value) {
27*0b57cec5SDimitry Andric   hashing::detail::fixed_seed_override = fixed_value;
28*0b57cec5SDimitry Andric }
29