summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-05-29 02:56:46 +0000
committerMatthias Braun <matze@braunis.de>2015-05-29 02:56:46 +0000
commite41e146c16c58722307876910b8b9c9e3748c52c (patch)
tree4ef869730842e2cccea12a2e5fd7fdf0a864cf55 /llvm/lib/CodeGen/ProcessImplicitDefs.cpp
parent20eb9d486c5763d8894d6c5c76a95f3b7d7a05aa (diff)
downloadbcm5719-llvm-e41e146c16c58722307876910b8b9c9e3748c52c.tar.gz
bcm5719-llvm-e41e146c16c58722307876910b8b9c9e3748c52c.zip
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. llvm-svn: 238539
Diffstat (limited to 'llvm/lib/CodeGen/ProcessImplicitDefs.cpp')
-rw-r--r--llvm/lib/CodeGen/ProcessImplicitDefs.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/ProcessImplicitDefs.cpp b/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
index b1538006e72..5f819498348 100644
--- a/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
+++ b/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
@@ -68,8 +68,8 @@ bool ProcessImplicitDefs::canTurnIntoImplicitDef(MachineInstr *MI) {
!MI->isRegSequence() &&
!MI->isPHI())
return false;
- for (MIOperands MO(MI); MO.isValid(); ++MO)
- if (MO->isReg() && MO->isUse() && MO->readsReg())
+ for (const MachineOperand &MO : MI->operands())
+ if (MO.isReg() && MO.isUse() && MO.readsReg())
return false;
return true;
}
@@ -100,17 +100,17 @@ void ProcessImplicitDefs::processImplicitDef(MachineInstr *MI) {
MachineBasicBlock::instr_iterator UserE = MI->getParent()->instr_end();
bool Found = false;
for (++UserMI; UserMI != UserE; ++UserMI) {
- for (MIOperands MO(UserMI); MO.isValid(); ++MO) {
- if (!MO->isReg())
+ for (MachineOperand &MO : UserMI->operands()) {
+ if (!MO.isReg())
continue;
- unsigned UserReg = MO->getReg();
+ unsigned UserReg = MO.getReg();
if (!TargetRegisterInfo::isPhysicalRegister(UserReg) ||
!TRI->regsOverlap(Reg, UserReg))
continue;
// UserMI uses or redefines Reg. Set <undef> flags on all uses.
Found = true;
- if (MO->isUse())
- MO->setIsUndef();
+ if (MO.isUse())
+ MO.setIsUndef();
}
if (Found)
break;
OpenPOWER on IntegriCloud