Add TargetInstrInfo::copyPhysReg hook and use it from LowerSubregs.

This target hook is intended to replace copyRegToReg entirely, but for now it
calls copyRegToReg.

Any remaining calls to copyRegToReg wil be replaced by COPY instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2010-07-08 05:01:41 +00:00
parent 515fe3a588
commit 3651d92d91
3 changed files with 36 additions and 37 deletions
+17
View File
@@ -365,3 +365,20 @@ ScheduleHazardRecognizer *TargetInstrInfoImpl::
CreateTargetPostRAHazardRecognizer(const InstrItineraryData &II) const {
return (ScheduleHazardRecognizer *)new PostRAHazardRecognizer(II);
}
// Default implementation of copyPhysReg using copyRegToReg.
void TargetInstrInfoImpl::copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
DebugLoc DL,
unsigned DestReg, unsigned SrcReg,
bool KillSrc) const {
assert(TargetRegisterInfo::isPhysicalRegister(DestReg));
assert(TargetRegisterInfo::isPhysicalRegister(SrcReg));
const TargetRegisterInfo *TRI = MBB.getParent()->getTarget().getRegisterInfo();
const TargetRegisterClass *DRC = TRI->getPhysicalRegisterRegClass(DestReg);
const TargetRegisterClass *SRC = TRI->getPhysicalRegisterRegClass(SrcReg);
if (!copyRegToReg(MBB, MI, DestReg, SrcReg, DRC, SRC, DL))
llvm_unreachable("Cannot emit physreg copy instruction");
if (KillSrc)
llvm::prior(MI)->addRegisterKilled(SrcReg, TRI, true);
}