LLVM API Documentation
00001 //===- MSP430InstrInfo.h - MSP430 Instruction Information -------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the MSP430 implementation of the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_TARGET_MSP430INSTRINFO_H 00015 #define LLVM_TARGET_MSP430INSTRINFO_H 00016 00017 #include "llvm/Target/TargetInstrInfo.h" 00018 #include "MSP430RegisterInfo.h" 00019 00020 namespace llvm { 00021 00022 class MSP430TargetMachine; 00023 00024 namespace MSP430 { 00025 // MSP430 specific condition code. 00026 enum CondCode { 00027 COND_E = 0, // aka COND_Z 00028 COND_NE = 1, // aka COND_NZ 00029 COND_HS = 2, // aka COND_C 00030 COND_LO = 3, // aka COND_NC 00031 COND_GE = 4, 00032 COND_L = 5, 00033 00034 COND_INVALID 00035 }; 00036 } 00037 00038 class MSP430InstrInfo : public TargetInstrInfoImpl { 00039 const MSP430RegisterInfo RI; 00040 MSP430TargetMachine &TM; 00041 public: 00042 explicit MSP430InstrInfo(MSP430TargetMachine &TM); 00043 00044 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 00045 /// such, whenever a client has an instance of instruction info, it should 00046 /// always be able to get register info as well (through this method). 00047 /// 00048 virtual const TargetRegisterInfo &getRegisterInfo() const { return RI; } 00049 00050 bool copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, 00051 unsigned DestReg, unsigned SrcReg, 00052 const TargetRegisterClass *DestRC, 00053 const TargetRegisterClass *SrcRC) const; 00054 00055 bool isMoveInstr(const MachineInstr& MI, 00056 unsigned &SrcReg, unsigned &DstReg, 00057 unsigned &SrcSubIdx, unsigned &DstSubIdx) const; 00058 00059 virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 00060 MachineBasicBlock::iterator MI, 00061 unsigned SrcReg, bool isKill, 00062 int FrameIndex, 00063 const TargetRegisterClass *RC) const; 00064 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 00065 MachineBasicBlock::iterator MI, 00066 unsigned DestReg, int FrameIdx, 00067 const TargetRegisterClass *RC) const; 00068 00069 virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, 00070 MachineBasicBlock::iterator MI, 00071 const std::vector<CalleeSavedInfo> &CSI) const; 00072 virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 00073 MachineBasicBlock::iterator MI, 00074 const std::vector<CalleeSavedInfo> &CSI) const; 00075 00076 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 00077 MachineBasicBlock *FBB, 00078 const SmallVectorImpl<MachineOperand> &Cond) const; 00079 00080 }; 00081 00082 } 00083 00084 #endif