LLVM API Documentation
#include <FoldingSet.h>
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) |
Node * | GetOrInsertNode (Node *N) |
Node * | FindNodeOrInsertPos (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 |
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.
FoldingSetImpl::FoldingSetImpl | ( | unsigned | Log2InitSize = 6 | ) | [explicit] |
Definition at line 225 of file FoldingSet.cpp.
References AllocateBuckets(), Buckets, NumBuckets, and NumNodes.
FoldingSetImpl::~FoldingSetImpl | ( | ) | [virtual] |
Definition at line 232 of file FoldingSet.cpp.
References Buckets, and llvm::LibFunc::free.
void FoldingSetImpl::clear | ( | ) |
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().
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.
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 282 of file FoldingSet.cpp.
References Buckets, llvm::FoldingSetNodeID::clear(), llvm::FoldingSetNodeID::ComputeHash(), GetBucketFor(), GetNextPtr(), NodeEquals(), and NumBuckets.
Referenced by GetOrInsertNode().
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().
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.
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().
unsigned llvm::FoldingSetImpl::size | ( | ) | const [inline] |
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().
void** llvm::FoldingSetImpl::Buckets [protected] |
Buckets - Array of bucket chains.
Definition at line 115 of file FoldingSet.h.
Referenced by llvm::FoldingSet< AttributeImpl >::begin(), llvm::ContextualFoldingSet< T, Ctx >::begin(), llvm::FoldingSet< AttributeImpl >::bucket_begin(), llvm::ContextualFoldingSet< T, Ctx >::bucket_begin(), llvm::FoldingSet< AttributeImpl >::bucket_end(), llvm::ContextualFoldingSet< T, Ctx >::bucket_end(), clear(), llvm::FoldingSet< AttributeImpl >::end(), llvm::ContextualFoldingSet< T, Ctx >::end(), FindNodeOrInsertPos(), FoldingSetImpl(), InsertNode(), and ~FoldingSetImpl().
unsigned llvm::FoldingSetImpl::NumBuckets [protected] |
NumBuckets - Length of the Buckets array. Always a power of 2.
Definition at line 119 of file FoldingSet.h.
Referenced by llvm::FoldingSet< AttributeImpl >::bucket_begin(), llvm::ContextualFoldingSet< T, Ctx >::bucket_begin(), llvm::FoldingSet< AttributeImpl >::bucket_end(), llvm::ContextualFoldingSet< T, Ctx >::bucket_end(), clear(), llvm::FoldingSet< AttributeImpl >::end(), llvm::ContextualFoldingSet< T, Ctx >::end(), FindNodeOrInsertPos(), FoldingSetImpl(), and InsertNode().
unsigned llvm::FoldingSetImpl::NumNodes [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().