LLVM 22.0.0git
llvm::OnDiskChainedHashTableGenerator< Info > Class Template Reference

Generates an on disk hash table. More...

#include "llvm/Support/OnDiskHashTable.h"

Public Member Functions

void insert (typename Info::key_type_ref Key, typename Info::data_type_ref Data)
 Insert an entry into the table.
void insert (typename Info::key_type_ref Key, typename Info::data_type_ref Data, Info &InfoObj)
 Insert an entry into the table.
bool contains (typename Info::key_type_ref Key, Info &InfoObj)
 Determine whether an entry has been inserted.
offset_type Emit (raw_ostream &Out)
 Emit the table to Out, which must not be at offset 0.
offset_type Emit (raw_ostream &Out, Info &InfoObj)
 Emit the table to Out, which must not be at offset 0.
 OnDiskChainedHashTableGenerator ()
 ~OnDiskChainedHashTableGenerator ()

Detailed Description

template<typename Info>
class llvm::OnDiskChainedHashTableGenerator< Info >

Generates an on disk hash table.

This needs an Info that handles storing values into the hash table's payload and computes the hash for a given key. This should provide the following interface:

class ExampleInfo {
public:
typedef ExampleKey key_type; // Must be copy constructible
typedef ExampleKey &key_type_ref;
typedef ExampleData data_type; // Must be copy constructible
typedef ExampleData &data_type_ref;
typedef uint32_t hash_value_type; // The type the hash function returns.
typedef uint32_t offset_type; // The type for offsets into the table.
/// Calculate the hash for Key
static hash_value_type ComputeHash(key_type_ref Key);
/// Return the lengths, in bytes, of the given Key/Data pair.
static std::pair<offset_type, offset_type>
EmitKeyDataLength(raw_ostream &Out, key_type_ref Key, data_type_ref Data);
/// Write Key to Out. KeyLen is the length from EmitKeyDataLength.
static void EmitKey(raw_ostream &Out, key_type_ref Key,
offset_type KeyLen);
/// Write Data to Out. DataLen is the length from EmitKeyDataLength.
static void EmitData(raw_ostream &Out, key_type_ref Key,
data_type_ref Data, offset_type DataLen);
/// Determine if two keys are equal. Optional, only needed by contains.
static bool EqualKey(key_type_ref Key1, key_type_ref Key2);
};
InstrProfLookupTrait::offset_type offset_type
InstrProfLookupTrait::data_type data_type
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:189

Definition at line 58 of file OnDiskHashTable.h.

Constructor & Destructor Documentation

◆ OnDiskChainedHashTableGenerator()

template<typename Info>
llvm::OnDiskChainedHashTableGenerator< Info >::OnDiskChainedHashTableGenerator ( )
inline

Definition at line 224 of file OnDiskHashTable.h.

References llvm::safe_calloc().

◆ ~OnDiskChainedHashTableGenerator()

Definition at line 232 of file OnDiskHashTable.h.

Member Function Documentation

◆ contains()

template<typename Info>
bool llvm::OnDiskChainedHashTableGenerator< Info >::contains ( typename Info::key_type_ref Key,
Info & InfoObj )
inline

Determine whether an entry has been inserted.

Definition at line 133 of file OnDiskHashTable.h.

References I, Info, and llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key.

◆ Emit() [1/2]

template<typename Info>
offset_type llvm::OnDiskChainedHashTableGenerator< Info >::Emit ( raw_ostream & Out)
inline

Emit the table to Out, which must not be at offset 0.

Definition at line 142 of file OnDiskHashTable.h.

References Emit(), and Info.

Referenced by Emit(), llvm::writeMemProfCallStacks(), llvm::writeMemProfFrames(), and llvm::writeMemProfRecords().

◆ Emit() [2/2]

template<typename Info>
offset_type llvm::OnDiskChainedHashTableGenerator< Info >::Emit ( raw_ostream & Out,
Info & InfoObj )
inline

Emit the table to Out, which must not be at offset 0.

Uses the provided Info instead of a stack allocated one.

Definition at line 150 of file OnDiskHashTable.h.

References assert(), B(), llvm::bit_ceil(), I, Info, llvm::little, N, llvm::offsetToAlignment(), and llvm::raw_ostream::tell().

◆ insert() [1/2]

template<typename Info>
void llvm::OnDiskChainedHashTableGenerator< Info >::insert ( typename Info::key_type_ref Key,
typename Info::data_type_ref Data )
inline

Insert an entry into the table.

Definition at line 115 of file OnDiskHashTable.h.

References llvm::Data, Info, and llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key.

◆ insert() [2/2]

template<typename Info>
void llvm::OnDiskChainedHashTableGenerator< Info >::insert ( typename Info::key_type_ref Key,
typename Info::data_type_ref Data,
Info & InfoObj )
inline

Insert an entry into the table.

Uses the provided Info instead of a stack allocated one.

Definition at line 124 of file OnDiskHashTable.h.

References llvm::Data, Info, and llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key.


The documentation for this class was generated from the following file: