diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-24 22:00:03 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-24 22:00:03 +0000 |
commit | 480093f4440d54b30b3025afeac24b48f2ba7a2e (patch) | |
tree | 162e72994062888647caf0d875428db9445491a8 /contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp | |
parent | 489b1cf2ecf5b9b4a394857987014bfb09067726 (diff) | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp index feb849ced353..94865b0e9031 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineInstrBundle.cpp @@ -15,6 +15,7 @@ #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/InitializePasses.h" #include "llvm/Target/TargetMachine.h" #include <utility> using namespace llvm; @@ -277,22 +278,18 @@ bool llvm::finalizeBundles(MachineFunction &MF) { return Changed; } -//===----------------------------------------------------------------------===// -// MachineOperand iterator -//===----------------------------------------------------------------------===// - -MachineOperandIteratorBase::VirtRegInfo -MachineOperandIteratorBase::analyzeVirtReg(unsigned Reg, - SmallVectorImpl<std::pair<MachineInstr*, unsigned> > *Ops) { - VirtRegInfo RI = { false, false, false }; - for(; isValid(); ++*this) { - MachineOperand &MO = deref(); +VirtRegInfo llvm::AnalyzeVirtRegInBundle( + MachineInstr &MI, unsigned Reg, + SmallVectorImpl<std::pair<MachineInstr *, unsigned>> *Ops) { + VirtRegInfo RI = {false, false, false}; + for (MIBundleOperands O(MI); O.isValid(); ++O) { + MachineOperand &MO = *O; if (!MO.isReg() || MO.getReg() != Reg) continue; // Remember each (MI, OpNo) that refers to Reg. if (Ops) - Ops->push_back(std::make_pair(MO.getParent(), getOperandNo())); + Ops->push_back(std::make_pair(MO.getParent(), O.getOperandNo())); // Both defs and uses can read virtual registers. if (MO.readsReg()) { @@ -304,22 +301,22 @@ MachineOperandIteratorBase::analyzeVirtReg(unsigned Reg, // Only defs can write. if (MO.isDef()) RI.Writes = true; - else if (!RI.Tied && MO.getParent()->isRegTiedToDefOperand(getOperandNo())) + else if (!RI.Tied && + MO.getParent()->isRegTiedToDefOperand(O.getOperandNo())) RI.Tied = true; } return RI; } -MachineOperandIteratorBase::PhysRegInfo -MachineOperandIteratorBase::analyzePhysReg(unsigned Reg, - const TargetRegisterInfo *TRI) { +PhysRegInfo llvm::AnalyzePhysRegInBundle(const MachineInstr &MI, unsigned Reg, + const TargetRegisterInfo *TRI) { bool AllDefsDead = true; PhysRegInfo PRI = {false, false, false, false, false, false, false, false}; assert(Register::isPhysicalRegister(Reg) && "analyzePhysReg not given a physical register!"); - for (; isValid(); ++*this) { - MachineOperand &MO = deref(); + for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { + const MachineOperand &MO = *O; if (MO.isRegMask() && MO.clobbersPhysReg(Reg)) { PRI.Clobbered = true; |