1 //===-- SIRegisterInfo.h - SI Register Info Interface ----------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Interface definition for SIRegisterInfo
13 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_R600_SIREGISTERINFO_H
17 #define LLVM_LIB_TARGET_R600_SIREGISTERINFO_H
19 #include "AMDGPURegisterInfo.h"
23 struct SIRegisterInfo : public AMDGPURegisterInfo {
25 SIRegisterInfo(const AMDGPUSubtarget &st);
27 BitVector getReservedRegs(const MachineFunction &MF) const override;
29 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
30 MachineFunction &MF) const override;
32 bool requiresRegisterScavenging(const MachineFunction &Fn) const override;
34 void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
35 unsigned FIOperandNum,
36 RegScavenger *RS) const override;
38 /// \brief get the register class of the specified type to use in the
40 const TargetRegisterClass * getCFGStructurizerRegClass(MVT VT) const override;
42 unsigned getHWRegIndex(unsigned Reg) const override;
44 /// \brief Return the 'base' register class for this register.
45 /// e.g. SGPR0 => SReg_32, VGPR => VGPR_32 SGPR0_SGPR1 -> SReg_32, etc.
46 const TargetRegisterClass *getPhysRegClass(unsigned Reg) const;
48 /// \returns true if this class contains only SGPR registers
49 bool isSGPRClass(const TargetRegisterClass *RC) const {
56 /// \returns true if this class ID contains only SGPR registers
57 bool isSGPRClassID(unsigned RCID) const {
58 if (static_cast<int>(RCID) == -1)
61 return isSGPRClass(getRegClass(RCID));
64 /// \returns true if this class contains VGPR registers.
65 bool hasVGPRs(const TargetRegisterClass *RC) const;
67 /// \returns A VGPR reg class with the same width as \p SRC
68 const TargetRegisterClass *getEquivalentVGPRClass(
69 const TargetRegisterClass *SRC) const;
71 /// \returns The register class that is used for a sub-register of \p RC for
72 /// the given \p SubIdx. If \p SubIdx equals NoSubRegister, \p RC will
74 const TargetRegisterClass *getSubRegClass(const TargetRegisterClass *RC,
75 unsigned SubIdx) const;
77 /// \p Channel This is the register channel (e.g. a value from 0-16), not the
79 /// \returns The sub-register of Reg that is in Channel.
80 unsigned getPhysRegSubReg(unsigned Reg, const TargetRegisterClass *SubRC,
81 unsigned Channel) const;
83 /// \returns True if operands defined with this operand type can accept
84 /// a literal constant (i.e. any 32-bit immediate).
85 bool opCanUseLiteralConstant(unsigned OpType) const;
87 /// \returns True if operands defined with this operand type can accept
88 /// an inline constant. i.e. An integer value in the range (-16, 64) or
89 /// -4.0f, -2.0f, -1.0f, -0.5f, 0.0f, 0.5f, 1.0f, 2.0f, 4.0f.
90 bool opCanUseInlineConstant(unsigned OpType) const;
104 /// \brief Returns the physical register that \p Value is stored in.
105 unsigned getPreloadedValue(const MachineFunction &MF,
106 enum PreloadedValue Value) const;
108 unsigned findUnusedRegister(const MachineRegisterInfo &MRI,
109 const TargetRegisterClass *RC) const;
112 void buildScratchLoadStore(MachineBasicBlock::iterator MI,
113 unsigned LoadStoreOp, unsigned Value,
114 unsigned ScratchRsrcReg, unsigned ScratchOffset,
115 int64_t Offset, RegScavenger *RS) const;
118 } // End namespace llvm