1 //===- MSP430InstrInfo.h - MSP430 Instruction Information -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the MSP430 implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_MSP430INSTRINFO_H
15 #define LLVM_TARGET_MSP430INSTRINFO_H
17 #include "llvm/Target/TargetInstrInfo.h"
18 #include "MSP430RegisterInfo.h"
22 class MSP430TargetMachine
;
25 // MSP430 specific condition code.
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
38 class MSP430InstrInfo
: public TargetInstrInfoImpl
{
39 const MSP430RegisterInfo RI
;
40 MSP430TargetMachine
&TM
;
42 explicit MSP430InstrInfo(MSP430TargetMachine
&TM
);
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).
48 virtual const TargetRegisterInfo
&getRegisterInfo() const { return RI
; }
50 bool copyRegToReg(MachineBasicBlock
&MBB
, MachineBasicBlock::iterator I
,
51 unsigned DestReg
, unsigned SrcReg
,
52 const TargetRegisterClass
*DestRC
,
53 const TargetRegisterClass
*SrcRC
) const;
55 bool isMoveInstr(const MachineInstr
& MI
,
56 unsigned &SrcReg
, unsigned &DstReg
,
57 unsigned &SrcSubIdx
, unsigned &DstSubIdx
) const;
59 virtual void storeRegToStackSlot(MachineBasicBlock
&MBB
,
60 MachineBasicBlock::iterator MI
,
61 unsigned SrcReg
, bool isKill
,
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;
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;
76 virtual unsigned InsertBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*TBB
,
77 MachineBasicBlock
*FBB
,
78 const SmallVectorImpl
<MachineOperand
> &Cond
) const;