LLVM API Documentation

llvm::FoldingSetImpl Class Reference

#include <FoldingSet.h>

Inheritance diagram for llvm::FoldingSetImpl:

Inheritance graph
[legend]
Collaboration diagram for llvm::FoldingSetImpl:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 FoldingSetImpl (unsigned Log2InitSize=6)
virtual ~FoldingSetImpl ()
void clear ()
 clear - Remove all nodes from the folding set.
bool RemoveNode (Node *N)
NodeGetOrInsertNode (Node *N)
NodeFindNodeOrInsertPos (const FoldingSetNodeID &ID, void *&InsertPos)
void InsertNode (Node *N, void *InsertPos)
unsigned size () const
 size - Returns the number of nodes in the folding set.
bool empty () const
 empty - Returns true if there are no nodes in the folding set.

Protected Member Functions

virtual void GetNodeProfile (FoldingSetNodeID &ID, Node *N) const =0

Protected Attributes

void ** Buckets
unsigned NumBuckets
unsigned NumNodes

Classes

class  Node


Detailed Description

FoldingSetImpl - Implements the folding set functionality. The main structure is an array of buckets. Each bucket is indexed by the hash of the nodes it contains. The bucket itself points to the nodes contained in the bucket via a singly linked list. The last node in the list points back to the bucket to facilitate node removal.

Definition at line 110 of file FoldingSet.h.


Constructor & Destructor Documentation

FoldingSetImpl::FoldingSetImpl ( unsigned  Log2InitSize = 6  )  [explicit]

Definition at line 213 of file FoldingSet.cpp.

References Buckets, clear(), and NumBuckets.

FoldingSetImpl::~FoldingSetImpl (  )  [virtual]

Definition at line 220 of file FoldingSet.cpp.

References Buckets.


Member Function Documentation

void FoldingSetImpl::clear (  ) 

clear - Remove all nodes from the folding set.

Definition at line 223 of file FoldingSet.cpp.

References Buckets, NumBuckets, and NumNodes.

Referenced by FoldingSetImpl().

bool FoldingSetImpl::RemoveNode ( Node N  ) 

RemoveNode - Remove a node from the folding set, returning true if one was removed or false if the node was not in the folding set.

RemoveNode - Remove a node from the folding set, returning true if one was removed or false if the node was not in the folding set.

Definition at line 325 of file FoldingSet.cpp.

References GetBucketPtr(), llvm::FoldingSetImpl::Node::getNextInBucket(), GetNextPtr(), NumNodes, and llvm::FoldingSetImpl::Node::SetNextInBucket().

FoldingSetImpl::Node * FoldingSetImpl::GetOrInsertNode ( FoldingSetImpl::Node N  ) 

GetOrInsertNode - If there is an existing simple Node exactly equal to the specified node, return it. Otherwise, insert 'N' and return it instead.

GetOrInsertNode - If there is an existing simple Node exactly equal to the specified node, return it. Otherwise, insert 'N' and it instead.

Reimplemented in llvm::FoldingSet< T >, llvm::FoldingSet< llvm::ImutAVLTree >, llvm::FoldingSet< llvm::SDNode >, and llvm::FoldingSet< llvm::ImmutableListImpl >.

Definition at line 366 of file FoldingSet.cpp.

References E, FindNodeOrInsertPos(), GetNodeProfile(), and InsertNode().

Referenced by llvm::FoldingSet< llvm::ImmutableListImpl >::GetOrInsertNode().

FoldingSetImpl::Node * FoldingSetImpl::FindNodeOrInsertPos ( const FoldingSetNodeID ID,
void *&  InsertPos 
)

FindNodeOrInsertPos - Look up the node specified by ID. If it exists, return it. If not, return the insertion token that will make insertion faster.

FindNodeOrInsertPos - Look up the node specified by ID. If it exists, return it. If not, return the insertion token that will make insertion faster.

Reimplemented in llvm::FoldingSet< T >, llvm::FoldingSet< llvm::ImutAVLTree >, llvm::FoldingSet< llvm::SDNode >, and llvm::FoldingSet< llvm::ImmutableListImpl >.

Definition at line 269 of file FoldingSet.cpp.

References Buckets, llvm::FoldingSetNodeID::clear(), GetBucketFor(), GetNextPtr(), GetNodeProfile(), and NumBuckets.

Referenced by llvm::FoldingSet< llvm::ImmutableListImpl >::FindNodeOrInsertPos(), and GetOrInsertNode().

void FoldingSetImpl::InsertNode ( Node N,
void *  InsertPos 
)

InsertNode - Insert the specified node into the folding set, knowing that it is not already in the folding set. InsertPos must be obtained from FindNodeOrInsertPos.

InsertNode - Insert the specified node into the folding set, knowing that it is not already in the map. InsertPos must be obtained from FindNodeOrInsertPos.

The insert position is actually a bucket pointer.

Definition at line 295 of file FoldingSet.cpp.

References Buckets, GetBucketFor(), llvm::FoldingSetImpl::Node::getNextInBucket(), GetNodeProfile(), Next, NumBuckets, NumNodes, and llvm::FoldingSetImpl::Node::SetNextInBucket().

Referenced by GetOrInsertNode().

unsigned llvm::FoldingSetImpl::size (  )  const [inline]

size - Returns the number of nodes in the folding set.

Definition at line 169 of file FoldingSet.h.

References NumNodes.

bool llvm::FoldingSetImpl::empty (  )  const [inline]

empty - Returns true if there are no nodes in the folding set.

Definition at line 172 of file FoldingSet.h.

References NumNodes.

virtual void llvm::FoldingSetImpl::GetNodeProfile ( FoldingSetNodeID ID,
Node N 
) const [protected, pure virtual]

GetNodeProfile - Instantiations of the FoldingSet template implement this function to gather data bits for the given node.

Referenced by FindNodeOrInsertPos(), GetOrInsertNode(), and InsertNode().


Member Data Documentation

void** llvm::FoldingSetImpl::Buckets [protected]

NumNodes - Number of nodes in the folding set. Growth occurs when NumNodes is greater than twice the number of buckets.

Definition at line 122 of file FoldingSet.h.

Referenced by clear(), empty(), InsertNode(), RemoveNode(), and size().


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



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.