16#ifndef LLVM_CGDATA_STABLEFUNCTIONMAP_H
17#define LLVM_CGDATA_STABLEFUNCTIONMAP_H
88 std::optional<std::string>
getNameForId(
unsigned Id)
const;
113 void finalize(
bool SkipTrim =
false);
119 void insert(std::unique_ptr<StableFunctionEntry> FuncEntry) {
120 assert(!Finalized &&
"Cannot insert after finalization");
121 HashToFuncs[FuncEntry->Hash].emplace_back(std::move(FuncEntry));
127 SmallVector<std::string> IdToName;
129 StringMap<unsigned> NameToId;
131 bool Finalized =
false;
This file defines the StringMap class.
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
This is an optimization pass for GlobalISel generic memory operations.
std::pair< IndexPair, stable_hash > IndexPairHash
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
An efficient form of StableFunction for fast look-up.
StableFunctionEntry(stable_hash Hash, unsigned FunctionNameId, unsigned ModuleNameId, unsigned InstCount, std::unique_ptr< IndexOperandHashMapType > IndexOperandHashMap)
stable_hash Hash
The combined stable hash of the function.
std::unique_ptr< IndexOperandHashMapType > IndexOperandHashMap
A map from an IndexPair to a stable_hash which was skipped.
unsigned InstCount
The number of instructions.
unsigned FunctionNameId
Id of the function name.
unsigned ModuleNameId
Id of the module name.
size_t size(SizeType Type=UniqueHashCount) const
void insert(const StableFunction &Func)
Insert a StableFunction object into the function map.
const SmallVector< std::string > getNames() const
Get the NameToId vector for serialization.
const HashFuncsMapType & getFunctionMap() const
Get the HashToFuncs map for serialization.
void merge(const StableFunctionMap &OtherMap)
Merge a OtherMap into this function map.
std::optional< std::string > getNameForId(unsigned Id) const
Get the name associated with a given ID.
unsigned getIdOrCreateForName(StringRef Name)
Get an existing ID associated with the given name or create a new ID if it doesn't exist.
DenseMap< stable_hash, SmallVector< std::unique_ptr< StableFunctionEntry > > > HashFuncsMapType
A stable function is a function with a stable hash while tracking the locations of ignored operands a...
unsigned InstCount
The number of instructions.
StableFunction(stable_hash Hash, const std::string FunctionName, const std::string ModuleName, unsigned InstCount, IndexOperandHashVecType &&IndexOperandHashes)
stable_hash Hash
The combined stable hash of the function.
IndexOperandHashVecType IndexOperandHashes
A vector of pairs of IndexPair and operand hash which was skipped.
std::string FunctionName
The name of the function.
std::string ModuleName
The name of the module the function is in.