9#ifndef LLVM_ADT_ALLOCATORLIST_H
10#define LLVM_ADT_ALLOCATORLIST_H
35 Node(Node &&) =
delete;
36 Node(
const Node &) =
delete;
37 Node &operator=(Node &&) =
delete;
38 Node &operator=(
const Node &) =
delete;
40 Node(
T &&V) : V(std::move(V)) {}
41 Node(
const T &V) : V(V) {}
42 template <
class... Ts> Node(Ts &&... Vs) : V(std::forward<Ts>(Vs)...) {}
50 AllocatorT &getAlloc() {
return *
this; }
51 const AllocatorT &getAlloc()
const {
return *
this; }
53 template <
class... ArgTs> Node *create(ArgTs &&... Args) {
54 return new (getAlloc()) Node(std::forward<ArgTs>(Args)...);
62 Node *operator()(
const Node &
N)
const {
return AL.create(
N.V); }
70 void operator()(Node *
N)
const {
72 AL.getAlloc().Deallocate(
N);
86 template <
class ValueT,
class IteratorBase>
90 std::bidirectional_iterator_tag, ValueT> {
91 template <
class OtherValueT,
class OtherIteratorBase>
92 friend class IteratorImpl;
97 std::bidirectional_iterator_tag,
ValueT>;
104 IteratorImpl() =
default;
105 IteratorImpl(
const IteratorImpl &) =
default;
106 IteratorImpl &operator=(
const IteratorImpl &) =
default;
110 template <
class OtherValueT,
class OtherIteratorBase>
111 IteratorImpl(
const IteratorImpl<OtherValueT, OtherIteratorBase> &
X,
112 std::enable_if_t<std::is_convertible<
114 : base_type(
X.wrapped()) {}
116 ~IteratorImpl() =
default;
123 using iterator = IteratorImpl<T, typename list_type::iterator>;
125 IteratorImpl<T, typename list_type::reverse_iterator>;
127 IteratorImpl<const T, typename list_type::const_iterator>;
129 IteratorImpl<const T, typename list_type::const_reverse_iterator>;
136 List.cloneFrom(
X.List, Cloner(*
this), Disposer(*
this));
141 List = std::move(
X.List);
142 getAlloc() = std::move(
X.getAlloc());
147 List.cloneFrom(
X.List, Cloner(*
this), Disposer(*
this));
180 return iterator(
List.insert(
I.wrapped(), *create(std::forward<Ts>(Vs)...)));
184 return iterator(
List.insert(
I.wrapped(), *create(std::move(V))));
190 template <
class Iterator>
197 return iterator(
List.eraseAndDispose(
I.wrapped(), Disposer(*
this)));
202 List.eraseAndDispose(
First.wrapped(),
Last.wrapped(), Disposer(*
this)));
223 assert(
empty() &&
"Cannot reset allocator if not empty");
This file defines the BumpPtrAllocator interface.
Given that RA is a live value
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A linked-list with a custom, local allocator.
void emplace_back(Ts &&... Vs)
const_iterator end() const
AllocatorList(AllocatorList &&X)
void insert(iterator I, Iterator First, Iterator Last)
const_reverse_iterator rend() const
typename list_type::size_type size_type
iterator erase(iterator First, iterator Last)
const_iterator begin() const
AllocatorList & operator=(const AllocatorList &X)
void push_back(const T &V)
IteratorImpl< T, typename list_type::reverse_iterator > reverse_iterator
IteratorImpl< const T, typename list_type::const_reverse_iterator > const_reverse_iterator
IteratorImpl< const T, typename list_type::const_iterator > const_iterator
void emplace_front(Ts &&... Vs)
iterator erase(iterator I)
iterator emplace(iterator I, Ts &&... Vs)
iterator insert(iterator I, T &&V)
void resetAlloc()
Reset the underlying allocator.
const_reverse_iterator rbegin() const
IteratorImpl< T, typename list_type::iterator > iterator
typename list_type::difference_type difference_type
void push_front(const T &V)
AllocatorList & operator=(AllocatorList &&X)
iterator insert(iterator I, const T &V)
AllocatorList(const AllocatorList &X)
void swap(AllocatorList &RHS)
reverse_iterator rbegin()
CRTP base class for adapting an iterator to a different type.
const IteratorBase & wrapped() const
ptrdiff_t difference_type
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This is an optimization pass for GlobalISel generic memory operations.
APInt operator*(APInt a, uint64_t RHS)
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.