14 #ifndef LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
15 #define LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
53 while (I->isBundledWithPred())
61 while (I->isBundledWithSucc())
67 template <
class Iterator>
static void increment(Iterator &
I) {
68 I = std::next(getBundleFinal(I));
72 template <
class Iterator>
static void decrement(Iterator &
I) {
73 I = getBundleBegin(std::prev(I));
93 template <
class Iterator>
static void increment(Iterator &
I) {
94 I = getBundleBegin(std::next(I));
98 template <
class Iterator>
static void decrement(Iterator &
I) {
99 I = std::prev(getBundleFinal(I));
105 template <
typename Ty,
bool IsReverse = false>
108 typedef typename Traits::instr_iterator instr_iterator;
114 typedef typename instr_iterator::pointer
pointer;
122 typedef typename Traits::nonconst_instr_iterator nonconst_instr_iterator;
123 typedef typename Traits::const_instr_iterator const_instr_iterator;
125 typename nonconst_instr_iterator::value_type, IsReverse>
131 assert((!MI.getNodePtr() || MI.isEnd() || !MI->isBundledWithPred()) &&
132 "It's not legal to initialize MachineInstrBundleIterator with a "
137 assert(!MI.isBundledWithPred() &&
"It's not legal to initialize "
138 "MachineInstrBundleIterator with a "
143 assert((!MI || !MI->isBundledWithPred()) &&
"It's not legal to initialize "
144 "MachineInstrBundleIterator "
145 "with a bundled MI");
148 template <
class OtherTy>
151 typename std::enable_if<std::is_convertible<OtherTy *, Ty *>::value,
152 void *>::type =
nullptr)
177 bool isValid()
const {
return MII.getNodePtr(); }
181 return L.MII == R.MII;
184 const const_instr_iterator &R) {
192 const nonconst_instr_iterator &R) {
200 return L == const_instr_iterator(R);
203 return const_instr_iterator(L) == R;
219 const const_instr_iterator &R) {
227 const nonconst_instr_iterator &R) {
251 this->decrement(MII);
255 this->increment(MII);
MachineInstrBundleIterator & operator--()
list_type::const_iterator const_instr_iterator
static void decrement(Iterator &I)
Decrement reverse ilist iterator.
instr_iterator::const_reference const_reference
list_type::const_reverse_iterator const_instr_iterator
MachineInstrBundleIterator(const MachineInstrBundleIterator< OtherTy, IsReverse > &I, typename std::enable_if< std::is_convertible< OtherTy *, Ty * >::value, void * >::type=nullptr)
friend bool operator!=(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
instr_iterator::difference_type difference_type
instr_iterator::reference reference
friend bool operator!=(const_reference L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator()
nonconst_iterator getNonConstIterator() const
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
friend bool operator==(const MachineInstrBundleIterator &L, const_pointer R)
simple_ilist< T, ilist_sentinel_tracking< true > > list_type
list_type::iterator instr_iterator
MachineBasicBlock iterator that automatically skips over MIs that are inside bundles (i...
friend bool operator!=(const MachineInstrBundleIterator &L, const_reference R)
static void increment(Iterator &I)
Increment forward ilist iterator.
friend bool operator==(const MachineInstrBundleIterator &L, const const_instr_iterator &R)
friend bool operator==(const_pointer L, const MachineInstrBundleIterator &R)
list_type::reverse_iterator nonconst_instr_iterator
A simple intrusive list implementation.
simple_ilist< T, ilist_sentinel_tracking< true > > list_type
list_type::reverse_iterator instr_iterator
Function Alias Analysis false
pointer operator->() const
friend bool operator==(const MachineInstrBundleIterator &L, const_reference R)
instr_iterator::value_type value_type
friend bool operator!=(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
friend bool operator!=(const_pointer L, const MachineInstrBundleIterator &R)
friend bool operator!=(const MachineInstrBundleIterator &L, const_pointer R)
list_type::iterator nonconst_instr_iterator
MachineInstrBundleIterator(pointer MI)
std::bidirectional_iterator_tag iterator_category
static MachineInstrBundleIterator getAtBundleBegin(instr_iterator MI)
Get the bundle iterator for the given instruction's bundle.
friend bool operator!=(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
MachineInstrBundleIterator(reference MI)
MachineInstrBundleIterator(const MachineInstrBundleIterator< Ty,!IsReverse > &I)
Explicit conversion between forward/reverse iterators.
Iterator for intrusive lists based on ilist_node.
instr_iterator::pointer pointer
simple_ilist< T, ilist_sentinel_tracking< true > > list_type
list_type::reverse_iterator nonconst_instr_iterator
MachineInstrBundleIterator operator++(int)
instr_iterator getInstrIterator() const
list_type::const_reverse_iterator instr_iterator
list_type::const_iterator instr_iterator
friend bool operator==(const_reference L, const MachineInstrBundleIterator &R)
list_type::const_reverse_iterator const_instr_iterator
MachineInstrBundleIterator & operator++()
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
friend bool operator==(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator(instr_iterator MI)
list_type::iterator nonconst_instr_iterator
static void increment(Iterator &I)
Increment reverse ilist iterator.
friend bool operator==(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator operator--(int)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void decrement(Iterator &I)
Decrement forward ilist iterator.
friend bool operator==(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
friend bool operator!=(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
reference operator*() const
bool isValid() const
Check for null.
simple_ilist< T, ilist_sentinel_tracking< true > > list_type
list_type::const_iterator const_instr_iterator
friend bool operator!=(const MachineInstrBundleIterator &L, const const_instr_iterator &R)
friend bool operator==(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
instr_iterator::const_pointer const_pointer