diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:02:04 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:02:04 +0000 |
| commit | 1df221f2bb8e8380e255d1bec73ab07b388d01a2 (patch) | |
| tree | 25feae768943a171215f858d0786a4c95c52cc15 /lib/Target/MSP430/MSP430InstrInfo.cpp | |
| parent | 09c42f509a10e1725f52ebac36d38deee194b526 (diff) | |
Add code enough for emission of reg-reg and reg-imm moves. This allows us to compile "ret i16 0" properly!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430/MSP430InstrInfo.cpp')
| -rw-r--r-- | lib/Target/MSP430/MSP430InstrInfo.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/Target/MSP430/MSP430InstrInfo.cpp b/lib/Target/MSP430/MSP430InstrInfo.cpp index d644e63ade..c84c96e656 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.cpp +++ b/lib/Target/MSP430/MSP430InstrInfo.cpp @@ -26,3 +26,40 @@ using namespace llvm; MSP430InstrInfo::MSP430InstrInfo(MSP430TargetMachine &tm) : TargetInstrInfoImpl(MSP430Insts, array_lengthof(MSP430Insts)), RI(*this), TM(tm) {} + +bool MSP430InstrInfo::copyRegToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const { + if (DestRC != SrcRC) { + // Not yet supported! + return false; + } + + DebugLoc DL = DebugLoc::getUnknownLoc(); + if (I != MBB.end()) DL = I->getDebugLoc(); + + BuildMI(MBB, I, DL, get(MSP430::MOV16rr), DestReg).addReg(SrcReg); + return true; +} + +bool +MSP430InstrInfo::isMoveInstr(const MachineInstr& MI, + unsigned &SrcReg, unsigned &DstReg, + unsigned &SrcSubIdx, unsigned &DstSubIdx) const { + SrcSubIdx = DstSubIdx = 0; // No sub-registers yet. + + switch (MI.getOpcode()) { + default: + return false; + case MSP430::MOV16rr: + assert(MI.getNumOperands() >= 2 && + MI.getOperand(0).isReg() && + MI.getOperand(1).isReg() && + "invalid register-register move instruction"); + SrcReg = MI.getOperand(1).getReg(); + DstReg = MI.getOperand(0).getReg(); + return true; + } +} |
