13#ifndef LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
14#define LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
55 while (
I->isBundledWithPred())
63 while (
I->isBundledWithSucc())
69 template <
class Iterator>
static void increment(Iterator &
I) {
70 I = std::next(getBundleFinal(
I));
74 template <
class Iterator>
static void decrement(Iterator &
I) {
75 I = getBundleBegin(std::prev(
I));
95 template <
class Iterator>
static void increment(Iterator &
I) {
96 I = getBundleBegin(std::next(
I));
100 template <
class Iterator>
static void decrement(Iterator &
I) {
101 I = std::prev(getBundleFinal(
I));
107template <
typename Ty,
bool IsReverse = false>
110 using instr_iterator =
typename Traits::instr_iterator;
117 using pointer =
typename instr_iterator::pointer;
124 using nonconst_instr_iterator =
typename Traits::nonconst_instr_iterator;
125 using const_instr_iterator =
typename Traits::const_instr_iterator;
133 assert((!
MI.getNodePtr() ||
MI.isEnd() || !
MI->isBundledWithPred()) &&
134 "It's not legal to initialize MachineInstrBundleIterator with a "
139 assert(!
MI.isBundledWithPred() &&
"It's not legal to initialize "
140 "MachineInstrBundleIterator with a "
146 assert((!
MI || !
MI->isBundledWithPred()) &&
"It's not legal to initialize "
147 "MachineInstrBundleIterator "
148 "with a bundled MI");
152 template <
class OtherTy>
155 std::enable_if_t<std::is_convertible<OtherTy *, Ty *>::value,
void *> =
182 bool isValid()
const {
return MII.getNodePtr(); }
186 return L.MII == R.MII;
189 const const_instr_iterator &R) {
197 const nonconst_instr_iterator &R) {
205 return L == const_instr_iterator(R);
208 return const_instr_iterator(L) == R;
224 const const_instr_iterator &R) {
232 const nonconst_instr_iterator &R) {
256 this->decrement(MII);
260 this->increment(MII);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineBasicBlock iterator that automatically skips over MIs that are inside bundles (i....
friend bool operator!=(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
friend bool operator!=(const MachineInstrBundleIterator &L, const const_instr_iterator &R)
friend bool operator==(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
friend bool operator==(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
MachineInstrBundleIterator(pointer MI)
typename instr_iterator::difference_type difference_type
friend bool operator!=(const_reference L, const MachineInstrBundleIterator &R)
friend bool operator==(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
friend bool operator==(const MachineInstrBundleIterator &L, const_pointer R)
friend bool operator!=(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
friend bool operator!=(const_pointer L, const MachineInstrBundleIterator &R)
nonconst_iterator getNonConstIterator() const
MachineInstrBundleIterator(const MachineInstrBundleIterator< OtherTy, IsReverse > &I, std::enable_if_t< std::is_convertible< OtherTy *, Ty * >::value, void * >=nullptr)
friend bool operator==(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
friend bool operator==(const MachineInstrBundleIterator &L, const const_instr_iterator &R)
friend bool operator==(const MachineInstrBundleIterator &L, const_reference R)
typename instr_iterator::value_type value_type
MachineInstrBundleIterator & operator++()
friend bool operator!=(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
friend bool operator!=(const MachineInstrBundleIterator &L, const_pointer R)
typename instr_iterator::pointer pointer
MachineInstrBundleIterator & operator--()
friend bool operator==(const_reference L, const MachineInstrBundleIterator &R)
friend bool operator!=(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
instr_iterator getInstrIterator() const
MachineInstrBundleIterator(reference MI)
MachineInstrBundleIterator operator--(int)
std::bidirectional_iterator_tag iterator_category
friend bool operator!=(const MachineInstrBundleIterator &L, const_reference R)
typename instr_iterator::const_pointer const_pointer
static MachineInstrBundleIterator getAtBundleBegin(instr_iterator MI)
Get the bundle iterator for the given instruction's bundle.
MachineInstrBundleIterator(const MachineInstrBundleIterator< Ty, !IsReverse > &I)
Explicit conversion between forward/reverse iterators.
reference operator*() const
friend bool operator==(const_pointer L, const MachineInstrBundleIterator &R)
typename instr_iterator::reference reference
MachineInstrBundleIterator(instr_iterator MI)
MachineInstrBundleIterator()
typename instr_iterator::const_reference const_reference
MachineInstrBundleIterator operator++(int)
pointer operator->() const
bool isValid() const
Check for null.
A simple intrusive list implementation.
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, true, false >::type reverse_iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, true, true >::type const_reverse_iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type iterator
typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, true >::type const_iterator
This file defines classes to implement an intrusive doubly linked list class (i.e.
This is an optimization pass for GlobalISel generic memory operations.
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
static void increment(Iterator &I)
Increment forward ilist iterator.
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
static void decrement(Iterator &I)
Decrement forward ilist iterator.
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
static void decrement(Iterator &I)
Decrement reverse ilist iterator.
static void increment(Iterator &I)
Increment reverse ilist iterator.
typename list_type::iterator instr_iterator
typename list_type::iterator nonconst_instr_iterator
typename list_type::const_iterator const_instr_iterator
typename list_type::reverse_iterator nonconst_instr_iterator
typename list_type::const_reverse_iterator const_instr_iterator
typename list_type::reverse_iterator instr_iterator
typename list_type::iterator nonconst_instr_iterator
typename list_type::const_iterator const_instr_iterator
typename list_type::const_iterator instr_iterator
typename list_type::reverse_iterator nonconst_instr_iterator
typename list_type::const_reverse_iterator instr_iterator
typename list_type::const_reverse_iterator const_instr_iterator