diff options
author | Owen Anderson <resistor@mac.com> | 2007-12-31 06:32:00 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-12-31 06:32:00 +0000 |
commit | d10fd9791c20fd8368fa0ce94b626b769c6c8ba0 (patch) | |
tree | 15d4f8237ffa7600737fab617923b5bef3267b16 /lib/Target/Sparc/SparcInstrInfo.cpp | |
parent | f20c1a497fe3922ac718429d65a5fe396890575e (diff) |
Move copyRegToReg from MRegisterInfo to TargetInstrInfo. This is part of the
Machine-level API cleanup instigated by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc/SparcInstrInfo.cpp')
-rw-r--r-- | lib/Target/Sparc/SparcInstrInfo.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/Target/Sparc/SparcInstrInfo.cpp b/lib/Target/Sparc/SparcInstrInfo.cpp index 86af68d766..5a64a4428c 100644 --- a/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/lib/Target/Sparc/SparcInstrInfo.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "SparcInstrInfo.h" +#include "SparcSubtarget.h" #include "Sparc.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -20,7 +21,7 @@ using namespace llvm; SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST) : TargetInstrInfo(SparcInsts, array_lengthof(SparcInsts)), - RI(ST, *this) { + RI(ST, *this), Subtarget(ST) { } static bool isZeroImm(const MachineOperand &op) { @@ -107,3 +108,24 @@ SparcInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, BuildMI(&MBB, get(SP::BA)).addMBB(TBB); return 1; } + +void SparcInstrInfo::copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const { + if (DestRC != SrcRC) { + cerr << "Not yet supported!"; + abort(); + } + + if (DestRC == SP::IntRegsRegisterClass) + BuildMI(MBB, I, get(SP::ORrr), DestReg).addReg(SP::G0).addReg(SrcReg); + else if (DestRC == SP::FPRegsRegisterClass) + BuildMI(MBB, I, get(SP::FMOVS), DestReg).addReg(SrcReg); + else if (DestRC == SP::DFPRegsRegisterClass) + BuildMI(MBB, I, get(Subtarget.isV9() ? SP::FMOVD : SP::FpMOVD),DestReg) + .addReg(SrcReg); + else + assert (0 && "Can't copy this register"); +} |