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)
commite67bd6c248e21e9b55a7d86b8ccfaef1ed70bf8a
treed64e98f4e4bd2cf26a51be7bd0139929d4d25f04
parent7e31fe7e20d75a0629092edab0844c45ed79eb82
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
13 files changed:
include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/EarlyIfConversion.cpp
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/MachineInstr.cpp
lib/CodeGen/MachineLICM.cpp
lib/CodeGen/MachineTraceMetrics.cpp
lib/CodeGen/ProcessImplicitDefs.cpp
lib/CodeGen/RegisterCoalescer.cpp
lib/CodeGen/ScheduleDAGInstrs.cpp
lib/Target/ARM/ARMLoadStoreOptimizer.cpp
lib/Target/ARM/Thumb2ITBlockPass.cpp
lib/Target/Hexagon/HexagonFrameLowering.cpp
lib/Target/X86/X86FastISel.cpp