Go to the documentation of this file.
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;
149 template <
typename T>
150 class ImmutableListFactory {
151 using ListTy = ImmutableListImpl<T>;
152 using CacheTy = FoldingSet<ListTy>;
157 bool ownsAllocator()
const {
158 return (Allocator & 0x1) == 0;
170 :
Allocator(reinterpret_cast<uintptr_t>(&Alloc) | 0x1) {}
173 if (ownsAllocator())
delete &getAllocator();
176 template <
typename ElemT>
182 const ListTy* TailImpl =
Tail.getInternalPointer();
184 ListTy* L = Cache.FindNodeOrInsertPos(
ID, InsertPos);
190 new (L)
ListTy(std::forward<ElemT>(Head), TailImpl);
193 Cache.InsertNode(L, InsertPos);
199 template <
typename ElemT>
204 template <
typename... CtorArgs>
206 CtorArgs &&...
Args) {
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);
246 #endif // LLVM_ADT_IMMUTABLELIST_H
static unsigned getHashValue(ImmutableList< T > X)
This is an optimization pass for GlobalISel generic memory operations.
bool operator==(const iterator &I) const
const ImmutableListImpl * getTail() const
ImmutableList getList() const
ImmutableList getTail() const
getTail - Returns the tail of the list, which is another (possibly empty) ImmutableList.
const ImmutableListImpl< T > * getInternalPointer() const
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
static ImmutableList< T > getEmptyKey()
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...
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32 n y store obj * new
bool contains(const T &V) const
bool operator==(const ImmutableList &L) const
An information struct used to provide DenseMap with the various necessary components for a given valu...
void Profile(FoldingSetNodeID &ID) const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ImmutableList< T > add(ElemT &&Data, ImmutableList< T > L)
This requires reassociating to forms of expressions that are already something that reassoc doesn t think about yet These two functions should generate the same code on big endian int * l
iterator end() const
end - Returns an iterator denoting the end of the list.
static ImmutableList< T > getTombstoneKey()
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
ImmutableList - This class represents an immutable (functional) list.
static bool isEqual(ImmutableList< T > X1, ImmutableList< T > X2)
ImmutableList< T > concat(ElemT &&Head, ImmutableList< T > Tail)
Allocate memory in an ever growing pool, as if by bump-pointer.
ImmutableListFactory(BumpPtrAllocator &Alloc)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
iterator(ImmutableList l)
void Profile(FoldingSetNodeID &ID)
bool isEqual(const ImmutableList &L) const
isEqual - Returns true if two lists are equal.
bool isEmpty() const
isEmpty - Returns true if the list is empty.
const T & getHead() const
Node - This class is used to maintain the singly linked bucket list in a folding set.
ImmutableList< T > create(ElemT &&Data)
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
ImmutableListImpl & operator=(const ImmutableListImpl &)=delete
const value_type & operator*() const
static void Profile(FoldingSetNodeID &ID, const T &H, const ImmutableListImpl *L)
const T & getHead() const
getHead - Returns the head of the list.
const std::remove_reference_t< value_type > * operator->() const
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool operator!=(const iterator &I) const
ImmutableList< T > emplace(ImmutableList< T > Tail, CtorArgs &&...Args)
ImmutableList< T > getEmptyList() const