24 #ifndef LLVM_ADT_ILIST_H 25 #define LLVM_ADT_ILIST_H 72 template <
class Iterator>
83 template <
typename NodeTy>
90 template <
typename NodeTy>
96 namespace ilist_detail {
98 template <
class T>
T &
make();
108 static Yes &test(U *
I, decltype(I->getNext(&make<NodeT>())) * = 0);
109 template <
class>
static No &test(...);
112 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
122 static Yes &test(U *
I, decltype(I->createSentinel()) * = 0);
123 template <
class>
static No &test(...);
126 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
138 static Yes &test(U *
I, decltype(I->createNode(make<NodeT>())) * = 0);
139 template <
class>
static No &test(...);
142 static const bool value =
sizeof(test<TraitsT>(
nullptr)) ==
sizeof(
Yes);
167 template <
class IntrusiveListT,
class TraitsT>
191 "ilist customization points have changed!");
193 static bool op_less(const_reference L, const_reference R) {
return L < R; }
194 static bool op_equal(const_reference L, const_reference R) {
return L == R; }
205 *
static_cast<TraitsT *
>(
this) = std::move(
X);
213 size_type
max_size()
const {
return size_type(-1); }
220 using base_list_type::front;
221 using base_list_type::back;
224 assert(0 &&
"Swap does not use list traits callback correctly yet!");
228 iterator
insert(iterator where, pointer New) {
229 this->addNodeToList(New);
230 return base_list_type::insert(where, *New);
233 iterator
insert(iterator where, const_reference New) {
234 return this->insert(where,
new value_type(New));
239 return insert(
begin(), New);
241 return insert(++where, New);
247 for (const_reference V : L2)
251 pointer
remove(iterator &
IT) {
252 pointer Node = &*
IT++;
253 this->removeNodeFromList(Node);
258 pointer
remove(
const iterator &
IT) {
260 return remove(MutIt);
263 pointer
remove(pointer
IT) {
return remove(iterator(
IT)); }
264 pointer
remove(reference
IT) {
return remove(iterator(
IT)); }
286 void transfer(iterator position,
iplist_impl &L2, iterator
first, iterator last) {
287 if (position == last)
291 this->transferNodesFromList(L2, first, last);
293 base_list_type::splice(position, L2, first, last);
303 iterator
erase(iterator first, iterator last) {
304 while (first != last)
305 first = erase(first);
320 iterator t =
end(); erase(--t);
324 template<
class InIt>
void insert(iterator where, InIt first, InIt last) {
325 for (; first != last; ++
first) insert(where, *first);
331 transfer(where, L2, L2.begin(), L2.end());
334 iterator last =
first; ++last;
335 if (where == first || where == last)
return;
336 transfer(where, L2, first, last);
339 if (first != last) transfer(where, L2, first, last);
342 splice(where, L2, iterator(N));
345 splice(where, L2, iterator(N));
348 template <
class Compare>
352 this->transferNodesFromList(Right, Right.begin(), Right.end());
353 base_list_type::merge(Right, comp);
361 auto I = N.getIterator();
364 return &*std::prev(
I);
368 return getPrevNode(const_cast<reference >(N));
373 auto Next = std::next(N.getIterator());
380 return getNextNode(const_cast<reference >(N));
389 template <
class T,
class... Options>
391 :
public iplist_impl<simple_ilist<T, Options...>, ilist_traits<T>> {
402 *
static_cast<iplist_impl_type *
>(
this) = std::move(X);
421 #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.