LLVM  8.0.1
Classes | Public Member Functions | List of all members
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. More...
 
void insert (typename Info::key_type_ref Key, typename Info::data_type_ref Data, Info &InfoObj)
 Insert an entry into the table. More...
 
bool contains (typename Info::key_type_ref Key, Info &InfoObj)
 Determine whether an entry has been inserted. More...
 
offset_type Emit (raw_ostream &Out)
 Emit the table to Out, which must not be at offset 0. More...
 
offset_type Emit (raw_ostream &Out, Info &InfoObj)
 Emit the table to Out, which must not be at offset 0. More...
 
 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);
};

Definition at line 59 of file OnDiskHashTable.h.

Constructor & Destructor Documentation

◆ OnDiskChainedHashTableGenerator()

Definition at line 225 of file OnDiskHashTable.h.

References llvm::safe_calloc().

◆ ~OnDiskChainedHashTableGenerator()

Definition at line 233 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 134 of file OnDiskHashTable.h.

References I.

◆ 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 143 of file OnDiskHashTable.h.

References Info.

Referenced by setSummary().

◆ 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 151 of file OnDiskHashTable.h.

References assert(), B, I, llvm::AArch64CC::LE, llvm::support::little, llvm::NextPowerOf2(), llvm::raw_ostream::tell(), and llvm::support::endian::Writer::write().

◆ 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 116 of file OnDiskHashTable.h.

References Info.

◆ 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 125 of file OnDiskHashTable.h.

References llvm::SpecificBumpPtrAllocator< T >::Allocate().


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