mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
CodeGen: Use mop_iterator instead of MIOperands/ConstMIOperands
MIOperands/ConstMIOperands are classes iterating over the MachineOperand of a MachineInstr, however MachineInstr::mop_iterator does the same thing. I assume these two iterators exist to have a uniform interface to iterate over the operands of a machine instruction bundle and a single machine instruction. However in practice I find it more confusing to have 2 different iterator classes, so this patch transforms (nearly all) the code to use mop_iterators. The only exception being MIOperands::anlayzePhysReg() and MIOperands::analyzeVirtReg() still needing an equivalent, I leave that as an exercise for the next patch. Differential Revision: http://reviews.llvm.org/D9932 This version is slightly modified from the proposed revision in that it introduces MachineInstr::getOperandNo to avoid the extra counting variable in the few loops that previously used MIOperands::getOperandNo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -223,11 +223,11 @@ void LiveIntervals::computeRegMasks() {
|
||||
RMB.first = RegMaskSlots.size();
|
||||
for (MachineBasicBlock::iterator MI = MBB->begin(), ME = MBB->end();
|
||||
MI != ME; ++MI)
|
||||
for (MIOperands MO(MI); MO.isValid(); ++MO) {
|
||||
if (!MO->isRegMask())
|
||||
for (const MachineOperand &MO : MI->operands()) {
|
||||
if (!MO.isRegMask())
|
||||
continue;
|
||||
RegMaskSlots.push_back(Indexes->getInstructionIndex(MI).getRegSlot());
|
||||
RegMaskBits.push_back(MO->getRegMask());
|
||||
RegMaskBits.push_back(MO.getRegMask());
|
||||
}
|
||||
// Compute the number of register mask instructions in this block.
|
||||
RMB.second = RegMaskSlots.size() - RMB.first;
|
||||
@@ -927,23 +927,23 @@ public:
|
||||
void updateAllRanges(MachineInstr *MI) {
|
||||
DEBUG(dbgs() << "handleMove " << OldIdx << " -> " << NewIdx << ": " << *MI);
|
||||
bool hasRegMask = false;
|
||||
for (MIOperands MO(MI); MO.isValid(); ++MO) {
|
||||
if (MO->isRegMask())
|
||||
for (MachineOperand &MO : MI->operands()) {
|
||||
if (MO.isRegMask())
|
||||
hasRegMask = true;
|
||||
if (!MO->isReg())
|
||||
if (!MO.isReg())
|
||||
continue;
|
||||
// Aggressively clear all kill flags.
|
||||
// They are reinserted by VirtRegRewriter.
|
||||
if (MO->isUse())
|
||||
MO->setIsKill(false);
|
||||
if (MO.isUse())
|
||||
MO.setIsKill(false);
|
||||
|
||||
unsigned Reg = MO->getReg();
|
||||
unsigned Reg = MO.getReg();
|
||||
if (!Reg)
|
||||
continue;
|
||||
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
||||
LiveInterval &LI = LIS.getInterval(Reg);
|
||||
if (LI.hasSubRanges()) {
|
||||
unsigned SubReg = MO->getSubReg();
|
||||
unsigned SubReg = MO.getSubReg();
|
||||
unsigned LaneMask = TRI.getSubRegIndexLaneMask(SubReg);
|
||||
for (LiveInterval::SubRange &S : LI.subranges()) {
|
||||
if ((S.LaneMask & LaneMask) == 0)
|
||||
|
Reference in New Issue
Block a user