Index: include/llvm/CodeGen/TargetInstrInfo.h =================================================================== --- include/llvm/CodeGen/TargetInstrInfo.h +++ include/llvm/CodeGen/TargetInstrInfo.h @@ -848,8 +848,9 @@ /// If the specific machine instruction is a instruction that moves/copies /// value from one register to another register return true along with /// @Source machine operand and @Destination machine operand. - virtual bool isCopyInstr(const MachineInstr &MI, MachineOperand &Source, - MachineOperand &Destination) const { + virtual bool isCopyInstr(const MachineInstr &MI, + const MachineOperand **SourceOpNum, + const MachineOperand **Destination) const { return false; } Index: lib/Target/ARM/ARMBaseInstrInfo.h =================================================================== --- lib/Target/ARM/ARMBaseInstrInfo.h +++ lib/Target/ARM/ARMBaseInstrInfo.h @@ -201,8 +201,8 @@ const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override; - bool isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const override; + bool isCopyInstr(const MachineInstr &MI, const MachineOperand **Src, + const MachineOperand **Dest) const override; void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Index: lib/Target/ARM/ARMBaseInstrInfo.cpp =================================================================== --- lib/Target/ARM/ARMBaseInstrInfo.cpp +++ lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -935,8 +935,9 @@ Mov->addRegisterKilled(SrcReg, TRI); } -bool ARMBaseInstrInfo::isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const { +bool ARMBaseInstrInfo::isCopyInstr(const MachineInstr &MI, + const MachineOperand **Src, + const MachineOperand **Dest) const { // VMOVRRD is also a copy instruction but it requires // special way of handling. It is more complex copy version // and since that we are not considering it. For recognition @@ -948,8 +949,8 @@ (MI.getOpcode() == ARM::VORRq && MI.getOperand(1).getReg() != MI.getOperand(2).getReg())) return false; - Dest = MI.getOperand(0); - Src = MI.getOperand(1); + *Dest = &MI.getOperand(0); + *Src = &MI.getOperand(1); return true; } Index: lib/Target/Mips/Mips16InstrInfo.h =================================================================== --- lib/Target/Mips/Mips16InstrInfo.h +++ lib/Target/Mips/Mips16InstrInfo.h @@ -53,8 +53,8 @@ const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override; - bool isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const override; + bool isCopyInstr(const MachineInstr &MI, const MachineOperand **Src, + const MachineOperand **Dest) const override; void storeRegToStack(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Index: lib/Target/Mips/Mips16InstrInfo.cpp =================================================================== --- lib/Target/Mips/Mips16InstrInfo.cpp +++ lib/Target/Mips/Mips16InstrInfo.cpp @@ -97,11 +97,12 @@ MIB.addReg(SrcReg, getKillRegState(KillSrc)); } -bool Mips16InstrInfo::isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const { +bool Mips16InstrInfo::isCopyInstr(const MachineInstr &MI, + const MachineOperand **Src, + const MachineOperand **Dest) const { if (MI.isMoveReg()) { - Dest = MI.getOperand(0); - Src = MI.getOperand(1); + *Dest = &MI.getOperand(0); + *Src = &MI.getOperand(1); return true; } return false; Index: lib/Target/Mips/MipsSEInstrInfo.h =================================================================== --- lib/Target/Mips/MipsSEInstrInfo.h +++ lib/Target/Mips/MipsSEInstrInfo.h @@ -47,8 +47,8 @@ const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override; - bool isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const override; + bool isCopyInstr(const MachineInstr &MI, const MachineOperand **Src, + const MachineOperand **Dest) const override; void storeRegToStack(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Index: lib/Target/Mips/MipsSEInstrInfo.cpp =================================================================== --- lib/Target/Mips/MipsSEInstrInfo.cpp +++ lib/Target/Mips/MipsSEInstrInfo.cpp @@ -211,25 +211,26 @@ /// We check for the common case of 'or', as it's MIPS' preferred instruction /// for GPRs but we have to check the operands to ensure that is the case. /// Other move instructions for MIPS are directly identifiable. -bool MipsSEInstrInfo::isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const { +bool MipsSEInstrInfo::isCopyInstr(const MachineInstr &MI, + const MachineOperand **Src, + const MachineOperand **Dest) const { bool isDSPControlWrite = false; // Condition is made to match the creation of WRDSP/RDDSP copy instruction // from copyPhysReg function. if (isReadOrWritToDSPReg(MI, isDSPControlWrite)) { - if (!MI.getOperand(1).isImm() || !(MI.getOperand(1).getImm() == (1<<4))) + if (!MI.getOperand(1).isImm() || MI.getOperand(1).getImm() != (1<<4)) return false; else if (isDSPControlWrite) { - Src = MI.getOperand(0); - Dest = MI.getOperand(2); + *Src = &MI.getOperand(0); + *Dest = &MI.getOperand(2); } else { - Dest = MI.getOperand(0); - Src = MI.getOperand(2); + *Dest = &MI.getOperand(0); + *Src = &MI.getOperand(2); } return true; } else if (MI.isMoveReg() || isORCopyInst(MI)) { - Dest = MI.getOperand(0); - Src = MI.getOperand(1); + *Dest = &MI.getOperand(0); + *Src = &MI.getOperand(1); return true; } return false; Index: lib/Target/X86/X86InstrInfo.h =================================================================== --- lib/Target/X86/X86InstrInfo.h +++ lib/Target/X86/X86InstrInfo.h @@ -394,8 +394,8 @@ void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override; - bool isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const override; + bool isCopyInstr(const MachineInstr &MI, const MachineOperand **Src, + const MachineOperand **Dest) const override; void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, Index: lib/Target/X86/X86InstrInfo.cpp =================================================================== --- lib/Target/X86/X86InstrInfo.cpp +++ lib/Target/X86/X86InstrInfo.cpp @@ -6852,11 +6852,12 @@ llvm_unreachable("Cannot emit physreg copy instruction"); } -bool X86InstrInfo::isCopyInstr(const MachineInstr &MI, MachineOperand &Src, - MachineOperand &Dest) const { +bool X86InstrInfo::isCopyInstr(const MachineInstr &MI, + const MachineOperand **Src, + const MachineOperand **Dest) const { if (MI.isMoveReg()) { - Dest = MI.getOperand(0); - Src = MI.getOperand(1); + *Dest = &MI.getOperand(0); + *Src = &MI.getOperand(1); return true; } return false;