LLVM API Documentation
00001 //===- NVPTXRegisterInfo.h - NVPTX Register Information Impl ----*- 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 NVPTX implementation of the TargetRegisterInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H 00015 #define LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H 00016 00017 #include "ManagedStringPool.h" 00018 #include "llvm/Target/TargetRegisterInfo.h" 00019 #include <sstream> 00020 00021 #define GET_REGINFO_HEADER 00022 #include "NVPTXGenRegisterInfo.inc" 00023 00024 namespace llvm { 00025 00026 // Forward Declarations. 00027 class TargetInstrInfo; 00028 class NVPTXSubtarget; 00029 00030 class NVPTXRegisterInfo : public NVPTXGenRegisterInfo { 00031 private: 00032 bool Is64Bit; 00033 // Hold Strings that can be free'd all together with NVPTXRegisterInfo 00034 ManagedStringPool ManagedStrPool; 00035 00036 public: 00037 NVPTXRegisterInfo(const NVPTXSubtarget &st); 00038 00039 //------------------------------------------------------ 00040 // Pure virtual functions from TargetRegisterInfo 00041 //------------------------------------------------------ 00042 00043 // NVPTX callee saved registers 00044 const MCPhysReg * 00045 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override; 00046 00047 BitVector getReservedRegs(const MachineFunction &MF) const override; 00048 00049 void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, 00050 unsigned FIOperandNum, 00051 RegScavenger *RS = nullptr) const override; 00052 00053 unsigned getFrameRegister(const MachineFunction &MF) const override; 00054 00055 ManagedStringPool *getStrPool() const { 00056 return const_cast<ManagedStringPool *>(&ManagedStrPool); 00057 } 00058 00059 const char *getName(unsigned RegNo) const { 00060 std::stringstream O; 00061 O << "reg" << RegNo; 00062 return getStrPool()->getManagedString(O.str().c_str())->c_str(); 00063 } 00064 00065 }; 00066 00067 std::string getNVPTXRegClassName(const TargetRegisterClass *RC); 00068 std::string getNVPTXRegClassStr(const TargetRegisterClass *RC); 00069 00070 } // end namespace llvm 00071 00072 #endif