summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LivePhysRegs.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2019-12-11 09:27:01 +0000
committerFlorian Hahn <flo@fhahn.com>2019-12-11 09:34:42 +0000
commit11f311875f092e59cac2936b54f922b968e615e3 (patch)
treebb126d44e8d5642c5ced172e9fa35d9900f1cf31 /llvm/lib/CodeGen/LivePhysRegs.cpp
parent445c3fdd2ae8648cd79f98d3d72ff142b4c19792 (diff)
downloadbcm5719-llvm-11f311875f092e59cac2936b54f922b968e615e3.tar.gz
bcm5719-llvm-11f311875f092e59cac2936b54f922b968e615e3.zip
[LiveRegUnits] Add phys_regs_and_masks iterator range (NFC).
This iterator range just includes physical registers and register masks, which are interesting when dealing with register liveness. Reviewers: evandro, t.p.northover, paquette, MatzeB, arsenm Reviewed By: paquette Differential Revision: https://reviews.llvm.org/D70562
Diffstat (limited to 'llvm/lib/CodeGen/LivePhysRegs.cpp')
-rw-r--r--llvm/lib/CodeGen/LivePhysRegs.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp
index bdb165bbc90..7a5cffca347 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());
}
}
OpenPOWER on IntegriCloud