summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-07-08 05:01:41 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-07-08 05:01:41 +0000
commit89a4e25007de36b0f00ad7226b261e7ad6bfad37 (patch)
treeef51ae50de408220111a5a0c6e8ad34fd50530ed /llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
parent6015095608b22e1521ddf612afa3dc92cec16cf5 (diff)
downloadbcm5719-llvm-89a4e25007de36b0f00ad7226b261e7ad6bfad37.tar.gz
bcm5719-llvm-89a4e25007de36b0f00ad7226b261e7ad6bfad37.zip
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. llvm-svn: 107854
Diffstat (limited to 'llvm/lib/CodeGen/TargetInstrInfoImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfoImpl.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
index 5e145cf2de1..ff8d0ede827 100644
--- a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
@@ -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);
+}
OpenPOWER on IntegriCloud