24 #ifndef LLVM_ADT_ILIST_H
25 #define LLVM_ADT_ILIST_H
72 template <
class Iterator>
83 template <
typename NodeTy>
94 template <
typename NodeTy>
100 template <
typename NodeTy>
106 namespace ilist_detail {
108 template <
class T>
T &
make();
118 static Yes &
test(U *
I, decltype(I->getNext(&make<NodeT>())) * = 0);
119 template <
class>
static No &
test(...);
122 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
132 static Yes &
test(U *
I, decltype(I->createSentinel()) * = 0);
133 template <
class>
static No &
test(...);
136 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
148 static Yes &
test(U *
I, decltype(I->createNode(make<NodeT>())) * = 0);
149 template <
class>
static No &
test(...);
152 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
177 template <
class IntrusiveListT,
class TraitsT>
204 "ilist customization points have changed!");
218 *
static_cast<TraitsT *
>(
this) = std::move(
X);
232 using base_list_type::empty;
233 using base_list_type::front;
234 using base_list_type::back;
237 assert(0 &&
"Swap does not use list traits callback correctly yet!");
242 this->addNodeToList(New);
243 return base_list_type::insert(where, *New);
254 return insert(++where, New);
266 this->removeNodeFromList(Node);
273 return remove(MutIt);
281 this->deleteNode(
remove(where));
300 if (position == last)
304 this->transferNodesFromList(L2, first, last);
306 base_list_type::splice(position, L2, first, last);
314 using base_list_type::size;
317 while (first != last)
318 first =
erase(first);
328 assert(!empty() &&
"pop_front() on empty list!");
332 assert(!empty() &&
"pop_back() on empty list!");
338 for (; first != last; ++first)
insert(where, *first);
344 transfer(where, L2, L2.begin(), L2.end());
348 if (where == first || where == last)
return;
349 transfer(where, L2, first, last);
352 if (first != last) transfer(where, L2, first, last);
361 template <
class Compare>
365 this->transferNodesFromList(Right, Right.begin(), Right.end());
370 using base_list_type::sort;
374 auto I = N.getIterator();
377 return &*std::prev(
I);
386 auto Next = std::next(N.getIterator());
402 template <
class T,
class... Options>
404 :
public iplist_impl<simple_ilist<T, Options...>, ilist_traits<T>> {
405 typedef typename iplist::iplist_impl_type iplist_impl_type;
434 #endif // LLVM_ADT_ILIST_H
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::ZeroOrMore, cl::values(clEnumValN(DefaultIT,"arm-default-it","Generate IT block based on arch"), clEnumValN(RestrictedIT,"arm-restrict-it","Disallow deprecated IT based on ARMv8"), clEnumValN(NoRestrictedIT,"arm-no-restrict-it","Allow IT blocks based on ARMv7")))
const_iterator end(StringRef path)
Get end iterator over path.
base_list_type::const_iterator const_iterator
iterator erase(reference IT)
pointer getNextNode(reference N) const
Get the next node, or nullptr for the list tail.
iterator erase(iterator where)
base_list_type::const_reverse_iterator const_reverse_iterator
void addNodeToList(NodeTy *)
When an MBB is added to an MF, we need to update the parent pointer of the MBB, the MBB numbering...
A wrapper around an intrusive list with callbacks and non-intrusive ownership.
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
void insert(iterator where, InIt first, InIt last)
Template traits for intrusive list.
const_iterator begin(StringRef path)
Get begin iterator over path.
ptrdiff_t difference_type
void splice(iterator where, iplist_impl &L2, iterator first, iterator last)
Custom traits to do nothing on deletion.
size_type max_size() const
Type trait to check for a traits class that has a createSentinel member (as a canary for any of the i...
Default template traits for intrusive list.
base_list_type::const_pointer const_pointer
static Yes & test(U *I, decltype(I->createSentinel())*=0)
static void deleteNode(NodeTy *V)
base_list_type::difference_type difference_type
iterator erase(pointer IT)
Type trait to check for a traits class that has a createNode member.
iplist_impl(iplist_impl &&X)
void merge(iplist_impl &Right, Compare comp)
Use delete by default for iplist and ilist.
iplist & operator=(const iplist &X)=delete
iplist_impl & operator=(iplist_impl &&X)
void push_front(pointer val)
void merge(iplist_impl &Right)
Type trait to check for a traits class that has a getNext member (as a canary for any of the ilist_ne...
void splice(iterator where, iplist_impl &L2, iterator first)
void splice(iterator where, iplist_impl &L2)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
base_list_type::const_reference const_reference
base_list_type::reference reference
A fragment for template traits for intrusive list that provides default node related operations...
pointer getPrevNode(reference N) const
Get the previous node, or nullptr for the list head.
An intrusive list with ownership and callbacks specified/controlled by ilist_traits, only with API safe for polymorphic types.
void splice(iterator where, iplist_impl &L2, reference N)
Iterator for intrusive lists based on ilist_node.
base_list_type::iterator iterator
base_list_type::size_type size_type
void swap(llvm::iplist< Ty > &Left, llvm::iplist< Ty > &Right)
void removeNodeFromList(NodeTy *)
static void deleteNode(NodeTy *V)
iplist & operator=(iplist &&X)
void splice(iterator where, iplist_impl &L2, pointer N)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
void push_back(pointer val)
iterator erase(iterator first, iterator last)
static void clear(coro::Shape &Shape)
const_pointer getPrevNode(const_reference N) const
Get the previous node, or nullptr for the list head.
iterator insert(iterator where, pointer New)
base_list_type::pointer pointer
reverse_iterator rbegin(StringRef path)
Get reverse begin iterator over path.
void swap(iplist_impl &RHS)
iterator insert(iterator where, const_reference New)
static Yes & test(U *I, decltype(I->createNode(make< NodeT >()))*=0)
reverse_iterator rend(StringRef path)
Get reverse end iterator over path.
static Yes & test(U *I, decltype(I->getNext(&make< NodeT >()))*=0)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void clearAndLeakNodesUnsafely()
Remove all nodes from the list like clear(), but do not call removeNodeFromList() or deleteNode()...
Callbacks do nothing by default in iplist and ilist.
iplist_impl & operator=(const iplist_impl &)=delete
iplist_impl iplist_impl_type
iterator insertAfter(iterator where, pointer New)
const_pointer getNextNode(const_reference N) const
Get the next node, or nullptr for the list tail.
base_list_type::reverse_iterator reverse_iterator
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator)
Callback before transferring nodes to this list.
base_list_type::value_type value_type
void cloneFrom(const iplist_impl &L2, Cloner clone)
Clone another list.