mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-08 18:30:04 +00:00
MCRegisterInfo: Add MCSubRegIndexIterator.
This iterator iterates over subregister and their associated subregister indices at the same time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223893 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
668132490c
commit
d7965336f9
@ -233,6 +233,7 @@ public:
|
|||||||
// These iterators are allowed to sub-class DiffListIterator and access
|
// These iterators are allowed to sub-class DiffListIterator and access
|
||||||
// internal list pointers.
|
// internal list pointers.
|
||||||
friend class MCSubRegIterator;
|
friend class MCSubRegIterator;
|
||||||
|
friend class MCSubRegIndexIterator;
|
||||||
friend class MCSuperRegIterator;
|
friend class MCSuperRegIterator;
|
||||||
friend class MCRegUnitIterator;
|
friend class MCRegUnitIterator;
|
||||||
friend class MCRegUnitMaskIterator;
|
friend class MCRegUnitMaskIterator;
|
||||||
@ -461,6 +462,38 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Iterator that enumerates the sub-registers of a Reg and the associated
|
||||||
|
/// sub-register indices.
|
||||||
|
class MCSubRegIndexIterator {
|
||||||
|
MCSubRegIterator SRIter;
|
||||||
|
const uint16_t *SRIndex;
|
||||||
|
public:
|
||||||
|
/// Constructs an iterator that traverses subregisters and their
|
||||||
|
/// associated subregister indices.
|
||||||
|
MCSubRegIndexIterator(unsigned Reg, const MCRegisterInfo *MCRI)
|
||||||
|
: SRIter(Reg, MCRI) {
|
||||||
|
SRIndex = MCRI->SubRegIndices + MCRI->get(Reg).SubRegIndices;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns current sub-register.
|
||||||
|
unsigned getSubReg() const {
|
||||||
|
return *SRIter;
|
||||||
|
}
|
||||||
|
/// Returns sub-register index of the current sub-register.
|
||||||
|
unsigned getSubRegIndex() const {
|
||||||
|
return *SRIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if this iterator is not yet at the end.
|
||||||
|
bool isValid() const { return SRIter.isValid(); }
|
||||||
|
|
||||||
|
/// Moves to the next position.
|
||||||
|
void operator++() {
|
||||||
|
++SRIter;
|
||||||
|
++SRIndex;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// MCSuperRegIterator enumerates all super-registers of Reg.
|
/// MCSuperRegIterator enumerates all super-registers of Reg.
|
||||||
/// If IncludeSelf is set, Reg itself is included in the list.
|
/// If IncludeSelf is set, Reg itself is included in the list.
|
||||||
class MCSuperRegIterator : public MCRegisterInfo::DiffListIterator {
|
class MCSuperRegIterator : public MCRegisterInfo::DiffListIterator {
|
||||||
|
Loading…
Reference in New Issue
Block a user