23 #ifndef LLVM_ADT_ILIST_H 24 #define LLVM_ADT_ILIST_H 70 template <
class Iterator>
81 template <
typename NodeTy>
88 template <
typename NodeTy>
94 namespace ilist_detail {
96 template <
class T>
T &
make();
106 static Yes &
test(U *
I, decltype(I->getNext(&make<NodeT>())) * = 0);
107 template <
class>
static No &
test(...);
110 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
120 static Yes &
test(U *
I, decltype(I->createSentinel()) * = 0);
121 template <
class>
static No &
test(...);
124 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
136 static Yes &
test(U *
I, decltype(I->createNode(make<NodeT>())) * = 0);
137 template <
class>
static No &
test(...);
140 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
165 template <
class IntrusiveListT,
class TraitsT>
189 "ilist customization points have changed!");
191 static bool op_less(const_reference L, const_reference R) {
return L < R; }
192 static bool op_equal(const_reference L, const_reference R) {
return L == R; }
203 *
static_cast<TraitsT *
>(
this) = std::move(
X);
211 size_type
max_size()
const {
return size_type(-1); }
218 using base_list_type::front;
219 using base_list_type::back;
222 assert(0 &&
"Swap does not use list traits callback correctly yet!");
226 iterator
insert(iterator where, pointer New) {
227 this->addNodeToList(New);
228 return base_list_type::insert(where, *New);
231 iterator
insert(iterator where, const_reference New) {
232 return this->insert(where,
new value_type(New));
237 return insert(
begin(), New);
239 return insert(++where, New);
245 for (const_reference V : L2)
249 pointer
remove(iterator &
IT) {
251 this->removeNodeFromList(Node);
256 pointer
remove(
const iterator &
IT) {
258 return remove(MutIt);
261 pointer
remove(pointer
IT) {
return remove(iterator(
IT)); }
262 pointer
remove(reference
IT) {
return remove(iterator(
IT)); }
284 void transfer(iterator position,
iplist_impl &L2, iterator
first, iterator last) {
285 if (position == last)
289 this->transferNodesFromList(L2, first, last);
291 base_list_type::splice(position, L2, first, last);
301 iterator
erase(iterator first, iterator last) {
302 while (first != last)
303 first = erase(first);
318 iterator t =
end(); erase(--t);
322 template<
class InIt>
void insert(iterator where, InIt first, InIt last) {
323 for (; first != last; ++
first) insert(where, *first);
329 transfer(where, L2, L2.begin(), L2.end());
332 iterator last =
first; ++last;
333 if (where == first || where == last)
return;
334 transfer(where, L2, first, last);
337 if (first != last) transfer(where, L2, first, last);
340 splice(where, L2, iterator(N));
343 splice(where, L2, iterator(N));
346 template <
class Compare>
350 this->transferNodesFromList(Right, Right.begin(), Right.end());
351 base_list_type::merge(Right, comp);
359 auto I = N.getIterator();
362 return &*std::prev(
I);
366 return getPrevNode(const_cast<reference >(N));
371 auto Next = std::next(N.getIterator());
378 return getNextNode(const_cast<reference >(N));
387 template <
class T,
class... Options>
389 :
public iplist_impl<simple_ilist<T, Options...>, ilist_traits<T>> {
400 *
static_cast<iplist_impl_type *
>(
this) = std::move(X);
419 #endif // LLVM_ADT_ILIST_H const_iterator end(StringRef path)
Get end iterator over path.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
base_list_type::const_iterator const_iterator
iterator erase(reference IT)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
iterator erase(iterator where)
base_list_type::const_reverse_iterator const_reverse_iterator
This class represents lattice values for constants.
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.
typename OptionsT::const_reference const_reference
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.
pointer getPrevNode(reference N) const
Get the previous node, or nullptr for the list head.
void splice(iterator where, iplist_impl &L2, iterator first, iterator last)
const_pointer getPrevNode(const_reference N) const
Get the previous node, or nullptr for the list head.
Custom traits to do nothing on deletion.
reverse_iterator rbegin(StringRef path, Style style=Style::native)
Get reverse begin iterator over path.
Type trait to check for a traits class that has a createSentinel member (as a canary for any of the i...
base_list_type::const_pointer const_pointer
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)
typename OptionsT::const_pointer const_pointer
void merge(iplist_impl &Right, Compare comp)
Use delete by default for iplist and ilist.
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)
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...
An intrusive list with ownership and callbacks specified/controlled by ilist_traits, only with API safe for polymorphic types.
pointer getNextNode(reference N) const
Get the next node, or nullptr for the list tail.
void splice(iterator where, iplist_impl &L2, reference N)
void sort(IteratorTy Start, IteratorTy End)
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
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)
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
typename OptionsT::pointer pointer
void removeNodeFromList(NodeTy *)
size_type max_size() const
static void deleteNode(NodeTy *V)
iplist & operator=(iplist &&X)
void splice(iterator where, iplist_impl &L2, pointer N)
void push_back(pointer val)
iterator erase(iterator first, iterator last)
static void clear(coro::Shape &Shape)
typename OptionsT::value_type value_type
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")))
iterator insert(iterator where, pointer New)
base_list_type::pointer pointer
void swap(iplist_impl &RHS)
iterator insert(iterator where, const_reference New)
reverse_iterator rend(StringRef path)
Get reverse end iterator over path.
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.
const_pointer getNextNode(const_reference N) const
Get the next node, or nullptr for the list tail.
iterator insertAfter(iterator where, pointer New)
base_list_type::reverse_iterator reverse_iterator
typename OptionsT::reference reference
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.