14#ifndef LLVM_ADT_IMMUTABLELIST_H
15#define LLVM_ADT_IMMUTABLELIST_H
34 template <
typename ElemT>
36 : Head(std::forward<ElemT>(head)),
Tail(tail) {}
70 static_assert(std::is_trivially_destructible<T>::value,
71 "T must be trivially destructible!");
97 const std::remove_reference_t<value_type> *
operator->()
const {
134 assert(!
isEmpty() &&
"Cannot get the head of an empty list.");
141 return X ? X->getTail() :
nullptr;
157 bool ownsAllocator()
const {
173 if (ownsAllocator())
delete &getAllocator();
176 template <
typename ElemT>
182 const ListTy* TailImpl =
Tail.getInternalPointer();
190 new (L)
ListTy(std::forward<ElemT>(Head), TailImpl);
199 template <
typename ElemT>
204 template <
typename... CtorArgs>
206 CtorArgs &&...Args) {
207 return concat(
T(std::forward<CtorArgs>(Args)...),
Tail);
214 template <
typename ElemT>
234 uintptr_t PtrVal =
reinterpret_cast<uintptr_t
>(
X.getInternalPointer());
235 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
236 (
unsigned((uintptr_t)PtrVal) >> 9);
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This file defines a hash set that can be used to remove duplication of nodes in a graph.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Allocate memory in an ever growing pool, as if by bump-pointer.
Node - This class is used to maintain the singly linked bucket list in a folding set.
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
ImmutableListFactory(BumpPtrAllocator &Alloc)
ImmutableList< T > create(ElemT &&Data)
ImmutableList< T > add(ElemT &&Data, ImmutableList< T > L)
ImmutableList< T > getEmptyList() const
ImmutableList< T > concat(ElemT &&Head, ImmutableList< T > Tail)
ImmutableList< T > emplace(ImmutableList< T > Tail, CtorArgs &&...Args)
static void Profile(FoldingSetNodeID &ID, const T &H, const ImmutableListImpl *L)
ImmutableListImpl & operator=(const ImmutableListImpl &)=delete
const T & getHead() const
ImmutableListImpl(const ImmutableListImpl &)=delete
const ImmutableListImpl * getTail() const
void Profile(FoldingSetNodeID &ID)
bool operator==(const iterator &I) const
const std::remove_reference_t< value_type > * operator->() const
const value_type & operator*() const
iterator(ImmutableList l)
ImmutableList getList() const
bool operator!=(const iterator &I) const
ImmutableList - This class represents an immutable (functional) list.
bool isEmpty() const
isEmpty - Returns true if the list is empty.
iterator end() const
end - Returns an iterator denoting the end of the list.
const T & getHead() const
getHead - Returns the head of the list.
ImmutableList getTail() const
getTail - Returns the tail of the list, which is another (possibly empty) ImmutableList.
const ImmutableListImpl< T > * getInternalPointer() const
void Profile(FoldingSetNodeID &ID) const
bool contains(const T &V) const
bool operator==(const ImmutableList &L) const
ImmutableList(const ImmutableListImpl< T > *x=nullptr)
iterator begin() const
begin - Returns an iterator referring to the head of the list, or an iterator denoting the end of the...
bool isEqual(const ImmutableList &L) const
isEqual - Returns true if two lists are equal.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
static unsigned getHashValue(ImmutableList< T > X)
static bool isEqual(ImmutableList< T > X1, ImmutableList< T > X2)
static ImmutableList< T > getTombstoneKey()
static ImmutableList< T > getEmptyKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...