LLVM  15.0.0git
Public Member Functions | List of all members
llvm::IRSimilarity::IRSimilarityIdentifier Class Reference

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)
 
SimilarityGroupListfindSimilarity (ArrayRef< std::unique_ptr< Module >> Modules)
 
SimilarityGroupListfindSimilarity (Module &M)
 
void resetSimilarityCandidates ()
 
Optional< SimilarityGroupList > & getSimilarity ()
 

Detailed Description

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 978 of file IRSimilarityIdentifier.h.

Constructor & Destructor Documentation

◆ IRSimilarityIdentifier()

llvm::IRSimilarity::IRSimilarityIdentifier::IRSimilarityIdentifier ( bool  MatchBranches = true,
bool  MatchIndirectCalls = true,
bool  MatchCallsWithName = false,
bool  MatchIntrinsics = true,
bool  MatchMustTailCalls = true 
)
inline

Definition at line 980 of file IRSimilarityIdentifier.h.

Member Function Documentation

◆ findSimilarity() [1/2]

SimilarityGroupList & IRSimilarityIdentifier::findSimilarity ( ArrayRef< std::unique_ptr< Module >>  Modules)

◆ findSimilarity() [2/2]

SimilarityGroupList & IRSimilarityIdentifier::findSimilarity ( Module M)

◆ getSimilarity()

Optional<SimilarityGroupList>& llvm::IRSimilarity::IRSimilarityIdentifier::getSimilarity ( )
inline

◆ resetSimilarityCandidates()

void llvm::IRSimilarity::IRSimilarityIdentifier::resetSimilarityCandidates ( )
inline

Definition at line 1038 of file IRSimilarityIdentifier.h.

Referenced by findSimilarity().


The documentation for this class was generated from the following files: