diff options
Diffstat (limited to 'llvm/include/llvm/CodeGen/LiveRegUnits.h')
-rw-r--r-- | llvm/include/llvm/CodeGen/LiveRegUnits.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveRegUnits.h b/llvm/include/llvm/CodeGen/LiveRegUnits.h index 314afad92970..1ed091e3bb5e 100644 --- a/llvm/include/llvm/CodeGen/LiveRegUnits.h +++ b/llvm/include/llvm/CodeGen/LiveRegUnits.h @@ -160,6 +160,19 @@ private: void addPristines(const MachineFunction &MF); }; +/// Returns an iterator range over all physical register and mask operands for +/// \p MI and bundled instructions. This also skips any debug operands. +inline iterator_range<filter_iterator< + ConstMIBundleOperands, std::function<bool(const MachineOperand &)>>> +phys_regs_and_masks(const MachineInstr &MI) { + std::function<bool(const MachineOperand &)> Pred = + [](const MachineOperand &MOP) { + return MOP.isRegMask() || (MOP.isReg() && !MOP.isDebug() && + Register::isPhysicalRegister(MOP.getReg())); + }; + return make_filter_range(const_mi_bundle_ops(MI), Pred); +} + } // end namespace llvm #endif // LLVM_CODEGEN_LIVEREGUNITS_H |