14#ifndef LLVM_TRANSFORMS_UTILS_FUNCTIONCOMPARATOR_H
15#define LLVM_TRANSFORMS_UTILS_FUNCTIONCOMPARATOR_H
56 enum { FollowRAUW =
false };
74 std::tie(MapIter, Inserted) = GlobalNumbers.
insert({
Global, NextNumber});
85 GlobalNumbers.
clear();
97 :
FnL(F1),
FnR(F2), GlobalNumbers(GN) {}
278 bool &needToCmpOperands)
const;
335 int cmpRangeMetadata(
const MDNode *L,
const MDNode *R)
const;
336 int cmpOperandBundlesSchema(
const CallBase &LCS,
const CallBase &RCS)
const;
349 return cmpGEPs(cast<GEPOperator>(GEPL), cast<GEPOperator>(GEPR));
Atomic ordering constants.
This file defines the DenseMap class.
Class for arbitrary precision integers.
LLVM Basic Block Representation.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This is an important base class in LLVM.
FunctionComparator - Compares two functions to determine whether or not they will generate machine co...
FunctionComparator(const Function *F1, const Function *F2, GlobalNumberState *GN)
int cmpBasicBlocks(const BasicBlock *BBL, const BasicBlock *BBR) const
Test whether two basic blocks have equivalent behaviour.
int compareSignature() const
Compares the signature and other general attributes of the two functions.
int cmpMem(StringRef L, StringRef R) const
int compare()
Test whether the two functions have equivalent behaviour.
int cmpAPFloats(const APFloat &L, const APFloat &R) const
static FunctionHash functionHash(Function &)
int cmpTypes(Type *TyL, Type *TyR) const
cmpType - compares two types, defines total ordering among the types set.
int cmpOperations(const Instruction *L, const Instruction *R, bool &needToCmpOperands) const
Compare two Instructions for equivalence, similar to Instruction::isSameOperationAs.
int cmpNumbers(uint64_t L, uint64_t R) const
int cmpAligns(Align L, Align R) const
void beginCompare()
Start the comparison.
int cmpValues(const Value *L, const Value *R) const
Assign or look up previously assigned numbers for the two values, and return whether the numbers are ...
int cmpGlobalValues(GlobalValue *L, GlobalValue *R) const
Compares two global values by number.
int cmpConstants(const Constant *L, const Constant *R) const
Constants comparison.
int cmpAPInts(const APInt &L, const APInt &R) const
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
GlobalNumberState assigns an integer to each global value in the program, which is used by the compar...
GlobalNumberState()=default
void erase(GlobalValue *Global)
uint64_t getNumber(GlobalValue *Global)
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
bool erase(const KeyT &Val)
LLVM Value Representation.
@ BasicBlock
Various leaf nodes.
This is an optimization pass for GlobalISel generic memory operations.
@ Global
Append to llvm.global_dtors.
AtomicOrdering
Atomic ordering for LLVM's memory model.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This class defines the default behavior for configurable aspects of ValueMap<>.