blob: 0803e2d77cd22e5efea048465952daacdd8fa557 [file] [log] [blame]
Anton Korobeynikovf2c3e172009-05-03 12:57:15 +00001//===- 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
20namespace llvm {
21
22class MSP430TargetMachine;
23
Anton Korobeynikoved1a51a2009-05-03 13:12:06 +000024namespace MSP430 {
25 // MSP430 specific condition code. These correspond to MSP430_*_COND in
26 // MSP430InstrInfo.td. They must be kept in synch.
27 enum CondCode {
28 COND_E = 0, // aka COND_Z
29 COND_NE = 1, // aka COND_NZ
30 COND_HS = 2, // aka COND_C
31 COND_LO = 3, // aka COND_NC
32 COND_GE = 4,
33 COND_L = 5,
34
35 COND_INVALID
36 };
37}
38
Anton Korobeynikovf2c3e172009-05-03 12:57:15 +000039class MSP430InstrInfo : public TargetInstrInfoImpl {
40 const MSP430RegisterInfo RI;
41 MSP430TargetMachine &TM;
42public:
43 explicit MSP430InstrInfo(MSP430TargetMachine &TM);
44
45 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
46 /// such, whenever a client has an instance of instruction info, it should
47 /// always be able to get register info as well (through this method).
48 ///
49 virtual const TargetRegisterInfo &getRegisterInfo() const { return RI; }
Anton Korobeynikov1df221f2009-05-03 13:02:04 +000050
51 bool copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
52 unsigned DestReg, unsigned SrcReg,
53 const TargetRegisterClass *DestRC,
54 const TargetRegisterClass *SrcRC) const;
55
56 bool isMoveInstr(const MachineInstr& MI,
57 unsigned &SrcReg, unsigned &DstReg,
58 unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
Anton Korobeynikovaa299152009-05-03 13:09:57 +000059
60 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
61 MachineBasicBlock::iterator MI,
Anton Korobeynikovd5047cb2009-05-03 13:11:04 +000062 unsigned SrcReg, bool isKill,
63 int FrameIndex,
Anton Korobeynikovaa299152009-05-03 13:09:57 +000064 const TargetRegisterClass *RC) const;
65 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
66 MachineBasicBlock::iterator MI,
67 unsigned DestReg, int FrameIdx,
68 const TargetRegisterClass *RC) const;
Anton Korobeynikovd5047cb2009-05-03 13:11:04 +000069
70 virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
71 MachineBasicBlock::iterator MI,
72 const std::vector<CalleeSavedInfo> &CSI) const;
73 virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
74 MachineBasicBlock::iterator MI,
75 const std::vector<CalleeSavedInfo> &CSI) const;
76
Anton Korobeynikovf2c3e172009-05-03 12:57:15 +000077};
78
79}
80
81#endif