diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /llvm/lib/CodeGen/LivePhysRegs.cpp | |
parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) |
Notes
Diffstat (limited to 'llvm/lib/CodeGen/LivePhysRegs.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LivePhysRegs.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp index c2a1cc7c6490..7a5cffca3470 100644 --- a/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LivePhysRegs.h" +#include "llvm/CodeGen/LiveRegUnits.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBundle.h" @@ -42,28 +43,23 @@ void LivePhysRegs::removeRegsInMask(const MachineOperand &MO, /// Remove defined registers and regmask kills from the set. void LivePhysRegs::removeDefs(const MachineInstr &MI) { - for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { - if (O->isReg()) { - if (!O->isDef() || O->isDebug()) - continue; - Register Reg = O->getReg(); - if (!Register::isPhysicalRegister(Reg)) - continue; - removeReg(Reg); - } else if (O->isRegMask()) - removeRegsInMask(*O); + for (const MachineOperand &MOP : phys_regs_and_masks(MI)) { + if (MOP.isRegMask()) { + removeRegsInMask(MOP); + continue; + } + + if (MOP.isDef()) + removeReg(MOP.getReg()); } } /// Add uses to the set. void LivePhysRegs::addUses(const MachineInstr &MI) { - for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { - if (!O->isReg() || !O->readsReg() || O->isDebug()) - continue; - Register Reg = O->getReg(); - if (!Register::isPhysicalRegister(Reg)) + for (const MachineOperand &MOP : phys_regs_and_masks(MI)) { + if (!MOP.isReg() || !MOP.readsReg()) continue; - addReg(Reg); + addReg(MOP.getReg()); } } @@ -116,7 +112,7 @@ void LivePhysRegs::stepForward(const MachineInstr &MI, } } -/// Prin the currently live registers to OS. +/// Print the currently live registers to OS. void LivePhysRegs::print(raw_ostream &OS) const { OS << "Live Registers:"; if (!TRI) { |