diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-02-11 13:25:24 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-02-11 13:25:24 +0000 |
| commit | 3897d3b845ab73af1f4abd7fd8cc6e43925af1b4 (patch) | |
| tree | e11f1177f7adb0f4c18009faf801850cfcd667cb /include/llvm/CodeGen/MachineInstrBundleIterator.h | |
| parent | 963c784e8cd41cd556d0f19e090268b2e574e9f0 (diff) | |
Notes
Diffstat (limited to 'include/llvm/CodeGen/MachineInstrBundleIterator.h')
| -rw-r--r-- | include/llvm/CodeGen/MachineInstrBundleIterator.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineInstrBundleIterator.h b/include/llvm/CodeGen/MachineInstrBundleIterator.h index 2d77cfcae20f8..3104185385eaf 100644 --- a/include/llvm/CodeGen/MachineInstrBundleIterator.h +++ b/include/llvm/CodeGen/MachineInstrBundleIterator.h @@ -153,6 +153,18 @@ public: : MII(I.getInstrIterator()) {} MachineInstrBundleIterator() : MII(nullptr) {} + /// Explicit conversion between forward/reverse iterators. + /// + /// Translate between forward and reverse iterators without changing range + /// boundaries. The resulting iterator will dereference (and have a handle) + /// to the previous node, which is somewhat unexpected; but converting the + /// two endpoints in a range will give the same range in reverse. + /// + /// This matches std::reverse_iterator conversions. + explicit MachineInstrBundleIterator( + const MachineInstrBundleIterator<Ty, !IsReverse> &I) + : MachineInstrBundleIterator(++I.getReverse()) {} + /// Get the bundle iterator for the given instruction's bundle. static MachineInstrBundleIterator getAtBundleBegin(instr_iterator MI) { return MachineInstrBundleIteratorHelper<IsReverse>::getBundleBegin(MI); @@ -258,6 +270,11 @@ public: nonconst_iterator getNonConstIterator() const { return MII.getNonConst(); } + /// Get a reverse iterator to the same node. + /// + /// Gives a reverse iterator that will dereference (and have a handle) to the + /// same node. Converting the endpoint iterators in a range will give a + /// different range; for range operations, use the explicit conversions. reverse_iterator getReverse() const { return MII.getReverse(); } }; |
