LLVM API Documentation

MSP430InstrInfo.h
Go to the documentation of this file.
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_LIB_TARGET_MSP430_MSP430INSTRINFO_H
00015 #define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
00016 
00017 #include "MSP430RegisterInfo.h"
00018 #include "llvm/Target/TargetInstrInfo.h"
00019 
00020 #define GET_INSTRINFO_HEADER
00021 #include "MSP430GenInstrInfo.inc"
00022 
00023 namespace llvm {
00024 
00025 class MSP430Subtarget;
00026 
00027 /// MSP430II - This namespace holds all of the target specific flags that
00028 /// instruction info tracks.
00029 ///
00030 namespace MSP430II {
00031   enum {
00032     SizeShift   = 2,
00033     SizeMask    = 7 << SizeShift,
00034 
00035     SizeUnknown = 0 << SizeShift,
00036     SizeSpecial = 1 << SizeShift,
00037     Size2Bytes  = 2 << SizeShift,
00038     Size4Bytes  = 3 << SizeShift,
00039     Size6Bytes  = 4 << SizeShift
00040   };
00041 }
00042 
00043 class MSP430InstrInfo : public MSP430GenInstrInfo {
00044   const MSP430RegisterInfo RI;
00045   virtual void anchor();
00046 public:
00047   explicit MSP430InstrInfo(MSP430Subtarget &STI);
00048 
00049   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
00050   /// such, whenever a client has an instance of instruction info, it should
00051   /// always be able to get register info as well (through this method).
00052   ///
00053   const TargetRegisterInfo &getRegisterInfo() const { return RI; }
00054 
00055   void copyPhysReg(MachineBasicBlock &MBB,
00056                    MachineBasicBlock::iterator I, DebugLoc DL,
00057                    unsigned DestReg, unsigned SrcReg,
00058                    bool KillSrc) const override;
00059 
00060   void storeRegToStackSlot(MachineBasicBlock &MBB,
00061                            MachineBasicBlock::iterator MI,
00062                            unsigned SrcReg, bool isKill,
00063                            int FrameIndex,
00064                            const TargetRegisterClass *RC,
00065                            const TargetRegisterInfo *TRI) const override;
00066   void loadRegFromStackSlot(MachineBasicBlock &MBB,
00067                             MachineBasicBlock::iterator MI,
00068                             unsigned DestReg, int FrameIdx,
00069                             const TargetRegisterClass *RC,
00070                             const TargetRegisterInfo *TRI) const override;
00071 
00072   unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
00073 
00074   // Branch folding goodness
00075   bool
00076   ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
00077   bool isUnpredicatedTerminator(const MachineInstr *MI) const override;
00078   bool AnalyzeBranch(MachineBasicBlock &MBB,
00079                      MachineBasicBlock *&TBB, MachineBasicBlock *&FBB,
00080                      SmallVectorImpl<MachineOperand> &Cond,
00081                      bool AllowModify) const override;
00082 
00083   unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
00084   unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
00085                         MachineBasicBlock *FBB,
00086                         const SmallVectorImpl<MachineOperand> &Cond,
00087                         DebugLoc DL) const override;
00088 
00089 };
00090 
00091 }
00092 
00093 #endif