LLVM 20.0.0git
|
#include "llvm/CGData/StableFunctionMap.h"
Classes | |
struct | StableFunctionEntry |
An efficient form of StableFunction for fast look-up. More... | |
Public Types | |
enum | SizeType { UniqueHashCount , TotalFunctionCount , MergeableFunctionCount } |
using | HashFuncsMapType = DenseMap< stable_hash, SmallVector< std::unique_ptr< StableFunctionEntry > > > |
Public Member Functions | |
const HashFuncsMapType & | getFunctionMap () const |
Get the HashToFuncs map for serialization. | |
const SmallVector< std::string > | getNames () const |
Get the NameToId vector for serialization. | |
unsigned | getIdOrCreateForName (StringRef Name) |
Get an existing ID associated with the given name or create a new ID if it doesn't exist. | |
std::optional< std::string > | getNameForId (unsigned Id) const |
Get the name associated with a given ID. | |
void | insert (const StableFunction &Func) |
Insert a StableFunction object into the function map. | |
void | merge (const StableFunctionMap &OtherMap) |
Merge a OtherMap into this function map. | |
bool | empty () const |
size_t | size (SizeType Type=UniqueHashCount) const |
void | finalize (bool SkipTrim=false) |
Finalize the stable function map by trimming content. | |
Friends | |
struct | StableFunctionMapRecord |
Definition at line 51 of file StableFunctionMap.h.
using llvm::StableFunctionMap::HashFuncsMapType = DenseMap<stable_hash, SmallVector<std::unique_ptr<StableFunctionEntry> >> |
Definition at line 74 of file StableFunctionMap.h.
Enumerator | |
---|---|
UniqueHashCount | |
TotalFunctionCount | |
MergeableFunctionCount |
Definition at line 101 of file StableFunctionMap.h.
|
inline |
Definition at line 99 of file StableFunctionMap.h.
References size().
void StableFunctionMap::finalize | ( | bool | SkipTrim = false | ) |
Finalize the stable function map by trimming content.
Definition at line 204 of file StableFunctionMap.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), I, llvm::Invalid, isProfitable(), P, and removeIdenticalIndexPair().
|
inline |
Get the HashToFuncs map for serialization.
Definition at line 78 of file StableFunctionMap.h.
Referenced by getStableFunctionEntries(), and llvm::GlobalMergeFunc::merge().
Get an existing ID associated with the given name or create a new ID if it doesn't exist.
Definition at line 64 of file StableFunctionMap.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), Name, llvm::SmallVectorBase< Size_T >::size(), and llvm::StringMapImpl::size().
std::optional< std::string > StableFunctionMap::getNameForId | ( | unsigned | Id | ) | const |
Get the name associated with a given ID.
Definition at line 75 of file StableFunctionMap.cpp.
References llvm::SmallVectorBase< Size_T >::size().
Referenced by merge().
|
inline |
Get the NameToId vector for serialization.
Definition at line 81 of file StableFunctionMap.h.
void StableFunctionMap::insert | ( | const StableFunction & | Func | ) |
Insert a StableFunction
object into the function map.
This method handles the uniquing of string names and create a StableFunctionEntry
for insertion.
Definition at line 81 of file StableFunctionMap.cpp.
References assert(), getIdOrCreateForName(), and insert().
Referenced by insert().
void StableFunctionMap::merge | ( | const StableFunctionMap & | OtherMap | ) |
Merge a OtherMap
into this function map.
Definition at line 94 of file StableFunctionMap.cpp.
References assert(), getIdOrCreateForName(), and getNameForId().
size_t StableFunctionMap::size | ( | SizeType | Type = UniqueHashCount | ) | const |
Type
is the type of size to return. Definition at line 112 of file StableFunctionMap.cpp.
References llvm_unreachable, MergeableFunctionCount, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), TotalFunctionCount, and UniqueHashCount.
Referenced by empty().
|
friend |
Definition at line 133 of file StableFunctionMap.h.