LLVM API Documentation

XCoreInstrInfo.h
Go to the documentation of this file.
00001 //===-- XCoreInstrInfo.h - XCore 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 XCore implementation of the TargetInstrInfo class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_XCORE_XCOREINSTRINFO_H
00015 #define LLVM_LIB_TARGET_XCORE_XCOREINSTRINFO_H
00016 
00017 #include "XCoreRegisterInfo.h"
00018 #include "llvm/Target/TargetInstrInfo.h"
00019 
00020 #define GET_INSTRINFO_HEADER
00021 #include "XCoreGenInstrInfo.inc"
00022 
00023 namespace llvm {
00024 
00025 class XCoreInstrInfo : public XCoreGenInstrInfo {
00026   const XCoreRegisterInfo RI;
00027   virtual void anchor();
00028 public:
00029   XCoreInstrInfo();
00030 
00031   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
00032   /// such, whenever a client has an instance of instruction info, it should
00033   /// always be able to get register info as well (through this method).
00034   ///
00035   const TargetRegisterInfo &getRegisterInfo() const { return RI; }
00036 
00037   /// isLoadFromStackSlot - If the specified machine instruction is a direct
00038   /// load from a stack slot, return the virtual or physical register number of
00039   /// the destination along with the FrameIndex of the loaded stack slot.  If
00040   /// not, return 0.  This predicate must return 0 if the instruction has
00041   /// any side effects other than loading from the stack slot.
00042   unsigned isLoadFromStackSlot(const MachineInstr *MI,
00043                                int &FrameIndex) const override;
00044 
00045   /// isStoreToStackSlot - If the specified machine instruction is a direct
00046   /// store to a stack slot, return the virtual or physical register number of
00047   /// the source reg along with the FrameIndex of the loaded stack slot.  If
00048   /// not, return 0.  This predicate must return 0 if the instruction has
00049   /// any side effects other than storing to the stack slot.
00050   unsigned isStoreToStackSlot(const MachineInstr *MI,
00051                               int &FrameIndex) const override;
00052 
00053   bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
00054                      MachineBasicBlock *&FBB,
00055                      SmallVectorImpl<MachineOperand> &Cond,
00056                      bool AllowModify) const override;
00057 
00058   unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
00059                         MachineBasicBlock *FBB,
00060                         const SmallVectorImpl<MachineOperand> &Cond,
00061                         DebugLoc DL) const override;
00062 
00063   unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
00064 
00065   void copyPhysReg(MachineBasicBlock &MBB,
00066                    MachineBasicBlock::iterator I, DebugLoc DL,
00067                    unsigned DestReg, unsigned SrcReg,
00068                    bool KillSrc) const override;
00069 
00070   void storeRegToStackSlot(MachineBasicBlock &MBB,
00071                            MachineBasicBlock::iterator MI,
00072                            unsigned SrcReg, bool isKill, int FrameIndex,
00073                            const TargetRegisterClass *RC,
00074                            const TargetRegisterInfo *TRI) const override;
00075 
00076   void loadRegFromStackSlot(MachineBasicBlock &MBB,
00077                             MachineBasicBlock::iterator MI,
00078                             unsigned DestReg, int FrameIndex,
00079                             const TargetRegisterClass *RC,
00080                             const TargetRegisterInfo *TRI) const override;
00081 
00082   bool ReverseBranchCondition(
00083                           SmallVectorImpl<MachineOperand> &Cond) const override;
00084 
00085   // Emit code before MBBI to load immediate value into physical register Reg.
00086   // Returns an iterator to the new instruction.
00087   MachineBasicBlock::iterator loadImmediate(MachineBasicBlock &MBB,
00088                                             MachineBasicBlock::iterator MI,
00089                                             unsigned Reg, uint64_t Value) const;
00090 };
00091 
00092 }
00093 
00094 #endif