LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Friends | List of all members
llvm::StableFunctionMap Struct Reference

#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 HashFuncsMapTypegetFunctionMap () 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
 

Detailed Description

Definition at line 51 of file StableFunctionMap.h.

Member Typedef Documentation

◆ HashFuncsMapType

Definition at line 74 of file StableFunctionMap.h.

Member Enumeration Documentation

◆ SizeType

Enumerator
UniqueHashCount 
TotalFunctionCount 
MergeableFunctionCount 

Definition at line 101 of file StableFunctionMap.h.

Member Function Documentation

◆ empty()

bool llvm::StableFunctionMap::empty ( ) const
inline
Returns
true if there is no stable function entry.

Definition at line 99 of file StableFunctionMap.h.

References size().

◆ finalize()

void StableFunctionMap::finalize ( bool  SkipTrim = false)

◆ getFunctionMap()

const HashFuncsMapType & llvm::StableFunctionMap::getFunctionMap ( ) const
inline

Get the HashToFuncs map for serialization.

Definition at line 78 of file StableFunctionMap.h.

Referenced by getStableFunctionEntries(), and llvm::GlobalMergeFunc::merge().

◆ getIdOrCreateForName()

unsigned StableFunctionMap::getIdOrCreateForName ( StringRef  Name)

◆ getNameForId()

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().

◆ getNames()

const SmallVector< std::string > llvm::StableFunctionMap::getNames ( ) const
inline

Get the NameToId vector for serialization.

Definition at line 81 of file StableFunctionMap.h.

◆ insert()

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().

◆ merge()

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()

size_t StableFunctionMap::size ( SizeType  Type = UniqueHashCount) const

Friends And Related Function Documentation

◆ StableFunctionMapRecord

friend struct StableFunctionMapRecord
friend

Definition at line 133 of file StableFunctionMap.h.


The documentation for this struct was generated from the following files: