diff options
Diffstat (limited to 'bolt/include/bolt/Core/HashUtilities.h')
-rw-r--r-- | bolt/include/bolt/Core/HashUtilities.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bolt/include/bolt/Core/HashUtilities.h b/bolt/include/bolt/Core/HashUtilities.h new file mode 100644 index 000000000000..8d445ff83756 --- /dev/null +++ b/bolt/include/bolt/Core/HashUtilities.h @@ -0,0 +1,41 @@ +//===- bolt/Core/HashUtilities.h - Misc hash utilities --------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains functions for computing hash values over BinaryFunction +// and BinaryBasicBlock. +// +//===----------------------------------------------------------------------===// + +#ifndef BOLT_CORE_HASH_UTILITIES_H +#define BOLT_CORE_HASH_UTILITIES_H + +#include "bolt/Core/BinaryBasicBlock.h" +#include "bolt/Core/BinaryContext.h" + +namespace llvm { +namespace bolt { + +uint16_t hash_64_to_16(const uint64_t Hash); + +std::string hashInteger(uint64_t Value); + +std::string hashSymbol(BinaryContext &BC, const MCSymbol &Symbol); + +std::string hashExpr(BinaryContext &BC, const MCExpr &Expr); + +std::string hashInstOperand(BinaryContext &BC, const MCOperand &Operand); + +using OperandHashFuncTy = function_ref<typename std::string(const MCOperand &)>; + +std::string hashBlock(BinaryContext &BC, const BinaryBasicBlock &BB, + OperandHashFuncTy OperandHashFunc); + +} // namespace bolt +} // namespace llvm + +#endif |