15#ifndef LLVM_CGDATA_OUTLINEDHASHTREE_H
16#define LLVM_CGDATA_OUTLINEDHASHTREE_H
24#include <unordered_map>
40 std::unordered_map<stable_hash, std::unique_ptr<HashNode>>
Successors;
45 using EdgeCallbackFn =
47 using NodeCallbackFn = std::function<void(
const HashNode *)>;
50 using HashSequencePair = std::pair<HashSequence, unsigned>;
59 EdgeCallbackFn CallbackEdge =
nullptr,
60 bool SortedWalk =
false)
const;
75 LLVM_ABI size_t size(
bool GetTerminalCountOnly =
false)
const;
92 LLVM_ABI std::optional<unsigned>
find(
const HashSequence &Sequence)
const;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
void clear()
Release all hash nodes except the root hash node.
LLVM_ABI size_t depth() const
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 CallbackNo...
LLVM_ABI std::optional< unsigned > find(const HashSequence &Sequence) const
const HashNode * getRoot() const
LLVM_ABI void merge(const OutlinedHashTree *OtherTree)
Merge a OtherTree into this Tree.
LLVM_ABI void insert(const HashSequencePair &SequencePair)
Inserts a Sequence into the this tree.
LLVM_ABI size_t size(bool GetTerminalCountOnly=false) const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
A HashNode is an entry in an OutlinedHashTree, holding a hash value and a collection of Successors (o...
std::unordered_map< stable_hash, std::unique_ptr< HashNode > > Successors
The successors of this node.
std::optional< unsigned > Terminals
The number of terminals in the sequence ending at this node.
stable_hash Hash
The hash value of the node.