14 #ifndef LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H 15 #define LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H 21 #include <type_traits> 56 while (I->isBundledWithPred())
64 while (I->isBundledWithSucc())
70 template <
class Iterator>
static void increment(Iterator &
I) {
71 I = std::next(getBundleFinal(I));
75 template <
class Iterator>
static void decrement(Iterator &
I) {
76 I = getBundleBegin(std::prev(I));
96 template <
class Iterator>
static void increment(Iterator &
I) {
97 I = getBundleBegin(std::next(I));
101 template <
class Iterator>
static void decrement(Iterator &
I) {
102 I = std::prev(getBundleFinal(I));
108 template <
typename Ty,
bool IsReverse = false>
111 using instr_iterator =
typename Traits::instr_iterator;
118 using pointer =
typename instr_iterator::pointer;
125 using nonconst_instr_iterator =
typename Traits::nonconst_instr_iterator;
126 using const_instr_iterator =
typename Traits::const_instr_iterator;
134 assert((!MI.getNodePtr() || MI.isEnd() || !MI->isBundledWithPred()) &&
135 "It's not legal to initialize MachineInstrBundleIterator with a " 140 assert(!MI.isBundledWithPred() &&
"It's not legal to initialize " 141 "MachineInstrBundleIterator with a " 147 assert((!MI || !MI->isBundledWithPred()) &&
"It's not legal to initialize " 148 "MachineInstrBundleIterator " 149 "with a bundled MI");
153 template <
class OtherTy>
156 typename std::enable_if<std::is_convertible<OtherTy *, Ty *>::value,
157 void *>::
type =
nullptr)
158 : MII(I.getInstrIterator()) {}
183 bool isValid()
const {
return MII.getNodePtr(); }
187 return L.MII == R.MII;
190 const const_instr_iterator &R) {
198 const nonconst_instr_iterator &R) {
206 return L == const_instr_iterator(R);
209 return const_instr_iterator(L) == R;
225 const const_instr_iterator &R) {
233 const nonconst_instr_iterator &R) {
257 this->decrement(MII);
261 this->increment(MII);
289 #endif // LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H MachineInstrBundleIterator & operator--()
typename list_type::iterator nonconst_instr_iterator
static void decrement(Iterator &I)
Decrement reverse ilist iterator.
This class represents lattice values for constants.
typename instr_iterator::reference reference
typename list_type::const_iterator const_instr_iterator
typename list_type::reverse_iterator nonconst_instr_iterator
friend bool operator!=(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
MachineInstrBundleIterator(const MachineInstrBundleIterator< Ty, !IsReverse > &I)
Explicit conversion between forward/reverse iterators.
block Block Frequency true
friend bool operator!=(const_reference L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator()
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
typename list_type::const_reverse_iterator instr_iterator
friend bool operator==(const MachineInstrBundleIterator &L, const_pointer R)
typename instr_iterator::const_pointer const_pointer
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)
typename instr_iterator::difference_type difference_type
APInt operator*(APInt a, uint64_t RHS)
typename list_type::const_iterator instr_iterator
friend bool operator==(const_pointer L, const MachineInstrBundleIterator &R)
A simple intrusive list implementation.
typename list_type::reverse_iterator instr_iterator
instr_iterator getInstrIterator() const
typename list_type::const_iterator const_instr_iterator
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
std::bidirectional_iterator_tag iterator_category
friend bool operator==(const MachineInstrBundleIterator &L, const_reference R)
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)
typename instr_iterator::value_type value_type
typename list_type::const_reverse_iterator const_instr_iterator
MachineInstrBundleIterator(pointer MI)
static MachineInstrBundleIterator getAtBundleBegin(instr_iterator MI)
Get the bundle iterator for the given instruction's bundle.
bool isValid() const
Check for null.
friend bool operator!=(const nonconst_instr_iterator &L, const MachineInstrBundleIterator &R)
static Iterator getBundleFinal(Iterator I)
Get the final node of the current bundle.
MachineInstrBundleIterator(reference MI)
Iterator for intrusive lists based on ilist_node.
typename list_type::iterator nonconst_instr_iterator
typename list_type::iterator instr_iterator
MachineInstrBundleIterator operator++(int)
friend bool operator==(const_reference L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator & operator++()
pointer operator->() const
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.
typename list_type::const_reverse_iterator const_instr_iterator
friend bool operator==(const MachineInstrBundleIterator &L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator(instr_iterator MI)
MachineInstrBundleIterator(const MachineInstrBundleIterator< OtherTy, IsReverse > &I, typename std::enable_if< std::is_convertible< OtherTy *, Ty *>::value, void *>::type=nullptr)
static void increment(Iterator &I)
Increment reverse ilist iterator.
friend bool operator==(const const_instr_iterator &L, const MachineInstrBundleIterator &R)
MachineInstrBundleIterator operator--(int)
typename list_type::reverse_iterator nonconst_instr_iterator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
typename instr_iterator::const_reference const_reference
reference operator*() const
static void decrement(Iterator &I)
Decrement forward ilist iterator.
typename instr_iterator::pointer pointer
nonconst_iterator getNonConstIterator() const
friend bool operator==(const MachineInstrBundleIterator &L, const nonconst_instr_iterator &R)
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)
static Iterator getBundleBegin(Iterator I)
Get the beginning of the current bundle.