LLVM 20.0.0git
Classes | Typedefs | Enumerations | Functions
llvm::IRSimilarity Namespace Reference

Classes

struct  IRInstructionData
 This provides the utilities for hashing an Instruction to an unsigned integer. More...
 
struct  IRInstructionDataList
 
struct  IRInstructionDataTraits
 
struct  IRInstructionMapper
 Helper struct for converting the Instructions in a Module into a vector of unsigned integers. More...
 
class  IRSimilarityCandidate
 This is a class that wraps a range of IRInstructionData from one point to another in the vector of IRInstructionData, which is a region of the program. More...
 
class  IRSimilarityIdentifier
 This class puts all the pieces of the IRInstructionData, IRInstructionMapper, IRSimilarityCandidate together. More...
 

Typedefs

typedef DenseMap< IRSimilarityCandidate *, DenseMap< unsigned, DenseSet< unsigned > > > CandidateGVNMapping
 
typedef std::vector< IRSimilarityCandidateSimilarityGroup
 
typedef std::vector< SimilarityGroupSimilarityGroupList
 

Enumerations

enum  InstrType { Legal , Illegal , Invisible }
 This represents what is and is not supported when finding similarity in Instructions. More...
 

Functions

bool isClose (const IRInstructionData &A, const IRInstructionData &B)
 Compare one IRInstructionData class to another IRInstructionData class for whether they are performing a the same operation, and can mapped to the same value.
 

Typedef Documentation

◆ CandidateGVNMapping

Definition at line 1018 of file IRSimilarityIdentifier.h.

◆ SimilarityGroup

Definition at line 1019 of file IRSimilarityIdentifier.h.

◆ SimilarityGroupList

Definition at line 1020 of file IRSimilarityIdentifier.h.

Enumeration Type Documentation

◆ InstrType

This represents what is and is not supported when finding similarity in Instructions.

Legal Instructions are considered when looking at similarity between Instructions.

Illegal Instructions cannot be considered when looking for similarity between Instructions. They act as boundaries between similarity regions.

Invisible Instructions are skipped over during analysis.

Enumerator
Legal 
Illegal 
Invisible 

Definition at line 77 of file IRSimilarityIdentifier.h.

Function Documentation

◆ isClose()

bool llvm::IRSimilarity::isClose ( const IRInstructionData A,
const IRInstructionData B 
)

Compare one IRInstructionData class to another IRInstructionData class for whether they are performing a the same operation, and can mapped to the same value.

For regular instructions if the hash value is the same, then they will also be close.

Parameters
A- The first IRInstructionData class to compare
B- The second IRInstructionData class to compare
Returns
true if A and B are similar enough to be mapped to the same value.

Definition at line 221 of file IRSimilarityIdentifier.cpp.

References A, llvm::all_of(), B, llvm::drop_begin(), GEP, and llvm::zip().

Referenced by llvm::IRSimilarity::IRSimilarityCandidate::compareStructure(), llvm::IRSimilarity::IRInstructionDataTraits::isEqual(), and llvm::IRSimilarity::IRSimilarityCandidate::isSimilar().