LLVM API Documentation
00001 //===- NVPTXInstrInfo.h - NVPTX Instruction Information----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the niversity of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the NVPTX implementation of the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXINSTRINFO_H 00015 #define LLVM_LIB_TARGET_NVPTX_NVPTXINSTRINFO_H 00016 00017 #include "NVPTX.h" 00018 #include "NVPTXRegisterInfo.h" 00019 #include "llvm/Target/TargetInstrInfo.h" 00020 00021 #define GET_INSTRINFO_HEADER 00022 #include "NVPTXGenInstrInfo.inc" 00023 00024 namespace llvm { 00025 00026 class NVPTXInstrInfo : public NVPTXGenInstrInfo { 00027 const NVPTXRegisterInfo RegInfo; 00028 virtual void anchor(); 00029 public: 00030 explicit NVPTXInstrInfo(NVPTXSubtarget &STI); 00031 00032 const NVPTXRegisterInfo &getRegisterInfo() const { return RegInfo; } 00033 00034 /* The following virtual functions are used in register allocation. 00035 * They are not implemented because the existing interface and the logic 00036 * at the caller side do not work for the elementized vector load and store. 00037 * 00038 * virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, 00039 * int &FrameIndex) const; 00040 * virtual unsigned isStoreToStackSlot(const MachineInstr *MI, 00041 * int &FrameIndex) const; 00042 * virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 00043 * MachineBasicBlock::iterator MBBI, 00044 * unsigned SrcReg, bool isKill, int FrameIndex, 00045 * const TargetRegisterClass *RC) const; 00046 * virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 00047 * MachineBasicBlock::iterator MBBI, 00048 * unsigned DestReg, int FrameIndex, 00049 * const TargetRegisterClass *RC) const; 00050 */ 00051 00052 void copyPhysReg( 00053 MachineBasicBlock &MBB, MachineBasicBlock::iterator I, DebugLoc DL, 00054 unsigned DestReg, unsigned SrcReg, bool KillSrc) const override; 00055 virtual bool isMoveInstr(const MachineInstr &MI, unsigned &SrcReg, 00056 unsigned &DestReg) const; 00057 bool isLoadInstr(const MachineInstr &MI, unsigned &AddrSpace) const; 00058 bool isStoreInstr(const MachineInstr &MI, unsigned &AddrSpace) const; 00059 bool isReadSpecialReg(MachineInstr &MI) const; 00060 00061 virtual bool CanTailMerge(const MachineInstr *MI) const; 00062 // Branch analysis. 00063 bool AnalyzeBranch( 00064 MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, 00065 SmallVectorImpl<MachineOperand> &Cond, bool AllowModify) const override; 00066 unsigned RemoveBranch(MachineBasicBlock &MBB) const override; 00067 unsigned InsertBranch( 00068 MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, 00069 const SmallVectorImpl<MachineOperand> &Cond, DebugLoc DL) const override; 00070 unsigned getLdStCodeAddrSpace(const MachineInstr &MI) const { 00071 return MI.getOperand(2).getImm(); 00072 } 00073 00074 }; 00075 00076 } // namespace llvm 00077 00078 #endif