LLVM API Documentation

SIRegisterInfo.h
Go to the documentation of this file.
00001 //===-- SIRegisterInfo.h - SI Register Info Interface ----------*- C++ -*--===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 /// \file
00011 /// \brief Interface definition for SIRegisterInfo
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 
00016 #ifndef LLVM_LIB_TARGET_R600_SIREGISTERINFO_H
00017 #define LLVM_LIB_TARGET_R600_SIREGISTERINFO_H
00018 
00019 #include "AMDGPURegisterInfo.h"
00020 
00021 namespace llvm {
00022 
00023 struct SIRegisterInfo : public AMDGPURegisterInfo {
00024 
00025   SIRegisterInfo(const AMDGPUSubtarget &st);
00026 
00027   BitVector getReservedRegs(const MachineFunction &MF) const override;
00028 
00029   unsigned getRegPressureLimit(const TargetRegisterClass *RC,
00030                                MachineFunction &MF) const override;
00031 
00032   bool requiresRegisterScavenging(const MachineFunction &Fn) const override;
00033 
00034   void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
00035                            unsigned FIOperandNum,
00036                            RegScavenger *RS) const override;
00037 
00038   /// \brief get the register class of the specified type to use in the
00039   /// CFGStructurizer
00040   const TargetRegisterClass * getCFGStructurizerRegClass(MVT VT) const override;
00041 
00042   unsigned getHWRegIndex(unsigned Reg) const override;
00043 
00044   /// \brief Return the 'base' register class for this register.
00045   /// e.g. SGPR0 => SReg_32, VGPR => VReg_32 SGPR0_SGPR1 -> SReg_32, etc.
00046   const TargetRegisterClass *getPhysRegClass(unsigned Reg) const;
00047 
00048   /// \returns true if this class contains only SGPR registers
00049   bool isSGPRClass(const TargetRegisterClass *RC) const;
00050 
00051   /// \returns true if this class contains VGPR registers.
00052   bool hasVGPRs(const TargetRegisterClass *RC) const;
00053 
00054   /// \returns A VGPR reg class with the same width as \p SRC
00055   const TargetRegisterClass *getEquivalentVGPRClass(
00056                                           const TargetRegisterClass *SRC) const;
00057 
00058   /// \returns The register class that is used for a sub-register of \p RC for
00059   /// the given \p SubIdx.  If \p SubIdx equals NoSubRegister, \p RC will
00060   /// be returned.
00061   const TargetRegisterClass *getSubRegClass(const TargetRegisterClass *RC,
00062                                             unsigned SubIdx) const;
00063 
00064   /// \p Channel This is the register channel (e.g. a value from 0-16), not the
00065   ///            SubReg index.
00066   /// \returns The sub-register of Reg that is in Channel.
00067   unsigned getPhysRegSubReg(unsigned Reg, const TargetRegisterClass *SubRC,
00068                             unsigned Channel) const;
00069 
00070   /// \returns True if operands defined with this register class can accept
00071   /// inline immediates.
00072   bool regClassCanUseImmediate(int RCID) const;
00073 
00074   /// \returns True if operands defined with this register class can accept
00075   /// inline immediates.
00076   bool regClassCanUseImmediate(const TargetRegisterClass *RC) const;
00077 
00078   enum PreloadedValue {
00079     TGID_X,
00080     TGID_Y,
00081     TGID_Z,
00082     SCRATCH_WAVE_OFFSET,
00083     SCRATCH_PTR
00084   };
00085 
00086   /// \brief Returns the physical register that \p Value is stored in.
00087   unsigned getPreloadedValue(const MachineFunction &MF,
00088                              enum PreloadedValue Value) const;
00089 
00090 };
00091 
00092 } // End namespace llvm
00093 
00094 #endif