LLVM  17.0.0git
NVPTXRegisterInfo.h
Go to the documentation of this file.
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.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H
14 #define LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H
15 
18 #include <sstream>
19 
20 #define GET_REGINFO_HEADER
21 #include "NVPTXGenRegisterInfo.inc"
22 
23 namespace llvm {
25 private:
26  // Hold Strings that can be free'd all together with NVPTXRegisterInfo
27  BumpPtrAllocator StrAlloc;
28  UniqueStringSaver StrPool;
29 
30 public:
32 
33  //------------------------------------------------------
34  // Pure virtual functions from TargetRegisterInfo
35  //------------------------------------------------------
36 
37  // NVPTX callee saved registers
38  const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
39 
40  BitVector getReservedRegs(const MachineFunction &MF) const override;
41 
43  unsigned FIOperandNum,
44  RegScavenger *RS = nullptr) const override;
45 
46  Register getFrameRegister(const MachineFunction &MF) const override;
48 
50  return const_cast<UniqueStringSaver &>(StrPool);
51  }
52 
53  const char *getName(unsigned RegNo) const {
54  std::stringstream O;
55  O << "reg" << RegNo;
56  return getStrPool().save(O.str()).data();
57  }
58 
59 };
60 
61 std::string getNVPTXRegClassName(const TargetRegisterClass *RC);
62 std::string getNVPTXRegClassStr(const TargetRegisterClass *RC);
63 
64 } // end namespace llvm
65 
66 #endif
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:109
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::NVPTXRegisterInfo::getStrPool
UniqueStringSaver & getStrPool() const
Definition: NVPTXRegisterInfo.h:49
llvm::NVPTXRegisterInfo::getFrameRegister
Register getFrameRegister(const MachineFunction &MF) const override
Definition: NVPTXRegisterInfo.cpp:140
llvm::UniqueStringSaver
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition: StringSaver.h:44
llvm::NVPTXRegisterInfo::getFrameLocalRegister
Register getFrameLocalRegister(const MachineFunction &MF) const
Definition: NVPTXRegisterInfo.cpp:147
llvm::StringRef::data
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:131
llvm::NVPTXRegisterInfo::NVPTXRegisterInfo
NVPTXRegisterInfo()
Definition: NVPTXRegisterInfo.cpp:96
llvm::BitVector
Definition: BitVector.h:75
llvm::getNVPTXRegClassStr
std::string getNVPTXRegClassStr(TargetRegisterClass const *RC)
Definition: NVPTXRegisterInfo.cpp:73
StringSaver.h
llvm::NVPTXRegisterInfo::getName
const char * getName(unsigned RegNo) const
Definition: NVPTXRegisterInfo.h:53
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:274
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::RegScavenger
Definition: RegisterScavenging.h:34
llvm::UniqueStringSaver::save
StringRef save(const char *S)
Definition: StringSaver.h:52
llvm::MachineFunction
Definition: MachineFunction.h:258
llvm::NVPTXRegisterInfo::getReservedRegs
BitVector getReservedRegs(const MachineFunction &MF) const override
Definition: NVPTXRegisterInfo.cpp:109
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::NVPTXRegisterInfo::eliminateFrameIndex
bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
Definition: NVPTXRegisterInfo.cpp:122
llvm::NVPTXRegisterInfo::getCalleeSavedRegs
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
NVPTX Callee Saved Registers.
Definition: NVPTXRegisterInfo.cpp:104
uint16_t
llvm::NVPTXRegisterInfo
Definition: NVPTXRegisterInfo.h:24
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::getNVPTXRegClassName
std::string getNVPTXRegClassName(TargetRegisterClass const *RC)
Definition: NVPTXRegisterInfo.cpp:29
TargetRegisterInfo.h
NVPTXGenRegisterInfo