LLVM 22.0.0git
|
#include "llvm/CGData/StableFunctionMap.h"
Classes | |
struct | EntryStorage |
In addition to the deserialized StableFunctionEntry, the struct stores the offsets of corresponding serialized stable function entries, and a once flag for safe lazy loading in a multithreaded environment. More... | |
struct | StableFunctionEntry |
An efficient form of StableFunction for fast look-up. More... |
Public Types | |
enum | SizeType { UniqueHashCount , TotalFunctionCount , MergeableFunctionCount } |
using | StableFunctionEntries |
using | HashFuncsMapType = std::unordered_map<stable_hash, EntryStorage> |
Public Member Functions | |
const HashFuncsMapType & | getFunctionMap () const |
Get the HashToFuncs map for serialization. | |
ArrayRef< std::string > | getNames () const |
Get the NameToId vector for serialization. | |
LLVM_ABI unsigned | getIdOrCreateForName (StringRef Name) |
Get an existing ID associated with the given name or create a new ID if it doesn't exist. | |
LLVM_ABI std::optional< std::string > | getNameForId (unsigned Id) const |
Get the name associated with a given ID. | |
LLVM_ABI void | insert (const StableFunction &Func) |
Insert a StableFunction object into the function map. | |
LLVM_ABI void | merge (const StableFunctionMap &OtherMap) |
Merge a OtherMap into this function map. | |
bool | empty () const |
bool | contains (HashFuncsMapType::key_type FunctionHash) const |
const StableFunctionEntries & | at (HashFuncsMapType::key_type FunctionHash) const |
LLVM_ABI size_t | size (SizeType Type=UniqueHashCount) const |
LLVM_ABI void | finalize (bool SkipTrim=false) |
Finalize the stable function map by trimming content. |
Friends | |
struct | StableFunctionMapRecord |
Definition at line 55 of file StableFunctionMap.h.
using llvm::StableFunctionMap::HashFuncsMapType = std::unordered_map<stable_hash, EntryStorage> |
Definition at line 105 of file StableFunctionMap.h.
Definition at line 78 of file StableFunctionMap.h.
Enumerator | |
---|---|
UniqueHashCount | |
TotalFunctionCount | |
MergeableFunctionCount |
Definition at line 144 of file StableFunctionMap.h.
const StableFunctionMap::StableFunctionEntries & StableFunctionMap::at | ( | HashFuncsMapType::key_type | FunctionHash | ) | const |
Definition at line 138 of file StableFunctionMap.cpp.
Referenced by llvm::GlobalMergeFunc::merge().
|
inline |
Definition at line 133 of file StableFunctionMap.h.
Referenced by llvm::GlobalMergeFunc::merge().
|
inline |
Definition at line 129 of file StableFunctionMap.h.
References size().
void StableFunctionMap::finalize | ( | bool | SkipTrim = false | ) |
Finalize the stable function map by trimming content.
Definition at line 242 of file StableFunctionMap.cpp.
References assert(), llvm::SmallVectorImpl< T >::erase(), getNameForId(), I, llvm::Invalid, isProfitable(), P, llvm::SmallVectorTemplateBase< T, bool >::push_back(), removeIdenticalIndexPair(), and llvm::stable_sort().
const StableFunctionMap::HashFuncsMapType & StableFunctionMap::getFunctionMap | ( | ) | const |
Get the HashToFuncs map for serialization.
Definition at line 166 of file StableFunctionMap.cpp.
Referenced by getStableFunctionEntries().
std::optional< std::string > StableFunctionMap::getNameForId | ( | unsigned | Id | ) | const |
Get the name associated with a given ID.
Definition at line 76 of file StableFunctionMap.cpp.
Referenced by finalize(), getStableFunctionEntries(), and merge().
|
inline |
Get the NameToId vector for serialization.
Definition at line 111 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 82 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 95 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 114 of file StableFunctionMap.cpp.
References llvm::Count, llvm_unreachable, MergeableFunctionCount, TotalFunctionCount, and UniqueHashCount.
Referenced by empty().
|
friend |
Definition at line 190 of file StableFunctionMap.h.
References StableFunctionMapRecord.
Referenced by StableFunctionMapRecord.