mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user