Go to the documentation of this file.
13 #ifndef LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
14 #define LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
20 #include <type_traits>
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));
107 template <
typename Ty,
bool IsReverse = false>
110 using instr_iterator =
typename Traits::instr_iterator;
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) {
288 #endif // LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
friend bool operator==(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
typename list_type::reverse_iterator instr_iterator
This is an optimization pass for GlobalISel generic memory operations.
friend bool operator==(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
typename instr_iterator::const_pointer const_pointer
typename list_type::const_iterator const_instr_iterator
MachineInstrBundleIterator & operator--()
Replace within non kernel function use of LDS with pointer
typename instr_iterator::pointer pointer
friend bool operator!=(const_reference L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator operator--(int)
typename list_type::iterator nonconst_instr_iterator
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
friend bool operator!=(const MachineInstrBundleIterator &L, const const_instr_iterator &R)
reference operator*() const
typename instr_iterator::const_reference const_reference
typename list_type::reverse_iterator nonconst_instr_iterator
static void decrement(Iterator &I)
Decrement forward ilist iterator.
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
friend bool operator!=(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
std::bidirectional_iterator_tag iterator_category
MachineInstrBundleIterator(const MachineInstrBundleIterator< Ty, !IsReverse > &I)
Explicit conversion between forward/reverse iterators.
static void increment(Iterator &I)
Increment forward ilist iterator.
friend bool operator==(const_pointer L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator()
typename list_type::const_reverse_iterator const_instr_iterator
friend bool operator!=(const MachineInstrBundleIterator &L, const_reference R)
friend bool operator!=(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
bool isValid() const
Check for null.
static void decrement(Iterator &I)
Decrement reverse ilist iterator.
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_reference R)
friend bool operator==(const MachineInstrBundleIterator &L, const const_instr_iterator &R)
typename list_type::const_reverse_iterator instr_iterator
typename list_type::const_iterator const_instr_iterator
typename instr_iterator::difference_type difference_type
typename list_type::const_iterator instr_iterator
instr_iterator getInstrIterator() const
friend bool operator!=(const_pointer L, const MachineInstrBundleIterator &R)
friend bool operator!=(const MachineInstrBundleIterator &L, const_pointer R)
typename instr_iterator::value_type value_type
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
friend bool operator!=(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
static MachineInstrBundleIterator getAtBundleBegin(instr_iterator MI)
Get the bundle iterator for the given instruction's bundle.
MachineInstrBundleIterator(reference MI)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
typename list_type::iterator nonconst_instr_iterator
MachineInstrBundleIterator(pointer MI)
friend bool operator==(const_reference L, const MachineInstrBundleIterator &R)
friend bool operator!=(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator operator++(int)
typename list_type::iterator instr_iterator
static void increment(Iterator &I)
Increment reverse ilist iterator.
MachineInstrBundleIterator(instr_iterator MI)
Iterator for intrusive lists based on ilist_node.
nonconst_iterator getNonConstIterator() const
friend bool operator==(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
pointer operator->() const
typename list_type::const_reverse_iterator const_instr_iterator
typename list_type::reverse_iterator nonconst_instr_iterator
A simple intrusive list implementation.
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
MachineInstrBundleIterator & operator++()
typename instr_iterator::reference reference
friend bool operator==(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
MachineBasicBlock iterator that automatically skips over MIs that are inside bundles (i....
friend bool operator==(const MachineInstrBundleIterator &L, const_pointer R)