CodeGen: Use mop_iterator instead of MIOperands/ConstMIOperands
authorMatthias Braun <matze@braunis.de>
Fri, 29 May 2015 02:56:46 +0000 (02:56 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 29 May 2015 02:56:46 +0000 (02:56 +0000)
commite41e146c16c58722307876910b8b9c9e3748c52c
tree4ef869730842e2cccea12a2e5fd7fdf0a864cf55
parent20eb9d486c5763d8894d6c5c76a95f3b7d7a05aa
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
13 files changed:
llvm/include/llvm/CodeGen/MachineInstr.h
llvm/lib/CodeGen/EarlyIfConversion.cpp
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/MachineLICM.cpp
llvm/lib/CodeGen/MachineTraceMetrics.cpp
llvm/lib/CodeGen/ProcessImplicitDefs.cpp
llvm/lib/CodeGen/RegisterCoalescer.cpp
llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp
llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
llvm/lib/Target/X86/X86FastISel.cpp