Index: llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h +++ llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h @@ -24,6 +24,11 @@ return P.match(MRI, R); } +template +bool mi_match(MachineInstr &MI, const MachineRegisterInfo &MRI, Pattern &&P) { + return P.match(MRI, &MI); +} + // TODO: Extend for N use. template struct OneUse_match { SubPatternT SubPat; @@ -181,6 +186,13 @@ return true; return false; } + static bool bind(const MachineRegisterInfo &MRI, MachineInstr *&MI, + MachineInstr *Inst) { + MI = Inst; + if (MI) + return true; + return false; + } }; template <> struct bind_helper {