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!");
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
const std::remove_reference< value_type >::type * operator->() const
@ Tail
Tail - This calling convention attemps to make calls as fast as possible while guaranteeing that tail...
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")
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.
LLVM_NODISCARD ImmutableList< T > concat(ElemT &&Head, ImmutableList< T > Tail)
LLVM_NODISCARD ImmutableList< T > add(ElemT &&Data, ImmutableList< T > L)
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")
AMD64 Optimization Manual has some nice information about optimizing integer multiplication by a constant How much of it applies to Intel s X86 implementation There are definite trade offs to xmm0 cvttss2siq rdx jb L3 subss xmm0 rax cvttss2siq rdx xorq rdx rax ret instead of xmm1 cvttss2siq rcx movaps xmm2 subss xmm2 cvttss2siq rax rdx xorq rax ucomiss xmm0 cmovb rax ret Seems like the jb branch has high likelihood of being taken It would have saved a few instructions It s not possible to reference and DH registers in an instruction requiring REX prefix divb and mulb both produce results in AH If isel emits a CopyFromReg which gets turned into a movb and that can be allocated a r8b r15b To get around isel emits a CopyFromReg from AX and then right shift it down by and truncate it It s not pretty but it works We need some register allocation magic to make the hack go which would often require a callee saved register Callees usually need to keep this value live for most of their body so it doesn t add a significant burden on them We currently implement this in however this is suboptimal because it means that it would be quite awkward to implement the optimization for callers A better implementation would be to relax the LLVM IR rules for sret arguments to allow a function with an sret argument to have a non void return type
LLVM_NODISCARD ImmutableList< T > emplace(ImmutableList< T > Tail, CtorArgs &&...Args)
ImmutableList - This class represents an immutable (functional) list.
static bool isEqual(ImmutableList< T > X1, ImmutableList< T > X2)
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
Since we know that Vector is byte aligned and we know the element offset of X
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
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
static void Profile(FoldingSetNodeID &ID, const T &H, const ImmutableListImpl *L)
const T & getHead() const
getHead - Returns the head of the list.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool operator!=(const iterator &I) const
ImmutableList< T > getEmptyList() const