Replace copyRegToReg with copyPhysReg for XCore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2010-07-11 07:56:13 +00:00
parent 8e18a1a5cf
commit a98625cdad
2 changed files with 23 additions and 31 deletions

View File

@ -356,37 +356,31 @@ XCoreInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
return 2; return 2;
} }
bool XCoreInstrInfo::copyRegToReg(MachineBasicBlock &MBB, void XCoreInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I, MachineBasicBlock::iterator I, DebugLoc DL,
unsigned DestReg, unsigned SrcReg, unsigned DestReg, unsigned SrcReg,
const TargetRegisterClass *DestRC, bool KillSrc) const {
const TargetRegisterClass *SrcRC, bool GRDest = XCore::GRRegsRegClass.contains(DestReg);
DebugLoc DL) const { bool GRSrc = XCore::GRRegsRegClass.contains(SrcReg);
if (DestRC == SrcRC) { if (GRDest && GRSrc) {
if (DestRC == XCore::GRRegsRegisterClass) {
BuildMI(MBB, I, DL, get(XCore::ADD_2rus), DestReg) BuildMI(MBB, I, DL, get(XCore::ADD_2rus), DestReg)
.addReg(SrcReg) .addReg(SrcReg, getKillRegState(KillSrc))
.addImm(0); .addImm(0);
return true; return;
} else {
return false;
}
} }
if (SrcRC == XCore::RRegsRegisterClass && SrcReg == XCore::SP && if (GRDest && SrcReg == XCore::SP) {
DestRC == XCore::GRRegsRegisterClass) { BuildMI(MBB, I, DL, get(XCore::LDAWSP_ru6), DestReg).addImm(0);
BuildMI(MBB, I, DL, get(XCore::LDAWSP_ru6), DestReg) return;
.addImm(0);
return true;
} }
if (DestRC == XCore::RRegsRegisterClass && DestReg == XCore::SP &&
SrcRC == XCore::GRRegsRegisterClass) { if (DestReg == XCore::SP && GRSrc) {
BuildMI(MBB, I, DL, get(XCore::SETSP_1r)) BuildMI(MBB, I, DL, get(XCore::SETSP_1r))
.addReg(SrcReg); .addReg(SrcReg, getKillRegState(KillSrc));
return true; return;
} }
return false; llvm_unreachable("Impossible reg-to-reg copy");
} }
void XCoreInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, void XCoreInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,

View File

@ -64,12 +64,10 @@ public:
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual bool copyRegToReg(MachineBasicBlock &MBB, virtual void copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I, MachineBasicBlock::iterator I, DebugLoc DL,
unsigned DestReg, unsigned SrcReg, unsigned DestReg, unsigned SrcReg,
const TargetRegisterClass *DestRC, bool KillSrc) const;
const TargetRegisterClass *SrcRC,
DebugLoc DL) const;
virtual void storeRegToStackSlot(MachineBasicBlock &MBB, virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI, MachineBasicBlock::iterator MI,