LLVM API Documentation

Classes | Public Member Functions | Protected Member Functions | Protected Attributes
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.

Classes

class  Node

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)
void InsertNode (Node *N)
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 (Node *N, FoldingSetNodeID &ID) const =0
virtual bool NodeEquals (Node *N, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID) const =0
virtual unsigned ComputeNodeHash (Node *N, FoldingSetNodeID &TempID) const =0

Protected Attributes

void ** Buckets
unsigned NumBuckets
unsigned NumNodes

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 111 of file FoldingSet.h.


Constructor & Destructor Documentation

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

Definition at line 225 of file FoldingSet.cpp.

References AllocateBuckets(), Buckets, NumBuckets, and NumNodes.

Definition at line 232 of file FoldingSet.cpp.

References Buckets, and llvm::LibFunc::free.


Member Function Documentation

clear - Remove all nodes from the folding set.

Definition at line 235 of file FoldingSet.cpp.

References Buckets, llvm::LibFunc::memset, NumBuckets, and NumNodes.

Referenced by llvm::SelectionDAG::clear(), and llvm::ScalarEvolution::releaseMemory().

virtual unsigned llvm::FoldingSetImpl::ComputeNodeHash ( Node N,
FoldingSetNodeID TempID 
) const [protected, pure virtual]

ComputeNodeHash - Instantiations of the FoldingSet template implement this function to compute a hash value for the given node.

Referenced by InsertNode().

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

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

Definition at line 181 of file FoldingSet.h.

References NumNodes.

Referenced by llvm::LLVMContextImpl::~LLVMContextImpl().

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

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

Referenced by GetOrInsertNode().

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::ContextualFoldingSet< T, Ctx >, llvm::FoldingSet< T >, llvm::FoldingSet< DIEAbbrev >, llvm::FoldingSet< SDNode >, llvm::FoldingSet< MDNode >, llvm::FoldingSet< AttributeSetNode >, llvm::FoldingSet< AttributeSetImpl >, llvm::FoldingSet< ListTy >, llvm::FoldingSet< SDVTListNode >, llvm::FoldingSet< SCEV >, and llvm::FoldingSet< AttributeImpl >.

Definition at line 377 of file FoldingSet.cpp.

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

Referenced by InsertNode().

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 307 of file FoldingSet.cpp.

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

Referenced by llvm::ImmutableListFactory< T >::concat(), llvm::Attribute::get(), llvm::AttributeSetNode::get(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::SelectionDAG::getAddrSpaceCast(), llvm::SelectionDAG::getAtomic(), llvm::SelectionDAG::getBasicBlock(), llvm::SelectionDAG::getBlockAddress(), llvm::SelectionDAG::getConstant(), llvm::ScalarEvolution::getConstant(), llvm::SelectionDAG::getConstantFP(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getConvertRndSat(), llvm::SelectionDAG::getEHLabel(), llvm::SelectionDAG::getFrameIndex(), llvm::SelectionDAG::getGlobalAddress(), llvm::SelectionDAG::getIndexedStore(), llvm::SelectionDAG::getJumpTable(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getMachineNode(), llvm::SelectionDAG::getMDNode(), llvm::SelectionDAG::getMemIntrinsicNode(), llvm::ScalarEvolution::getMulExpr(), llvm::SelectionDAG::getNode(), GetOrInsertNode(), llvm::SelectionDAG::getRegister(), llvm::SelectionDAG::getRegisterMask(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::getSMaxExpr(), llvm::SelectionDAG::getSrcValue(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTargetIndex(), llvm::ScalarEvolution::getTruncateExpr(), llvm::SelectionDAG::getTruncStore(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getUMaxExpr(), llvm::ScalarEvolution::getUnknown(), llvm::SelectionDAG::getVectorShuffle(), llvm::SelectionDAG::getVTList(), llvm::ScalarEvolution::getZeroExtendExpr(), llvm::SelectionDAG::MorphNodeTo(), and llvm::SelectionDAG::UpdateNodeOperands().

void llvm::FoldingSetImpl::InsertNode ( Node N) [inline]

InsertNode - Insert the specified node into the folding set, knowing that it is not already in the folding set.

Definition at line 171 of file FoldingSet.h.

References GetOrInsertNode().

virtual bool llvm::FoldingSetImpl::NodeEquals ( Node N,
const FoldingSetNodeID ID,
unsigned  IDHash,
FoldingSetNodeID TempID 
) const [protected, pure virtual]

NodeEquals - Instantiations of the FoldingSet template implement this function to compare the given node with the given ID.

Referenced by FindNodeOrInsertPos().

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 336 of file FoldingSet.cpp.

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

Referenced by llvm::MDNode::deleteTemporary().

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

Definition at line 178 of file FoldingSet.h.

References NumNodes.

Referenced by llvm::LLVMContextImpl::~LLVMContextImpl().


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 123 of file FoldingSet.h.

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


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