LLVM 22.0.0git
llvm::OutlinedHashTree Class Reference

#include "llvm/CGData/OutlinedHashTree.h"

Public Member Functions

LLVM_ABI void walkGraph (NodeCallbackFn CallbackNode, EdgeCallbackFn CallbackEdge=nullptr, bool SortedWalk=false) const
 Walks every edge and node in the OutlinedHashTree and calls CallbackEdge for the edges and CallbackNode for the nodes with the stable_hash for the source and the stable_hash of the sink for an edge.
void clear ()
 Release all hash nodes except the root hash node.
bool empty ()
LLVM_ABI size_t size (bool GetTerminalCountOnly=false) const
LLVM_ABI size_t depth () const
const HashNodegetRoot () const
HashNodegetRoot ()
LLVM_ABI void insert (const HashSequencePair &SequencePair)
 Inserts a Sequence into the this tree.
LLVM_ABI void merge (const OutlinedHashTree *OtherTree)
 Merge a OtherTree into this Tree.
LLVM_ABI std::optional< unsignedfind (const HashSequence &Sequence) const

Detailed Description

Definition at line 43 of file OutlinedHashTree.h.

Member Function Documentation

◆ clear()

void llvm::OutlinedHashTree::clear ( )
inline

Release all hash nodes except the root hash node.

Definition at line 63 of file OutlinedHashTree.h.

References assert(), getRoot(), and llvm::HashNode::Successors.

◆ depth()

size_t OutlinedHashTree::depth ( ) const
Returns
the depth of a OutlinedHashTree by traversing it.

Definition at line 59 of file OutlinedHashTree.cpp.

References llvm::Depth, N, Size, and walkGraph().

◆ empty()

bool llvm::OutlinedHashTree::empty ( )
inline
Returns
true if the hash tree has only the root node.

Definition at line 69 of file OutlinedHashTree.h.

References size().

◆ find()

std::optional< unsigned > OutlinedHashTree::find ( const HashSequence & Sequence) const
Returns
the matching count if Sequence exists in the OutlinedHashTree.

Definition at line 119 of file OutlinedHashTree.cpp.

References getRoot(), I, llvm::HashNode::Successors, and llvm::HashNode::Terminals.

◆ getRoot() [1/2]

HashNode * llvm::OutlinedHashTree::getRoot ( )
inline

Definition at line 82 of file OutlinedHashTree.h.

◆ getRoot() [2/2]

const HashNode * llvm::OutlinedHashTree::getRoot ( ) const
inline
Returns
the root hash node of a OutlinedHashTree.

Definition at line 81 of file OutlinedHashTree.h.

Referenced by clear(), find(), getMatchedEntries(), insert(), merge(), and walkGraph().

◆ insert()

void OutlinedHashTree::insert ( const HashSequencePair & SequencePair)

Inserts a Sequence into the this tree.

The last node in the sequence will increase Terminals.

Definition at line 71 of file OutlinedHashTree.cpp.

References llvm::Count, getRoot(), llvm::HashNode::Hash, I, llvm::Next, llvm::HashNode::Successors, and llvm::HashNode::Terminals.

◆ merge()

void OutlinedHashTree::merge ( const OutlinedHashTree * OtherTree)

Merge a OtherTree into this Tree.

Definition at line 90 of file OutlinedHashTree.cpp.

References getRoot(), llvm::HashNode::Hash, and I.

◆ size()

size_t OutlinedHashTree::size ( bool GetTerminalCountOnly = false) const
Returns
the size of a OutlinedHashTree by traversing it. If GetTerminalCountOnly is true, it only counts the terminal nodes (meaning it returns the the number of hash sequences in the OutlinedHashTree).

Definition at line 51 of file OutlinedHashTree.cpp.

References N, Size, and walkGraph().

Referenced by empty().

◆ walkGraph()

void OutlinedHashTree::walkGraph ( NodeCallbackFn CallbackNode,
EdgeCallbackFn CallbackEdge = nullptr,
bool SortedWalk = false ) const

Walks every edge and node in the OutlinedHashTree and calls CallbackEdge for the edges and CallbackNode for the nodes with the stable_hash for the source and the stable_hash of the sink for an edge.

These generic callbacks can be used to traverse a OutlinedHashTree for the purpose of print debugging or serializing it.

Definition at line 21 of file OutlinedHashTree.cpp.

References llvm::SmallVectorImpl< T >::emplace_back(), getRoot(), llvm::Next, P, llvm::sort(), and llvm::Successor.

Referenced by depth(), and size().


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