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