LLVM: lib/Analysis/StructuralHash.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

18

19using namespace llvm;

20

23 OS << "Module Hash: "

24 << format("%016" PRIx64,

26 << "\n";

28 if (F.isDeclaration())

29 continue;

31 auto IgnoreOp = [&](const Instruction *I, unsigned OpndIdx) {

32 return I->getOpcode() == Instruction::Call &&

34 };

36 OS << "Function " << F.getName()

37 << " Hash: " << format("%016" PRIx64, FuncHashInfo.FunctionHash)

38 << "\n";

39 for (auto &[IndexPair, OpndHash] : *FuncHashInfo.IndexOperandHashMap) {

40 auto [InstIndex, OpndIndex] = IndexPair;

41 OS << "\tIgnored Operand Hash: " << format("%016" PRIx64, OpndHash)

42 << " at (" << InstIndex << "," << OpndIndex << ")\n";

43 }

44 } else {

45 OS << "Function " << F.getName() << " Hash: "

47 "%016" PRIx64,

49 << "\n";

50 }

51 }

53}

Module.h This file contains the declarations for the Module class.

ModuleAnalysisManager MAM

A Module instance is used to store all the information related to an LLVM module.

A set of analyses that are preserved following a run of a transformation pass.

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)

Definition StructuralHash.cpp:21

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI FunctionHashInfo StructuralHashWithDifferences(const Function &F, IgnoreOperandFunc IgnoreOp)

Computes a structural hash of a given function, considering the structure and content of the function...

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

format_object< Ts... > format(const char *Fmt, const Ts &... Vals)

These are helper functions used to produce formatted output.

std::pair< unsigned, unsigned > IndexPair

The pair of an instruction index and a operand index.

LLVM_ABI stable_hash StructuralHash(const Function &F, bool DetailedHash=false)

Returns a hash of the function F.

@ Detailed

Hash with opcode only.

@ CallTargetIgnored

Hash with opcode and operands.

AnalysisManager< Module > ModuleAnalysisManager

Convenience typedef for the Module analysis manager.