Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:17

0001 //=- StructuralHash.h - Structural Hash Printing --*- C++ -*-----------------=//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_ANALYSIS_STRUCTURALHASH_H
0010 #define LLVM_ANALYSIS_STRUCTURALHASH_H
0011 
0012 #include "llvm/IR/PassManager.h"
0013 
0014 namespace llvm {
0015 
0016 enum class StructuralHashOptions {
0017   None,              /// Hash with opcode only.
0018   Detailed,          /// Hash with opcode and operands.
0019   CallTargetIgnored, /// Ignore call target operand when computing hash.
0020 };
0021 
0022 /// Printer pass for  StructuralHashes
0023 class StructuralHashPrinterPass
0024     : public PassInfoMixin<StructuralHashPrinterPass> {
0025   raw_ostream &OS;
0026   const StructuralHashOptions Options;
0027 
0028 public:
0029   explicit StructuralHashPrinterPass(raw_ostream &OS,
0030                                      StructuralHashOptions Options)
0031       : OS(OS), Options(Options) {}
0032 
0033   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
0034 
0035   static bool isRequired() { return true; }
0036 };
0037 
0038 } // namespace llvm
0039 
0040 #endif // LLVM_ANALYSIS_STRUCTURALHASH_H