summaryrefslogtreecommitdiff
path: root/lib/Target/MSP430/MSP430InstrInfo.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-05-03 13:05:42 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-05-03 13:05:42 +0000
commit51c31d6888a6c2a7cea74e210a1e1c8551535f28 (patch)
tree8e967c8598b7f47c2baffae33a18ffac7bde8def /lib/Target/MSP430/MSP430InstrInfo.cpp
parentcf9adf2cbb8298e83b53d7bee2ddab4c875cb3c5 (diff)
downloadllvm-51c31d6888a6c2a7cea74e210a1e1c8551535f28.tar.gz
llvm-51c31d6888a6c2a7cea74e210a1e1c8551535f28.tar.bz2
llvm-51c31d6888a6c2a7cea74e210a1e1c8551535f28.tar.xz
Add 8-bit insts. zext behaviour is not modelled yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430/MSP430InstrInfo.cpp')
-rw-r--r--lib/Target/MSP430/MSP430InstrInfo.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/Target/MSP430/MSP430InstrInfo.cpp b/lib/Target/MSP430/MSP430InstrInfo.cpp
index c84c96e656..579da6e90e 100644
--- a/lib/Target/MSP430/MSP430InstrInfo.cpp
+++ b/lib/Target/MSP430/MSP430InstrInfo.cpp
@@ -32,16 +32,24 @@ bool MSP430InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
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;
+ if (DestRC == SrcRC) {
+ unsigned Opc;
+ if (DestRC == &MSP430::GR16RegClass) {
+ Opc = MSP430::MOV16rr;
+ } else if (DestRC == &MSP430::GR8RegClass) {
+ Opc = MSP430::MOV8rr;
+ } else {
+ return false;
+ }
+
+ BuildMI(MBB, I, DL, get(Opc), DestReg).addReg(SrcReg);
+ return true;
+ }
+
+ return false;
}
bool
@@ -53,8 +61,9 @@ MSP430InstrInfo::isMoveInstr(const MachineInstr& MI,
switch (MI.getOpcode()) {
default:
return false;
+ case MSP430::MOV8rr:
case MSP430::MOV16rr:
- assert(MI.getNumOperands() >= 2 &&
+ assert(MI.getNumOperands() >= 2 &&
MI.getOperand(0).isReg() &&
MI.getOperand(1).isReg() &&
"invalid register-register move instruction");