16 #ifndef LLVM_ADT_FOLDINGSET_H 17 #define LLVM_ADT_FOLDINGSET_H 103 class FoldingSetNodeID;
114 virtual void anchor();
139 void *NextInFoldingSetBucket =
nullptr;
156 bool empty()
const {
return NumNodes == 0; }
161 void reserve(
unsigned EltCount);
168 return NumBuckets * 2;
173 void GrowHashTable();
178 void GrowBucketCount(
unsigned NewBucketCount);
255 template<
typename T,
typename Ctx>
258 X.Profile(ID, Context);
279 const unsigned *
Data =
nullptr;
315 : Bits(Ref.getData(), Ref.getData() + Ref.getSize()) {}
318 void AddPointer(
const void *Ptr);
319 void AddInteger(
signed I);
320 void AddInteger(
unsigned I);
321 void AddInteger(
long I);
322 void AddInteger(
unsigned long I);
323 void AddInteger(
long long I);
324 void AddInteger(
unsigned long long I);
329 template <
typename T>
379 template<
typename T,
typename Ctx>
389 template<
typename T,
typename Ctx>
461 assert(Inserted == N &&
"Node already inserted!");
481 T *TN =
static_cast<T *
>(
N);
489 T *TN =
static_cast<T *
>(
N);
496 T *TN =
static_cast<T *
>(
N);
501 explicit FoldingSet(
unsigned Log2InitSize = 6) : Super(Log2InitSize) {}
515 template <
class T,
class Ctx>
530 T *TN =
static_cast<T *
>(
N);
536 T *TN =
static_cast<T *
>(
N);
542 T *TN =
static_cast<T *
>(
N);
548 : Super(Log2InitSize), Context(Context) {}
558 template <
class T,
class VectorT = SmallVector<T*, 8>>
591 if (Result == N) Vector.push_back(N);
672 uintptr_t x =
reinterpret_cast<uintptr_t
>(Probe) & ~0x1;
673 Ptr =
reinterpret_cast<void*
>(x);
678 return Ptr == RHS.
Ptr;
681 return Ptr != RHS.
Ptr;
709 template <
typename T>
714 template <
typename... Ts>
716 : data(
std::forward<Ts>(
Args)...) {}
723 operator T&() {
return data; }
724 operator const T&()
const {
return data; }
751 template <
typename T1,
typename T2>
753 static inline void Profile(
const std::pair<T1, T2> &
P,
762 #endif // LLVM_ADT_FOLDINGSET_H
FoldingSetVector - This template class combines a FoldingSet and a vector to provide the interface of...
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
FoldingSetNodeIDRef(const unsigned *D, size_t S)
const T & getValue() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
bool empty() const
empty - Returns true if there are no nodes in the folding set.
void clear()
clear - Remove all nodes from the folding set.
void reserve(unsigned EltCount)
reserve - Increase the number of buckets such that adding the EltCount-th node won't cause a rebucket...
This class represents lattice values for constants.
unsigned NumBuckets
NumBuckets - Length of the Buckets array. Always a power of 2.
ContextualFoldingSet(Ctx Context, unsigned Log2InitSize=6)
FastFoldingSetNode - This is a subclass of FoldingSetNode which stores a FoldingSetNodeID value rathe...
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
FastFoldingSetNode(const FoldingSetNodeID &ID)
FoldingSetNodeWrapper(Ts &&... Args)
const_iterator begin() const
void Profile(FoldingSetNodeID &ID) const
block Block Frequency true
unsigned capacity()
capacity - Returns the number of nodes permitted in the folding set before a rebucket operation is pe...
static void Profile(const T &X, FoldingSetNodeID &ID)
unsigned ComputeHash() const
ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to lookup the node in the F...
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
const_iterator end() const
FoldingSet(unsigned Log2InitSize=6)
const_iterator begin() const
virtual bool NodeEquals(Node *N, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID) const =0
NodeEquals - Instantiations of the FoldingSet template implement this function to compare the given n...
bool operator!=(const FoldingSetIteratorImpl &RHS) const
bool operator!=(const FoldingSetBucketIteratorImpl &RHS) const
static void Profile(T *X, FoldingSetNodeID &ID)
ContextualFoldingSetTrait - Like FoldingSetTrait, but for ContextualFoldingSets.
static unsigned ComputeHash(T &X, FoldingSetNodeID &TempID)
The access may reference the value stored in memory.
FoldingSetIteratorImpl - This is the common iterator support shared by all folding sets...
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
Node * GetOrInsertNode(Node *N)
GetOrInsertNode - If there is an existing simple Node exactly equal to the specified node...
void InsertNode(Node *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
void InsertNode(T *N)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
void Profile(FoldingSetNodeID &ID)
void clear()
clear - Remove all nodes from the folding set.
FoldingSetImpl(unsigned Log2InitSize)
bool operator!=(FoldingSetNodeIDRef RHS) const
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
void SetNextInBucket(void *N)
FoldingSetTrait - This trait class is used to define behavior of how to "profile" (in the FoldingSet ...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void AddNodeID(const FoldingSetNodeID &ID)
Allocate memory in an ever growing pool, as if by bump-pointer.
std::shared_ptr< Node > NodePtr
Short-hand for a Node pointer.
static unsigned ComputeHash(T &X, FoldingSetNodeID &TempID, Ctx Context)
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
FoldingSetBucketIterator operator++(int)
void * getNextInBucket() const
Node * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
FoldingSetImpl - An implementation detail that lets us share code between FoldingSet and ContextualFo...
T * GetOrInsertNode(T *N)
GetOrInsertNode - If there is an existing simple Node exactly equal to the specified node...
FoldingSetIterator operator++(int)
bool operator!=(const FoldingSetNodeIDRef RHS) const
FoldingSetBucketIterator & operator++()
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
uint64_t ComputeHash(StringRef K)
void ** Buckets
Buckets - Array of bucket chains.
FoldingSetVector(unsigned Log2InitSize=6)
FoldingSet - This template class is used to instantiate a specialized implementation of the folding s...
unsigned NumNodes
NumNodes - Number of nodes in the folding set.
static bool Equals(T &X, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID)
bucket_iterator bucket_end(unsigned hash)
FoldingSetNodeWrapper - This template class is used to "wrap" arbitrary types in an enclosing object ...
void InsertNode(T *N)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
FoldingSetNodeID(FoldingSetNodeIDRef Ref)
FoldingSetBase(unsigned Log2InitSize=6)
void clear()
clear - Clear the accumulated profile, allowing this FoldingSetNodeID object to be used to compute a ...
virtual void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const =0
GetNodeProfile - Instantiations of the FoldingSet template implement this function to gather data bit...
FoldingSetBucketIterator(void **Bucket)
const_iterator end() const
FoldingSetBucketIterator(void **Bucket, bool)
An iterator type that allows iterating over the pointees via some other iterator. ...
ContextualFoldingSet - This template class is a further refinement of FoldingSet which provides a con...
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
FoldingSetIterator & operator++()
unsigned size() const
size - Returns the number of nodes in the folding set.
FoldingSetBase - Implements the folding set functionality.
static void Profile(T &X, FoldingSetNodeID &ID)
amdgpu Simplify well known AMD library false Value Value * Arg
T * GetOrInsertNode(T *N)
GetOrInsertNode - If there is an existing simple Node exactly equal to the specified node...
FoldingSetNodeIDRef - This class describes a reference to an interned FoldingSetNodeID, which can be a useful to store node id data rather than using plain FoldingSetNodeIDs, since the 32-element SmallVector is often much larger than necessary, and the possibility of heap allocation means it requires a non-trivial destructor call.
Node - This class is used to maintain the singly linked bucket list in a folding set.
bool operator==(const FoldingSetBucketIteratorImpl &RHS) const
bool operator!=(const FoldingSetNodeID &RHS) const
bucket_iterator bucket_begin(unsigned hash)
virtual unsigned ComputeNodeHash(Node *N, FoldingSetNodeID &TempID) const =0
ComputeNodeHash - Instantiations of the FoldingSet template implement this function to compute a hash...
bool empty() const
empty - Returns true if there are no nodes in the folding set.
bool RemoveNode(Node *N)
RemoveNode - Remove a node from the folding set, returning true if one was removed or false if the no...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DefaultContextualFoldingSetTrait - Like DefaultFoldingSetTrait, but for ContextualFoldingSets.
bool operator<(int64_t V1, const APSInt &V2)
bool RemoveNode(T *N)
RemoveNode - Remove a node from the folding set, returning true if one was removed or false if the no...
DefaultFoldingSetTrait - This class provides default implementations for FoldingSetTrait implementati...
FoldingSetIterator(void **Bucket)
static void Profile(const std::pair< T1, T2 > &P, FoldingSetNodeID &ID)
StringRef - Represent a constant reference to a string, i.e.
bool operator==(uint64_t V1, const APInt &V2)
bool operator==(const FoldingSetIteratorImpl &RHS) const
FoldingSetBase & operator=(FoldingSetBase &&RHS)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
FoldingSetBucketIteratorImpl(void **Bucket, bool)
unsigned size() const
size - Returns the number of nodes in the folding set.
FoldingSetBucketIteratorImpl - This is the common bucket iterator support shared by all folding sets...
static void Profile(T &X, FoldingSetNodeID &ID, Ctx Context)
static bool Equals(T &X, const FoldingSetNodeID &ID, unsigned IDHash, FoldingSetNodeID &TempID, Ctx Context)
const unsigned * getData() const