blob: 1b20a670434f12b624b9d1b7f24c1ce615f7dd39 [file] [log] [blame]
Chandler Carruth34085df2012-03-01 18:58:59 +00001//===-------------- lib/Support/Hashing.cpp -------------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Chandler Carruth34085df2012-03-01 18:58:59 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file provides implementation bits for the LLVM common hashing
10// infrastructure. Documentation and most of the other information is in the
11// header file.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/ADT/Hashing.h"
16
17using namespace llvm;
18
19// Provide a definition and static initializer for the fixed seed. This
20// initializer should always be zero to ensure its value can never appear to be
21// non-zero, even during dynamic initialization.
Tim Northoverc0445092018-08-30 20:28:32 +000022uint64_t llvm::hashing::detail::fixed_seed_override = 0;
Chandler Carruth34085df2012-03-01 18:58:59 +000023
24// Implement the function for forced setting of the fixed seed.
25// FIXME: Use atomic operations here so that there is no data race.
Tim Northoverc0445092018-08-30 20:28:32 +000026void llvm::set_fixed_execution_hash_seed(uint64_t fixed_value) {
Chandler Carruth34085df2012-03-01 18:58:59 +000027 hashing::detail::fixed_seed_override = fixed_value;
28}