Go to the documentation of this file.
9 #ifndef LLVM_ADT_ALLOCATORLIST_H
10 #define LLVM_ADT_ALLOCATORLIST_H
20 #include <type_traits>
36 Node(Node &&) =
delete;
37 Node(
const Node &) =
delete;
42 Node(
const T &V) : V(V) {}
43 template <
class... Ts> Node(Ts &&... Vs) : V(std::forward<Ts>(Vs)...) {}
51 AllocatorT &getAlloc() {
return *
this; }
52 const AllocatorT &getAlloc()
const {
return *
this; }
54 template <
class... ArgTs> Node *create(ArgTs &&...
Args) {
55 return new (getAlloc()) Node(std::forward<ArgTs>(
Args)...);
63 Node *operator()(
const Node &
N)
const {
return AL.create(
N.V); }
71 void operator()(Node *
N)
const {
73 AL.getAlloc().Deallocate(
N);
87 template <
class ValueT,
class IteratorBase>
91 std::bidirectional_iterator_tag, ValueT> {
92 template <
class OtherValueT,
class OtherIteratorBase>
93 friend class IteratorImpl;
98 std::bidirectional_iterator_tag,
ValueT>;
105 IteratorImpl() =
default;
106 IteratorImpl(
const IteratorImpl &) =
default;
107 IteratorImpl &
operator=(
const IteratorImpl &) =
default;
111 template <
class OtherValueT,
class OtherIteratorBase>
112 IteratorImpl(
const IteratorImpl<OtherValueT, OtherIteratorBase> &
X,
113 std::enable_if_t<std::is_convertible<
115 : base_type(
X.wrapped()) {}
117 ~IteratorImpl() =
default;
124 using iterator = IteratorImpl<T, typename list_type::iterator>;
126 IteratorImpl<T, typename list_type::reverse_iterator>;
128 IteratorImpl<const T, typename list_type::const_iterator>;
130 IteratorImpl<const T, typename list_type::const_reverse_iterator>;
137 List.cloneFrom(
X.List, Cloner(*
this), Disposer(*
this));
148 List.cloneFrom(
X.List, Cloner(*
this), Disposer(*
this));
181 return iterator(
List.insert(
I.wrapped(), *create(std::forward<Ts>(Vs)...)));
191 template <
class Iterator>
198 return iterator(
List.eraseAndDispose(
I.wrapped(), Disposer(*
this)));
203 List.eraseAndDispose(
First.wrapped(), Last.wrapped(), Disposer(*
this)));
224 assert(
empty() &&
"Cannot reset allocator if not empty");
233 #endif // LLVM_ADT_ALLOCATORLIST_H
IteratorImpl< Token, typename list_type::iterator > iterator
This class represents lattice values for constants.
AllocatorList(const AllocatorList &X)
void insert(iterator I, Iterator First, Iterator Last)
CRTP base class for adapting an iterator to a different type.
const IteratorBase & wrapped() const
iterator erase(iterator I)
void resetAlloc()
Reset the underlying allocator.
IteratorImpl< const Token, typename list_type::const_iterator > const_iterator
into llvm powi allowing the code generator to produce balanced multiplication trees First
void swap(AllocatorList &RHS)
iterator erase(iterator First, iterator Last)
Node(Kind K_, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
ptrdiff_t difference_type
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
reverse_iterator rbegin()
iterator emplace(iterator I, Ts &&... Vs)
const_iterator begin() const
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
const_iterator end() const
A linked-list with a custom, local allocator.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
AllocatorList(AllocatorList &&X)
APInt operator*(APInt a, uint64_t RHS)
const Token * const_pointer
iterator insert(iterator I, T &&V)
typename list_type::size_type size_type
typename list_type::difference_type difference_type
void push_back(const T &V)
const_reverse_iterator rbegin() const
void push_front(const T &V)
iterator insert(iterator I, const T &V)
void emplace_back(Ts &&... Vs)
AllocatorList & operator=(AllocatorList &&X)
const Token & const_reference
IteratorImpl< Token, typename list_type::reverse_iterator > reverse_iterator
IteratorImpl< const Token, typename list_type::const_reverse_iterator > const_reverse_iterator
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
const_reverse_iterator rend() const
AllocatorList & operator=(const AllocatorList &X)
void emplace_front(Ts &&... Vs)