Lower select with custom inserted and make condjumps generic
[oota-llvm.git] / lib / Target / MSP430 / MSP430InstrInfo.h
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
24 namespace MSP430 {
25   // MSP430 specific condition code.
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
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; }
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;
58
59   virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
60                                    MachineBasicBlock::iterator MI,
61                                    unsigned SrcReg, bool isKill,
62                                    int FrameIndex,
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;
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
76 };
77
78 }
79
80 #endif