Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / lib / Target / NVPTX / NVPTXRegisterInfo.h
blob7bce3bd18ae8fcdd2339cd4abdbbabcd6bf2d4d0
1 //===- NVPTXRegisterInfo.h - NVPTX Register Information Impl ----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the NVPTX implementation of the TargetRegisterInfo class.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H
14 #define LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H
16 #include "llvm/CodeGen/TargetRegisterInfo.h"
17 #include "llvm/Support/StringSaver.h"
18 #include <sstream>
20 #define GET_REGINFO_HEADER
21 #include "NVPTXGenRegisterInfo.inc"
23 namespace llvm {
24 class NVPTXRegisterInfo : public NVPTXGenRegisterInfo {
25 private:
26 // Hold Strings that can be free'd all together with NVPTXRegisterInfo
27 BumpPtrAllocator StrAlloc;
28 UniqueStringSaver StrPool;
30 public:
31 NVPTXRegisterInfo();
33 //------------------------------------------------------
34 // Pure virtual functions from TargetRegisterInfo
35 //------------------------------------------------------
37 // NVPTX callee saved registers
38 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
40 BitVector getReservedRegs(const MachineFunction &MF) const override;
42 bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
43 unsigned FIOperandNum,
44 RegScavenger *RS = nullptr) const override;
46 Register getFrameRegister(const MachineFunction &MF) const override;
47 Register getFrameLocalRegister(const MachineFunction &MF) const;
49 UniqueStringSaver &getStrPool() const {
50 return const_cast<UniqueStringSaver &>(StrPool);
53 const char *getName(unsigned RegNo) const {
54 std::stringstream O;
55 O << "reg" << RegNo;
56 return getStrPool().save(O.str()).data();
61 std::string getNVPTXRegClassName(const TargetRegisterClass *RC);
62 std::string getNVPTXRegClassStr(const TargetRegisterClass *RC);
64 } // end namespace llvm
66 #endif