Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 1 | //===- MSP430InstrInfo.h - MSP430 Instruction Information -------*- C++ -*-===// |
| 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 | #ifndef LLVM_TARGET_MSP430INSTRINFO_H |
| 15 | #define LLVM_TARGET_MSP430INSTRINFO_H |
| 16 | |
| 17 | #include "llvm/Target/TargetInstrInfo.h" |
| 18 | #include "MSP430RegisterInfo.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | class MSP430TargetMachine; |
| 23 | |
Anton Korobeynikov | ed1a51a | 2009-05-03 13:12:06 +0000 | [diff] [blame] | 24 | namespace MSP430 { |
Anton Korobeynikov | 8b528e5 | 2009-05-03 13:12:23 +0000 | [diff] [blame^] | 25 | // MSP430 specific condition code. |
Anton Korobeynikov | ed1a51a | 2009-05-03 13:12:06 +0000 | [diff] [blame] | 26 | enum CondCode { |
| 27 | COND_E = 0, // aka COND_Z |
| 28 | COND_NE = 1, // aka COND_NZ |
| 29 | COND_HS = 2, // aka COND_C |
| 30 | COND_LO = 3, // aka COND_NC |
| 31 | COND_GE = 4, |
| 32 | COND_L = 5, |
| 33 | |
| 34 | COND_INVALID |
| 35 | }; |
| 36 | } |
| 37 | |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 38 | class MSP430InstrInfo : public TargetInstrInfoImpl { |
| 39 | const MSP430RegisterInfo RI; |
| 40 | MSP430TargetMachine &TM; |
| 41 | public: |
| 42 | explicit MSP430InstrInfo(MSP430TargetMachine &TM); |
| 43 | |
| 44 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 45 | /// such, whenever a client has an instance of instruction info, it should |
| 46 | /// always be able to get register info as well (through this method). |
| 47 | /// |
| 48 | virtual const TargetRegisterInfo &getRegisterInfo() const { return RI; } |
Anton Korobeynikov | 1df221f | 2009-05-03 13:02:04 +0000 | [diff] [blame] | 49 | |
| 50 | bool copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
| 51 | unsigned DestReg, unsigned SrcReg, |
| 52 | const TargetRegisterClass *DestRC, |
| 53 | const TargetRegisterClass *SrcRC) const; |
| 54 | |
| 55 | bool isMoveInstr(const MachineInstr& MI, |
| 56 | unsigned &SrcReg, unsigned &DstReg, |
| 57 | unsigned &SrcSubIdx, unsigned &DstSubIdx) const; |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 58 | |
| 59 | virtual void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 60 | MachineBasicBlock::iterator MI, |
Anton Korobeynikov | d5047cb | 2009-05-03 13:11:04 +0000 | [diff] [blame] | 61 | unsigned SrcReg, bool isKill, |
| 62 | int FrameIndex, |
Anton Korobeynikov | aa29915 | 2009-05-03 13:09:57 +0000 | [diff] [blame] | 63 | const TargetRegisterClass *RC) const; |
| 64 | virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 65 | MachineBasicBlock::iterator MI, |
| 66 | unsigned DestReg, int FrameIdx, |
| 67 | const TargetRegisterClass *RC) const; |
Anton Korobeynikov | d5047cb | 2009-05-03 13:11:04 +0000 | [diff] [blame] | 68 | |
| 69 | virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, |
| 70 | MachineBasicBlock::iterator MI, |
| 71 | const std::vector<CalleeSavedInfo> &CSI) const; |
| 72 | virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, |
| 73 | MachineBasicBlock::iterator MI, |
| 74 | const std::vector<CalleeSavedInfo> &CSI) const; |
| 75 | |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | } |
| 79 | |
| 80 | #endif |