1*9880d681SAndroid Build Coastguard Worker //===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file contains the MSP430 implementation of the TargetInstrInfo class. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "MSP430RegisterInfo.h" 18*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetInstrInfo.h" 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker #define GET_INSTRINFO_HEADER 21*9880d681SAndroid Build Coastguard Worker #include "MSP430GenInstrInfo.inc" 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker namespace llvm { 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker class MSP430Subtarget; 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker /// MSP430II - This namespace holds all of the target specific flags that 28*9880d681SAndroid Build Coastguard Worker /// instruction info tracks. 29*9880d681SAndroid Build Coastguard Worker /// 30*9880d681SAndroid Build Coastguard Worker namespace MSP430II { 31*9880d681SAndroid Build Coastguard Worker enum { 32*9880d681SAndroid Build Coastguard Worker SizeShift = 2, 33*9880d681SAndroid Build Coastguard Worker SizeMask = 7 << SizeShift, 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker SizeUnknown = 0 << SizeShift, 36*9880d681SAndroid Build Coastguard Worker SizeSpecial = 1 << SizeShift, 37*9880d681SAndroid Build Coastguard Worker Size2Bytes = 2 << SizeShift, 38*9880d681SAndroid Build Coastguard Worker Size4Bytes = 3 << SizeShift, 39*9880d681SAndroid Build Coastguard Worker Size6Bytes = 4 << SizeShift 40*9880d681SAndroid Build Coastguard Worker }; 41*9880d681SAndroid Build Coastguard Worker } 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker class MSP430InstrInfo : public MSP430GenInstrInfo { 44*9880d681SAndroid Build Coastguard Worker const MSP430RegisterInfo RI; 45*9880d681SAndroid Build Coastguard Worker virtual void anchor(); 46*9880d681SAndroid Build Coastguard Worker public: 47*9880d681SAndroid Build Coastguard Worker explicit MSP430InstrInfo(MSP430Subtarget &STI); 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 50*9880d681SAndroid Build Coastguard Worker /// such, whenever a client has an instance of instruction info, it should 51*9880d681SAndroid Build Coastguard Worker /// always be able to get register info as well (through this method). 52*9880d681SAndroid Build Coastguard Worker /// getRegisterInfo()53*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo &getRegisterInfo() const { return RI; } 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, 56*9880d681SAndroid Build Coastguard Worker const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, 57*9880d681SAndroid Build Coastguard Worker bool KillSrc) const override; 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Worker void storeRegToStackSlot(MachineBasicBlock &MBB, 60*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MI, 61*9880d681SAndroid Build Coastguard Worker unsigned SrcReg, bool isKill, 62*9880d681SAndroid Build Coastguard Worker int FrameIndex, 63*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *RC, 64*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI) const override; 65*9880d681SAndroid Build Coastguard Worker void loadRegFromStackSlot(MachineBasicBlock &MBB, 66*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MI, 67*9880d681SAndroid Build Coastguard Worker unsigned DestReg, int FrameIdx, 68*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *RC, 69*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI) const override; 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Worker unsigned GetInstSizeInBytes(const MachineInstr &MI) const; 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker // Branch folding goodness 74*9880d681SAndroid Build Coastguard Worker bool 75*9880d681SAndroid Build Coastguard Worker ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override; 76*9880d681SAndroid Build Coastguard Worker bool isUnpredicatedTerminator(const MachineInstr &MI) const override; 77*9880d681SAndroid Build Coastguard Worker bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, 78*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *&FBB, 79*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<MachineOperand> &Cond, 80*9880d681SAndroid Build Coastguard Worker bool AllowModify) const override; 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Worker unsigned RemoveBranch(MachineBasicBlock &MBB) const override; 83*9880d681SAndroid Build Coastguard Worker unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 84*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, 85*9880d681SAndroid Build Coastguard Worker const DebugLoc &DL) const override; 86*9880d681SAndroid Build Coastguard Worker }; 87*9880d681SAndroid Build Coastguard Worker 88*9880d681SAndroid Build Coastguard Worker } 89*9880d681SAndroid Build Coastguard Worker 90*9880d681SAndroid Build Coastguard Worker #endif 91