LLVM  6.0.0svn
FoldingSet.cpp File Reference
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstring>
Include dependency graph for FoldingSet.cpp:

Go to the source code of this file.


static FoldingSetBase::NodeGetNextPtr (void *NextInBucketPtr)
 Helper functions for FoldingSetBase. More...
static void ** GetBucketPtr (void *NextInBucketPtr)
 testing. More...
static void ** GetBucketFor (unsigned Hash, void **Buckets, unsigned NumBuckets)
 GetBucketFor - Hash the specified node ID and return the hash bucket for the specified ID. More...
static void ** AllocateBuckets (unsigned NumBuckets)
 AllocateBuckets - Allocated initialized bucket memory. More...

Function Documentation

◆ AllocateBuckets()

static void** AllocateBuckets ( unsigned  NumBuckets)

AllocateBuckets - Allocated initialized bucket memory.

Definition at line 216 of file FoldingSet.cpp.

References llvm::report_bad_alloc_error().

Referenced by llvm::FoldingSetBase::clear(), and llvm::FoldingSetBase::FoldingSetBase().

◆ GetBucketFor()

static void** GetBucketFor ( unsigned  Hash,
void **  Buckets,
unsigned  NumBuckets 

GetBucketFor - Hash the specified node ID and return the hash bucket for the specified ID.

Definition at line 209 of file FoldingSet.cpp.

Referenced by llvm::FoldingSetBase::clear(), llvm::FoldingSetBase::FindNodeOrInsertPos(), and llvm::FoldingSetBase::InsertNode().

◆ GetBucketPtr()

static void** GetBucketPtr ( void *  NextInBucketPtr)


Definition at line 201 of file FoldingSet.cpp.

References assert().

Referenced by llvm::FoldingSetIteratorImpl::advance(), and llvm::FoldingSetBase::RemoveNode().

◆ GetNextPtr()

static FoldingSetBase::Node* GetNextPtr ( void *  NextInBucketPtr)

Helper functions for FoldingSetBase.

GetNextPtr - In order to save space, each bucket is a singly-linked-list. In order to make deletion more efficient, we make the list circular, so we can delete a node without computing its hash. The problem with this is that the start of the hash buckets are not Nodes. If NextInBucketPtr is a bucket pointer, this method returns null: use GetBucketPtr when this happens.

Definition at line 191 of file FoldingSet.cpp.

Referenced by llvm::FoldingSetIteratorImpl::advance(), llvm::FoldingSetBase::clear(), llvm::FoldingSetBase::FindNodeOrInsertPos(), llvm::FoldingSetBucketIteratorImpl::FoldingSetBucketIteratorImpl(), llvm::FoldingSetIteratorImpl::FoldingSetIteratorImpl(), and llvm::FoldingSetBase::RemoveNode().