LLVM 20.0.0git
|
This class puts all the pieces of the IRInstructionData, IRInstructionMapper, IRSimilarityCandidate together. More...
#include "llvm/Analysis/IRSimilarityIdentifier.h"
Public Member Functions | |
IRSimilarityIdentifier (bool MatchBranches=true, bool MatchIndirectCalls=true, bool MatchCallsWithName=false, bool MatchIntrinsics=true, bool MatchMustTailCalls=true) | |
SimilarityGroupList & | findSimilarity (ArrayRef< std::unique_ptr< Module > > Modules) |
SimilarityGroupList & | findSimilarity (Module &M) |
void | resetSimilarityCandidates () |
std::optional< SimilarityGroupList > & | getSimilarity () |
This class puts all the pieces of the IRInstructionData, IRInstructionMapper, IRSimilarityCandidate together.
It first feeds the Module or vector of Modules into the IRInstructionMapper, and puts all the mapped instructions into a single long list of IRInstructionData.
The list of unsigned integers is given to the Suffix Tree or similar data structure to find repeated subsequences. We construct an IRSimilarityCandidate for each instance of the subsequence. We compare them against one another since These repeated subsequences can have different structure. For each different kind of structure found, we create a similarity group.
If we had four IRSimilarityCandidates A, B, C, and D where A, B and D are structurally similar to one another, while C is different we would have two SimilarityGroups:
SimilarityGroup 1: SimilarityGroup 2 A, B, D C
A list of the different similarity groups is then returned after analyzing the module.
Definition at line 1044 of file IRSimilarityIdentifier.h.
|
inline |
Definition at line 1046 of file IRSimilarityIdentifier.h.
SimilarityGroupList & IRSimilarityIdentifier::findSimilarity | ( | ArrayRef< std::unique_ptr< Module > > | Modules | ) |
Definition at line 1450 of file IRSimilarityIdentifier.cpp.
References llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableBranches, llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableIndirectCalls, llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableIntrinsics, llvm::IRSimilarity::IRInstructionMapper::EnableMatchCallsByName, llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableMustTailCalls, llvm::IRSimilarity::IRInstructionMapper::InstClassifier, and resetSimilarityCandidates().
SimilarityGroupList & IRSimilarityIdentifier::findSimilarity | ( | Module & | M | ) |
Definition at line 1468 of file IRSimilarityIdentifier.cpp.
References llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableBranches, llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableIndirectCalls, llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableIntrinsics, llvm::IRSimilarity::IRInstructionMapper::EnableMatchCallsByName, llvm::IRSimilarity::IRInstructionMapper::InstructionClassification::EnableMustTailCalls, llvm::IRSimilarity::IRInstructionMapper::InstClassifier, and resetSimilarityCandidates().
|
inline |
Definition at line 1116 of file IRSimilarityIdentifier.h.
Referenced by llvm::IRSimilarityAnalysisPrinterPass::run().
|
inline |
Definition at line 1104 of file IRSimilarityIdentifier.h.
Referenced by findSimilarity().