NVPTXRegisterInfo.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H
  13. #define LLVM_LIB_TARGET_NVPTX_NVPTXREGISTERINFO_H
  14. #include "ManagedStringPool.h"
  15. #include "llvm/CodeGen/TargetRegisterInfo.h"
  16. #include <sstream>
  17. #define GET_REGINFO_HEADER
  18. #include "NVPTXGenRegisterInfo.inc"
  19. namespace llvm {
  20. class NVPTXRegisterInfo : public NVPTXGenRegisterInfo {
  21. private:
  22. // Hold Strings that can be free'd all together with NVPTXRegisterInfo
  23. ManagedStringPool ManagedStrPool;
  24. public:
  25. NVPTXRegisterInfo();
  26. //------------------------------------------------------
  27. // Pure virtual functions from TargetRegisterInfo
  28. //------------------------------------------------------
  29. // NVPTX callee saved registers
  30. const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
  31. BitVector getReservedRegs(const MachineFunction &MF) const override;
  32. void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
  33. unsigned FIOperandNum,
  34. RegScavenger *RS = nullptr) const override;
  35. Register getFrameRegister(const MachineFunction &MF) const override;
  36. Register getFrameLocalRegister(const MachineFunction &MF) const;
  37. ManagedStringPool *getStrPool() const {
  38. return const_cast<ManagedStringPool *>(&ManagedStrPool);
  39. }
  40. const char *getName(unsigned RegNo) const {
  41. std::stringstream O;
  42. O << "reg" << RegNo;
  43. return getStrPool()->getManagedString(O.str().c_str())->c_str();
  44. }
  45. };
  46. std::string getNVPTXRegClassName(const TargetRegisterClass *RC);
  47. std::string getNVPTXRegClassStr(const TargetRegisterClass *RC);
  48. } // end namespace llvm
  49. #endif