Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 1 | //===- MSP430InstrInfo.cpp - MSP430 Instruction Information ---------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the MSP430 implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "MSP430.h" |
| 15 | #include "MSP430InstrInfo.h" |
Anton Korobeynikov | d5047cb | 2009-05-03 13:11:04 +0000 | [diff] [blame] | 16 | #include "MSP430MachineFunctionInfo.h" |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 17 | #include "MSP430TargetMachine.h" |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 18 | #include "llvm/Function.h" |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineFrameInfo.h" |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 21 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/PseudoSourceValue.h" |
Torok Edwin | c25e758 | 2009-07-11 20:10:48 +0000 | [diff] [blame] | 23 | #include "llvm/Support/ErrorHandling.h" |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 24 | |
Evan Cheng | 22fee2d | 2011-06-28 20:07:07 +0000 | [diff] [blame] | 25 | #define GET_INSTRINFO_MC_DESC |
| 26 | #include "MSP430GenInstrInfo.inc" |
| 27 | |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 28 | using namespace llvm; |
| 29 | |
| 30 | MSP430InstrInfo::MSP430InstrInfo(MSP430TargetMachine &tm) |
| 31 | : TargetInstrInfoImpl(MSP430Insts, array_lengthof(MSP430Insts)), |
Anton Korobeynikov | b561264 | 2009-05-03 13:07:54 +0000 | [diff] [blame] | 32 | RI(tm, *this), TM(tm) {} |
Anton Korobeynikov | 1df221f | 2009-05-03 13:02:04 +0000 | [diff] [blame] | 33 | |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 34 | void MSP430InstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, |
| 35 | MachineBasicBlock::iterator MI, |
| 36 | unsigned SrcReg, bool isKill, int FrameIdx, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 37 | const TargetRegisterClass *RC, |
| 38 | const TargetRegisterInfo *TRI) const { |
Chris Lattner | c7f3ace | 2010-04-02 20:16:16 +0000 | [diff] [blame] | 39 | DebugLoc DL; |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 40 | if (MI != MBB.end()) DL = MI->getDebugLoc(); |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 41 | MachineFunction &MF = *MBB.getParent(); |
| 42 | MachineFrameInfo &MFI = *MF.getFrameInfo(); |
| 43 | |
| 44 | MachineMemOperand *MMO = |
Chris Lattner | 59db549 | 2010-09-21 04:39:43 +0000 | [diff] [blame] | 45 | MF.getMachineMemOperand( |
| 46 | MachinePointerInfo(PseudoSourceValue::getFixedStack(FrameIdx)), |
| 47 | MachineMemOperand::MOStore, |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 48 | MFI.getObjectSize(FrameIdx), |
| 49 | MFI.getObjectAlignment(FrameIdx)); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 50 | |
| 51 | if (RC == &MSP430::GR16RegClass) |
| 52 | BuildMI(MBB, MI, DL, get(MSP430::MOV16mr)) |
| 53 | .addFrameIndex(FrameIdx).addImm(0) |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 54 | .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 55 | else if (RC == &MSP430::GR8RegClass) |
| 56 | BuildMI(MBB, MI, DL, get(MSP430::MOV8mr)) |
| 57 | .addFrameIndex(FrameIdx).addImm(0) |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 58 | .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 59 | else |
Torok Edwin | c23197a | 2009-07-14 16:55:14 +0000 | [diff] [blame] | 60 | llvm_unreachable("Cannot store this register to stack slot!"); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | void MSP430InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 64 | MachineBasicBlock::iterator MI, |
| 65 | unsigned DestReg, int FrameIdx, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 66 | const TargetRegisterClass *RC, |
| 67 | const TargetRegisterInfo *TRI) const{ |
Chris Lattner | c7f3ace | 2010-04-02 20:16:16 +0000 | [diff] [blame] | 68 | DebugLoc DL; |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 69 | if (MI != MBB.end()) DL = MI->getDebugLoc(); |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 70 | MachineFunction &MF = *MBB.getParent(); |
| 71 | MachineFrameInfo &MFI = *MF.getFrameInfo(); |
| 72 | |
| 73 | MachineMemOperand *MMO = |
Chris Lattner | 59db549 | 2010-09-21 04:39:43 +0000 | [diff] [blame] | 74 | MF.getMachineMemOperand( |
| 75 | MachinePointerInfo(PseudoSourceValue::getFixedStack(FrameIdx)), |
| 76 | MachineMemOperand::MOLoad, |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 77 | MFI.getObjectSize(FrameIdx), |
| 78 | MFI.getObjectAlignment(FrameIdx)); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 79 | |
| 80 | if (RC == &MSP430::GR16RegClass) |
| 81 | BuildMI(MBB, MI, DL, get(MSP430::MOV16rm)) |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 82 | .addReg(DestReg).addFrameIndex(FrameIdx).addImm(0).addMemOperand(MMO); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 83 | else if (RC == &MSP430::GR8RegClass) |
| 84 | BuildMI(MBB, MI, DL, get(MSP430::MOV8rm)) |
Anton Korobeynikov | 8046ef4 | 2009-11-07 17:13:57 +0000 | [diff] [blame] | 85 | .addReg(DestReg).addFrameIndex(FrameIdx).addImm(0).addMemOperand(MMO); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 86 | else |
Torok Edwin | c23197a | 2009-07-14 16:55:14 +0000 | [diff] [blame] | 87 | llvm_unreachable("Cannot store this register to stack slot!"); |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 88 | } |
| 89 | |
Jakob Stoklund Olesen | 41ce3cf | 2010-07-11 06:53:30 +0000 | [diff] [blame] | 90 | void MSP430InstrInfo::copyPhysReg(MachineBasicBlock &MBB, |
| 91 | MachineBasicBlock::iterator I, DebugLoc DL, |
| 92 | unsigned DestReg, unsigned SrcReg, |
| 93 | bool KillSrc) const { |
| 94 | unsigned Opc; |
| 95 | if (MSP430::GR16RegClass.contains(DestReg, SrcReg)) |
| 96 | Opc = MSP430::MOV16rr; |
| 97 | else if (MSP430::GR8RegClass.contains(DestReg, SrcReg)) |
| 98 | Opc = MSP430::MOV8rr; |
| 99 | else |
| 100 | llvm_unreachable("Impossible reg-to-reg copy"); |
Anton Korobeynikov | 51c31d6 | 2009-05-03 13:05:42 +0000 | [diff] [blame] | 101 | |
Jakob Stoklund Olesen | 41ce3cf | 2010-07-11 06:53:30 +0000 | [diff] [blame] | 102 | BuildMI(MBB, I, DL, get(Opc), DestReg) |
| 103 | .addReg(SrcReg, getKillRegState(KillSrc)); |
Anton Korobeynikov | 1df221f | 2009-05-03 13:02:04 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 106 | unsigned MSP430InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const { |
| 107 | MachineBasicBlock::iterator I = MBB.end(); |
| 108 | unsigned Count = 0; |
| 109 | |
| 110 | while (I != MBB.begin()) { |
| 111 | --I; |
Dale Johannesen | 93d6a7e | 2010-04-02 01:38:09 +0000 | [diff] [blame] | 112 | if (I->isDebugValue()) |
| 113 | continue; |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 114 | if (I->getOpcode() != MSP430::JMP && |
Anton Korobeynikov | 69d5b48 | 2010-05-01 12:04:32 +0000 | [diff] [blame] | 115 | I->getOpcode() != MSP430::JCC && |
| 116 | I->getOpcode() != MSP430::Br && |
| 117 | I->getOpcode() != MSP430::Bm) |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 118 | break; |
| 119 | // Remove the branch. |
| 120 | I->eraseFromParent(); |
| 121 | I = MBB.end(); |
| 122 | ++Count; |
| 123 | } |
| 124 | |
| 125 | return Count; |
| 126 | } |
| 127 | |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 128 | bool MSP430InstrInfo:: |
| 129 | ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const { |
| 130 | assert(Cond.size() == 1 && "Invalid Xbranch condition!"); |
| 131 | |
| 132 | MSP430CC::CondCodes CC = static_cast<MSP430CC::CondCodes>(Cond[0].getImm()); |
| 133 | |
| 134 | switch (CC) { |
| 135 | default: |
| 136 | assert(0 && "Invalid branch condition!"); |
| 137 | break; |
| 138 | case MSP430CC::COND_E: |
| 139 | CC = MSP430CC::COND_NE; |
| 140 | break; |
| 141 | case MSP430CC::COND_NE: |
| 142 | CC = MSP430CC::COND_E; |
| 143 | break; |
| 144 | case MSP430CC::COND_L: |
| 145 | CC = MSP430CC::COND_GE; |
| 146 | break; |
| 147 | case MSP430CC::COND_GE: |
| 148 | CC = MSP430CC::COND_L; |
| 149 | break; |
| 150 | case MSP430CC::COND_HS: |
| 151 | CC = MSP430CC::COND_LO; |
| 152 | break; |
| 153 | case MSP430CC::COND_LO: |
| 154 | CC = MSP430CC::COND_HS; |
| 155 | break; |
| 156 | } |
| 157 | |
| 158 | Cond[0].setImm(CC); |
| 159 | return false; |
| 160 | } |
| 161 | |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 162 | bool MSP430InstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const { |
Evan Cheng | e837dea | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 163 | const MCInstrDesc &MCID = MI->getDesc(); |
| 164 | if (!MCID.isTerminator()) return false; |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 165 | |
| 166 | // Conditional branch is a special case. |
Evan Cheng | e837dea | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 167 | if (MCID.isBranch() && !MCID.isBarrier()) |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 168 | return true; |
Evan Cheng | e837dea | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 169 | if (!MCID.isPredicable()) |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 170 | return true; |
| 171 | return !isPredicated(MI); |
| 172 | } |
| 173 | |
| 174 | bool MSP430InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, |
| 175 | MachineBasicBlock *&TBB, |
| 176 | MachineBasicBlock *&FBB, |
| 177 | SmallVectorImpl<MachineOperand> &Cond, |
| 178 | bool AllowModify) const { |
| 179 | // Start from the bottom of the block and work up, examining the |
| 180 | // terminator instructions. |
| 181 | MachineBasicBlock::iterator I = MBB.end(); |
| 182 | while (I != MBB.begin()) { |
| 183 | --I; |
Dale Johannesen | 93d6a7e | 2010-04-02 01:38:09 +0000 | [diff] [blame] | 184 | if (I->isDebugValue()) |
| 185 | continue; |
| 186 | |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 187 | // Working from the bottom, when we see a non-terminator |
| 188 | // instruction, we're done. |
| 189 | if (!isUnpredicatedTerminator(I)) |
| 190 | break; |
| 191 | |
| 192 | // A terminator that isn't a branch can't easily be handled |
| 193 | // by this analysis. |
| 194 | if (!I->getDesc().isBranch()) |
| 195 | return true; |
| 196 | |
Anton Korobeynikov | 69d5b48 | 2010-05-01 12:04:32 +0000 | [diff] [blame] | 197 | // Cannot handle indirect branches. |
| 198 | if (I->getOpcode() == MSP430::Br || |
| 199 | I->getOpcode() == MSP430::Bm) |
| 200 | return true; |
| 201 | |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 202 | // Handle unconditional branches. |
| 203 | if (I->getOpcode() == MSP430::JMP) { |
| 204 | if (!AllowModify) { |
| 205 | TBB = I->getOperand(0).getMBB(); |
| 206 | continue; |
| 207 | } |
| 208 | |
| 209 | // If the block has any instructions after a JMP, delete them. |
Chris Lattner | 7896c9f | 2009-12-03 00:50:42 +0000 | [diff] [blame] | 210 | while (llvm::next(I) != MBB.end()) |
| 211 | llvm::next(I)->eraseFromParent(); |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 212 | Cond.clear(); |
| 213 | FBB = 0; |
| 214 | |
| 215 | // Delete the JMP if it's equivalent to a fall-through. |
| 216 | if (MBB.isLayoutSuccessor(I->getOperand(0).getMBB())) { |
| 217 | TBB = 0; |
| 218 | I->eraseFromParent(); |
| 219 | I = MBB.end(); |
| 220 | continue; |
| 221 | } |
| 222 | |
| 223 | // TBB is used to indicate the unconditinal destination. |
| 224 | TBB = I->getOperand(0).getMBB(); |
| 225 | continue; |
| 226 | } |
| 227 | |
| 228 | // Handle conditional branches. |
| 229 | assert(I->getOpcode() == MSP430::JCC && "Invalid conditional branch"); |
| 230 | MSP430CC::CondCodes BranchCode = |
| 231 | static_cast<MSP430CC::CondCodes>(I->getOperand(1).getImm()); |
| 232 | if (BranchCode == MSP430CC::COND_INVALID) |
| 233 | return true; // Can't handle weird stuff. |
| 234 | |
| 235 | // Working from the bottom, handle the first conditional branch. |
| 236 | if (Cond.empty()) { |
| 237 | FBB = TBB; |
| 238 | TBB = I->getOperand(0).getMBB(); |
| 239 | Cond.push_back(MachineOperand::CreateImm(BranchCode)); |
| 240 | continue; |
| 241 | } |
| 242 | |
| 243 | // Handle subsequent conditional branches. Only handle the case where all |
| 244 | // conditional branches branch to the same destination. |
| 245 | assert(Cond.size() == 1); |
| 246 | assert(TBB); |
| 247 | |
| 248 | // Only handle the case where all conditional branches branch to |
| 249 | // the same destination. |
| 250 | if (TBB != I->getOperand(0).getMBB()) |
| 251 | return true; |
| 252 | |
| 253 | MSP430CC::CondCodes OldBranchCode = (MSP430CC::CondCodes)Cond[0].getImm(); |
| 254 | // If the conditions are the same, we can leave them alone. |
| 255 | if (OldBranchCode == BranchCode) |
| 256 | continue; |
| 257 | |
| 258 | return true; |
| 259 | } |
| 260 | |
| 261 | return false; |
| 262 | } |
| 263 | |
Anton Korobeynikov | 8644af3 | 2009-05-03 13:15:22 +0000 | [diff] [blame] | 264 | unsigned |
| 265 | MSP430InstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 266 | MachineBasicBlock *FBB, |
Stuart Hastings | 3bf9125 | 2010-06-17 22:43:56 +0000 | [diff] [blame] | 267 | const SmallVectorImpl<MachineOperand> &Cond, |
| 268 | DebugLoc DL) const { |
Anton Korobeynikov | 8644af3 | 2009-05-03 13:15:22 +0000 | [diff] [blame] | 269 | // Shouldn't be a fall through. |
| 270 | assert(TBB && "InsertBranch must not be told to insert a fallthrough"); |
| 271 | assert((Cond.size() == 1 || Cond.size() == 0) && |
| 272 | "MSP430 branch conditions have one component!"); |
| 273 | |
| 274 | if (Cond.empty()) { |
| 275 | // Unconditional branch? |
| 276 | assert(!FBB && "Unconditional branch with multiple successors!"); |
Chris Lattner | c7f3ace | 2010-04-02 20:16:16 +0000 | [diff] [blame] | 277 | BuildMI(&MBB, DL, get(MSP430::JMP)).addMBB(TBB); |
Anton Korobeynikov | 8644af3 | 2009-05-03 13:15:22 +0000 | [diff] [blame] | 278 | return 1; |
| 279 | } |
| 280 | |
| 281 | // Conditional branch. |
| 282 | unsigned Count = 0; |
Chris Lattner | c7f3ace | 2010-04-02 20:16:16 +0000 | [diff] [blame] | 283 | BuildMI(&MBB, DL, get(MSP430::JCC)).addMBB(TBB).addImm(Cond[0].getImm()); |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 284 | ++Count; |
Anton Korobeynikov | 8644af3 | 2009-05-03 13:15:22 +0000 | [diff] [blame] | 285 | |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 286 | if (FBB) { |
| 287 | // Two-way Conditional branch. Insert the second branch. |
Chris Lattner | c7f3ace | 2010-04-02 20:16:16 +0000 | [diff] [blame] | 288 | BuildMI(&MBB, DL, get(MSP430::JMP)).addMBB(FBB); |
Anton Korobeynikov | 90593d2 | 2009-10-21 19:17:18 +0000 | [diff] [blame] | 289 | ++Count; |
| 290 | } |
Anton Korobeynikov | 8644af3 | 2009-05-03 13:15:22 +0000 | [diff] [blame] | 291 | return Count; |
| 292 | } |
Anton Korobeynikov | 702adab | 2010-01-15 21:19:05 +0000 | [diff] [blame] | 293 | |
| 294 | /// GetInstSize - Return the number of bytes of code the specified |
| 295 | /// instruction may be. This returns the maximum number of bytes. |
| 296 | /// |
| 297 | unsigned MSP430InstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const { |
Evan Cheng | e837dea | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 298 | const MCInstrDesc &Desc = MI->getDesc(); |
Anton Korobeynikov | 702adab | 2010-01-15 21:19:05 +0000 | [diff] [blame] | 299 | |
| 300 | switch (Desc.TSFlags & MSP430II::SizeMask) { |
| 301 | default: |
| 302 | switch (Desc.getOpcode()) { |
| 303 | default: |
| 304 | assert(0 && "Unknown instruction size!"); |
Bill Wendling | 7431bea | 2010-07-16 22:20:36 +0000 | [diff] [blame] | 305 | case TargetOpcode::PROLOG_LABEL: |
Chris Lattner | 518bb53 | 2010-02-09 19:54:29 +0000 | [diff] [blame] | 306 | case TargetOpcode::EH_LABEL: |
| 307 | case TargetOpcode::IMPLICIT_DEF: |
| 308 | case TargetOpcode::KILL: |
Dale Johannesen | 375be77 | 2010-04-07 19:51:44 +0000 | [diff] [blame] | 309 | case TargetOpcode::DBG_VALUE: |
Anton Korobeynikov | 702adab | 2010-01-15 21:19:05 +0000 | [diff] [blame] | 310 | return 0; |
Chris Lattner | 518bb53 | 2010-02-09 19:54:29 +0000 | [diff] [blame] | 311 | case TargetOpcode::INLINEASM: { |
Anton Korobeynikov | 702adab | 2010-01-15 21:19:05 +0000 | [diff] [blame] | 312 | const MachineFunction *MF = MI->getParent()->getParent(); |
| 313 | const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); |
| 314 | return TII.getInlineAsmLength(MI->getOperand(0).getSymbolName(), |
| 315 | *MF->getTarget().getMCAsmInfo()); |
| 316 | } |
| 317 | } |
| 318 | case MSP430II::SizeSpecial: |
| 319 | switch (MI->getOpcode()) { |
| 320 | default: |
| 321 | assert(0 && "Unknown instruction size!"); |
| 322 | case MSP430::SAR8r1c: |
| 323 | case MSP430::SAR16r1c: |
| 324 | return 4; |
| 325 | } |
| 326 | case MSP430II::Size2Bytes: |
| 327 | return 2; |
| 328 | case MSP430II::Size4Bytes: |
| 329 | return 4; |
| 330 | case MSP430II::Size6Bytes: |
| 331 | return 6; |
| 332 | } |
| 333 | |
| 334 | return 6; |
| 335 | } |