blob: 59133d98ce0b16d01cccb4e7cb1b92c05714c6ea [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 {
Anton Korobeynikov8b528e52009-05-03 13:12:23 +000025 // MSP430 specific condition code.
Anton Korobeynikoved1a51a2009-05-03 13:12:06 +000026 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 Korobeynikovf2c3e172009-05-03 12:57:15 +000038class MSP430InstrInfo : public TargetInstrInfoImpl {
39 const MSP430RegisterInfo RI;
40 MSP430TargetMachine &TM;
41public:
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 Korobeynikov1df221f2009-05-03 13:02:04 +000049
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 Korobeynikovaa299152009-05-03 13:09:57 +000058
59 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
60 MachineBasicBlock::iterator MI,
Anton Korobeynikovd5047cb2009-05-03 13:11:04 +000061 unsigned SrcReg, bool isKill,
62 int FrameIndex,
Anton Korobeynikovaa299152009-05-03 13:09:57 +000063 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 Korobeynikovd5047cb2009-05-03 13:11:04 +000068
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 Korobeynikovf2c3e172009-05-03 12:57:15 +000076};
77
78}
79
80#endif