[C++] Use 'nullptr'.
[oota-llvm.git] / lib / Target / NVPTX / NVPTXRegisterInfo.h
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 #include <sstream>
20
21 #define GET_REGINFO_HEADER
22 #include "NVPTXGenRegisterInfo.inc"
23
24 namespace llvm {
25
26 // Forward Declarations.
27 class TargetInstrInfo;
28 class NVPTXSubtarget;
29
30 class NVPTXRegisterInfo : public NVPTXGenRegisterInfo {
31 private:
32   bool Is64Bit;
33   // Hold Strings that can be free'd all together with NVPTXRegisterInfo
34   ManagedStringPool ManagedStrPool;
35
36 public:
37   NVPTXRegisterInfo(const NVPTXSubtarget &st);
38
39   //------------------------------------------------------
40   // Pure virtual functions from TargetRegisterInfo
41   //------------------------------------------------------
42
43   // NVPTX callee saved registers
44   virtual const MCPhysReg *
45   getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
46
47   // NVPTX callee saved register classes
48   virtual const TargetRegisterClass *const *
49   getCalleeSavedRegClasses(const MachineFunction *MF) const;
50
51   virtual BitVector getReservedRegs(const MachineFunction &MF) const;
52
53   virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
54                                    unsigned FIOperandNum,
55                                    RegScavenger *RS = nullptr) const;
56
57   virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const;
58   virtual unsigned getFrameRegister(const MachineFunction &MF) const;
59   virtual unsigned getRARegister() const;
60
61   ManagedStringPool *getStrPool() const {
62     return const_cast<ManagedStringPool *>(&ManagedStrPool);
63   }
64
65   const char *getName(unsigned RegNo) const {
66     std::stringstream O;
67     O << "reg" << RegNo;
68     return getStrPool()->getManagedString(O.str().c_str())->c_str();
69   }
70
71 };
72
73 std::string getNVPTXRegClassName(const TargetRegisterClass *RC);
74 std::string getNVPTXRegClassStr(const TargetRegisterClass *RC);
75
76 } // end namespace llvm
77
78 #endif