mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Add MCRI::getNumSubRegIndices() and start checking SubRegIndex ranges.
Apparently, NumSubRegIndices was completely unused before. Adjust it by one to include the null subreg index, just like getNumRegs() includes the null register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163628 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -24,6 +24,8 @@ unsigned MCRegisterInfo::getMatchingSuperReg(unsigned Reg, unsigned SubIdx,
|
||||
}
|
||||
|
||||
unsigned MCRegisterInfo::getSubReg(unsigned Reg, unsigned Idx) const {
|
||||
assert(Idx && Idx < getNumSubRegIndices() &&
|
||||
"This is not a subregister index");
|
||||
// Get a pointer to the corresponding SubRegIndices list. This list has the
|
||||
// name of each sub-register in the same order as MCSubRegIterator.
|
||||
const uint16_t *SRI = SubRegIndices + get(Reg).SubRegIndices;
|
||||
@@ -34,6 +36,7 @@ unsigned MCRegisterInfo::getSubReg(unsigned Reg, unsigned Idx) const {
|
||||
}
|
||||
|
||||
unsigned MCRegisterInfo::getSubRegIndex(unsigned Reg, unsigned SubReg) const {
|
||||
assert(SubReg && SubReg < getNumRegs() && "This is not a register");
|
||||
// Get a pointer to the corresponding SubRegIndices list. This list has the
|
||||
// name of each sub-register in the same order as MCSubRegIterator.
|
||||
const uint16_t *SRI = SubRegIndices + get(Reg).SubRegIndices;
|
||||
|
||||
Reference in New Issue
Block a user