LLVM  14.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)
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 883 of file IRSimilarityIdentifier.h.

Constructor & Destructor Documentation

◆ IRSimilarityIdentifier()

llvm::IRSimilarity::IRSimilarityIdentifier::IRSimilarityIdentifier ( bool  MatchBranches = true)

Definition at line 885 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 ( )

◆ resetSimilarityCandidates()

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

Definition at line 936 of file IRSimilarityIdentifier.h.

References llvm::Optional< T >::hasValue().

Referenced by findSimilarity().

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