Home | History | Annotate | Download | only in NVPTX
      1 //===- NVPTXRegisterInfo.h - NVPTX Register Information Impl ----*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file contains the NVPTX implementation of the TargetRegisterInfo class.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef NVPTXREGISTERINFO_H
     15 #define NVPTXREGISTERINFO_H
     16 
     17 #include "ManagedStringPool.h"
     18 #include "llvm/Target/TargetRegisterInfo.h"
     19 
     20 #define GET_REGINFO_HEADER
     21 #include "NVPTXGenRegisterInfo.inc"
     22 #include "llvm/Target/TargetRegisterInfo.h"
     23 #include <sstream>
     24 
     25 namespace llvm {
     26 
     27 // Forward Declarations.
     28 class TargetInstrInfo;
     29 class NVPTXSubtarget;
     30 
     31 class NVPTXRegisterInfo : public NVPTXGenRegisterInfo {
     32 private:
     33   bool Is64Bit;
     34   // Hold Strings that can be free'd all together with NVPTXRegisterInfo
     35   ManagedStringPool ManagedStrPool;
     36 
     37 public:
     38   NVPTXRegisterInfo(const NVPTXSubtarget &st);
     39 
     40   //------------------------------------------------------
     41   // Pure virtual functions from TargetRegisterInfo
     42   //------------------------------------------------------
     43 
     44   // NVPTX callee saved registers
     45   virtual const uint16_t *
     46   getCalleeSavedRegs(const MachineFunction *MF = 0) const;
     47 
     48   // NVPTX callee saved register classes
     49   virtual const TargetRegisterClass *const *
     50   getCalleeSavedRegClasses(const MachineFunction *MF) const;
     51 
     52   virtual BitVector getReservedRegs(const MachineFunction &MF) const;
     53 
     54   virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
     55                                    unsigned FIOperandNum,
     56                                    RegScavenger *RS = NULL) const;
     57 
     58   virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const;
     59   virtual unsigned getFrameRegister(const MachineFunction &MF) const;
     60   virtual unsigned getRARegister() const;
     61 
     62   ManagedStringPool *getStrPool() const {
     63     return const_cast<ManagedStringPool *>(&ManagedStrPool);
     64   }
     65 
     66   const char *getName(unsigned RegNo) const {
     67     std::stringstream O;
     68     O << "reg" << RegNo;
     69     return getStrPool()->getManagedString(O.str().c_str())->c_str();
     70   }
     71 
     72 };
     73 
     74 std::string getNVPTXRegClassName(const TargetRegisterClass *RC);
     75 std::string getNVPTXRegClassStr(const TargetRegisterClass *RC);
     76 
     77 } // end namespace llvm
     78 
     79 #endif
     80