LLVM 19.0.0git
StructuralHash.cpp
Go to the documentation of this file.
1//===- StructuralHash.cpp - Function Hash Printing ------------------------===//
2//
3// 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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the StructuralHashPrinterPass which is used to show
10// the structural hash of all functions in a module and the module itself.
11//
12//===----------------------------------------------------------------------===//
13
17
18using namespace llvm;
19
22 OS << "Module Hash: "
23 << Twine::utohexstr(StructuralHash(M, EnableDetailedStructuralHash))
24 << "\n";
25 for (Function &F : M) {
26 if (F.isDeclaration())
27 continue;
28 OS << "Function " << F.getName() << " Hash: "
29 << Twine::utohexstr(StructuralHash(F, EnableDetailedStructuralHash))
30 << "\n";
31 }
33}
#define F(x, y, z)
Definition: MD5.cpp:55
ModuleAnalysisManager MAM
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:321
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: Analysis.h:115
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
static Twine utohexstr(const uint64_t &Val)
Definition: Twine.h:416
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
IRHash StructuralHash(const Function &F, bool DetailedHash=false)
Returns a hash of the function F.