LLVM API Documentation

SparcInstrInfo.h
Go to the documentation of this file.
00001 //===-- SparcInstrInfo.h - Sparc 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 Sparc implementation of the TargetInstrInfo class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H
00015 #define LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H
00016 
00017 #include "SparcRegisterInfo.h"
00018 #include "llvm/Target/TargetInstrInfo.h"
00019 
00020 #define GET_INSTRINFO_HEADER
00021 #include "SparcGenInstrInfo.inc"
00022 
00023 namespace llvm {
00024 
00025 /// SPII - This namespace holds all of the target specific flags that
00026 /// instruction info tracks.
00027 ///
00028 namespace SPII {
00029   enum {
00030     Pseudo = (1<<0),
00031     Load = (1<<1),
00032     Store = (1<<2),
00033     DelaySlot = (1<<3)
00034   };
00035 }
00036 
00037 class SparcInstrInfo : public SparcGenInstrInfo {
00038   const SparcRegisterInfo RI;
00039   const SparcSubtarget& Subtarget;
00040   virtual void anchor();
00041 public:
00042   explicit SparcInstrInfo(SparcSubtarget &ST);
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   const SparcRegisterInfo &getRegisterInfo() const { return RI; }
00049 
00050   /// isLoadFromStackSlot - If the specified machine instruction is a direct
00051   /// load from a stack slot, return the virtual or physical register number of
00052   /// the destination along with the FrameIndex of the loaded stack slot.  If
00053   /// not, return 0.  This predicate must return 0 if the instruction has
00054   /// any side effects other than loading from the stack slot.
00055   unsigned isLoadFromStackSlot(const MachineInstr *MI,
00056                                int &FrameIndex) const override;
00057 
00058   /// isStoreToStackSlot - If the specified machine instruction is a direct
00059   /// store to a stack slot, return the virtual or physical register number of
00060   /// the source reg along with the FrameIndex of the loaded stack slot.  If
00061   /// not, return 0.  This predicate must return 0 if the instruction has
00062   /// any side effects other than storing to the stack slot.
00063   unsigned isStoreToStackSlot(const MachineInstr *MI,
00064                               int &FrameIndex) const override;
00065 
00066   bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
00067                      MachineBasicBlock *&FBB,
00068                      SmallVectorImpl<MachineOperand> &Cond,
00069                      bool AllowModify = false) const override ;
00070 
00071   unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
00072 
00073   unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
00074                         MachineBasicBlock *FBB,
00075                         const SmallVectorImpl<MachineOperand> &Cond,
00076                         DebugLoc DL) const override;
00077 
00078   void copyPhysReg(MachineBasicBlock &MBB,
00079                    MachineBasicBlock::iterator I, DebugLoc DL,
00080                    unsigned DestReg, unsigned SrcReg,
00081                    bool KillSrc) const override;
00082 
00083   void storeRegToStackSlot(MachineBasicBlock &MBB,
00084                            MachineBasicBlock::iterator MBBI,
00085                            unsigned SrcReg, bool isKill, int FrameIndex,
00086                            const TargetRegisterClass *RC,
00087                            const TargetRegisterInfo *TRI) const override;
00088 
00089   void loadRegFromStackSlot(MachineBasicBlock &MBB,
00090                             MachineBasicBlock::iterator MBBI,
00091                             unsigned DestReg, int FrameIndex,
00092                             const TargetRegisterClass *RC,
00093                             const TargetRegisterInfo *TRI) const override;
00094 
00095   unsigned getGlobalBaseReg(MachineFunction *MF) const;
00096 };
00097 
00098 }
00099 
00100 #endif