14 #ifndef LLVM_ADT_IMMUTABLELIST_H 15 #define LLVM_ADT_IMMUTABLELIST_H 35 : Head(head), Tail(tail) {}
127 assert(!isEmpty() &&
"Cannot get the head of an empty list.");
134 return X ? X->
getTail() :
nullptr;
142 template <
typename T>
150 bool ownsAllocator()
const {
151 return (Allocator & 0x1) == 0;
163 : Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
166 if (ownsAllocator())
delete &getAllocator();
175 ListTy::Profile(ID, Head, TailImpl);
176 ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
182 new (L)
ListTy(Head, TailImpl);
185 Cache.InsertNode(L, InsertPos);
200 return Concat(X, getEmptyList());
220 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
221 (
unsigned((uintptr_t)PtrVal) >> 9);
230 template <
typename T>
235 #endif // LLVM_ADT_IMMUTABLELIST_H detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&... Ranges)
Concatenated range across two or more ranges.
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
const_iterator end(StringRef path)
Get end iterator over path.
void Profile(FoldingSetNodeID &ID)
bool operator==(const ImmutableList &L) const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
iterator end() const
end - Returns an iterator denoting the end of the list.
Compute iterated dominance frontiers using a linear time algorithm.
static ImmutableList< T > getEmptyKey()
ImmutableListImpl & operator=(const ImmutableListImpl &)=delete
const T & getHead() const
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
const ImmutableListImpl * getTail() const
static bool isEqual(ImmutableList< T > X1, ImmutableList< T > X2)
bool operator!=(const iterator &I) const
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
ImmutableList getList() const
ImmutableList< T > getEmptyList() const
static ImmutableList< T > getTombstoneKey()
ImmutableList(const ImmutableListImpl< T > *x=nullptr)
static bool isEqual(const Function &Caller, const Function &Callee)
bool isEmpty() const
isEmpty - Returns true if the list is empty.
ImmutableList getTail()
getTail - Returns the tail of the list, which is another (possibly empty) ImmutableList.
void Profile(FoldingSetNodeID &ID) const
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
static void Profile(FoldingSetNodeID &ID, const T &H, const ImmutableListImpl *L)
ImmutableList - This class represents an immutable (functional) list.
Allocate memory in an ever growing pool, as if by bump-pointer.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
ImmutableListFactory(BumpPtrAllocator &Alloc)
LLVM_NODISCARD ImmutableList< T > concat(const T &Head, ImmutableList< T > Tail)
ImmutableList< T > create(const T &X)
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
const value_type & operator*() const
bool operator==(const iterator &I) const
bool isEqual(const ImmutableList &L) const
isEqual - Returns true if two lists are equal.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
const ImmutableListImpl< T > * getInternalPointer() const
iterator begin() const
begin - Returns an iterator referring to the head of the list, or an iterator denoting the end of the...
iterator(ImmutableList l)
static unsigned getHashValue(ImmutableList< T > X)
Node - This class is used to maintain the singly linked bucket list in a folding set.
LLVM_NODISCARD ImmutableList< T > add(const T &D, ImmutableList< T > L)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const T & getHead()
getHead - Returns the head of the list.
bool contains(const T &V) const