LLVM  5.0.0
Public Types | Public Member Functions | List of all members
llvm::SIRegisterInfo Class Referencefinal

#include "Target/AMDGPU/SIRegisterInfo.h"

Inheritance diagram for llvm::SIRegisterInfo:
[legend]
Collaboration diagram for llvm::SIRegisterInfo:
[legend]

Public Types

enum  PreloadedValue {
  PRIVATE_SEGMENT_BUFFER = 0, DISPATCH_PTR = 1, QUEUE_PTR = 2, KERNARG_SEGMENT_PTR = 3,
  DISPATCH_ID = 4, FLAT_SCRATCH_INIT = 5, WORKGROUP_ID_X = 10, WORKGROUP_ID_Y = 11,
  WORKGROUP_ID_Z = 12, PRIVATE_SEGMENT_WAVE_BYTE_OFFSET = 14, IMPLICIT_BUFFER_PTR = 15, FIRST_VGPR_VALUE = 16,
  WORKITEM_ID_X = FIRST_VGPR_VALUE, WORKITEM_ID_Y = 17, WORKITEM_ID_Z = 18
}
 

Public Member Functions

 SIRegisterInfo (const SISubtarget &ST)
 
bool spillSGPRToVGPR () const
 
bool spillSGPRToSMEM () const
 
unsigned reservedPrivateSegmentBufferReg (const MachineFunction &MF) const
 Return the end register initially reserved for the scratch buffer in case spilling is needed. More...
 
unsigned reservedPrivateSegmentWaveByteOffsetReg (const MachineFunction &MF) const
 Return the end register initially reserved for the scratch wave offset in case spilling is needed. More...
 
unsigned reservedStackPtrOffsetReg (const MachineFunction &MF) const
 
BitVector getReservedRegs (const MachineFunction &MF) const override
 
const MCPhysReg * getCalleeSavedRegs (const MachineFunction *MF) const override
 
const uint32_t * getCallPreservedMask (const MachineFunction &MF, CallingConv::ID) const override
 
unsigned getCSRFirstUseCost () const override
 
unsigned getFrameRegister (const MachineFunction &MF) const override
 
bool requiresRegisterScavenging (const MachineFunction &Fn) const override
 
bool requiresFrameIndexScavenging (const MachineFunction &MF) const override
 
bool requiresFrameIndexReplacementScavenging (const MachineFunction &MF) const override
 
bool requiresVirtualBaseRegisters (const MachineFunction &Fn) const override
 
bool trackLivenessAfterRegAlloc (const MachineFunction &MF) const override
 
int64_t getMUBUFInstrOffset (const MachineInstr *MI) const
 
int64_t getFrameIndexInstrOffset (const MachineInstr *MI, int Idx) const override
 
bool needsFrameBaseReg (MachineInstr *MI, int64_t Offset) const override
 
void materializeFrameBaseRegister (MachineBasicBlock *MBB, unsigned BaseReg, int FrameIdx, int64_t Offset) const override
 
void resolveFrameIndex (MachineInstr &MI, unsigned BaseReg, int64_t Offset) const override
 
bool isFrameOffsetLegal (const MachineInstr *MI, unsigned BaseReg, int64_t Offset) const override
 
const TargetRegisterClass * getPointerRegClass (const MachineFunction &MF, unsigned Kind=0) const override
 
bool spillSGPR (MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, bool OnlyToVGPR=false) const
 If OnlyToVGPR is true, this will only succeed if this. More...
 
bool restoreSGPR (MachineBasicBlock::iterator MI, int FI, RegScavenger *RS, bool OnlyToVGPR=false) const
 
void eliminateFrameIndex (MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
 
bool eliminateSGPRToVGPRSpillFrameIndex (MachineBasicBlock::iterator MI, int FI, RegScavenger *RS) const
 Special case of eliminateFrameIndex. More...
 
StringRef getRegAsmName (unsigned Reg) const override
 
unsigned getHWRegIndex (unsigned Reg) const
 
const TargetRegisterClass * getPhysRegClass (unsigned Reg) const
 Return the 'base' register class for this register. More...
 
bool isSGPRClass (const TargetRegisterClass *RC) const
 
bool isSGPRClassID (unsigned RCID) const
 
bool isSGPRReg (const MachineRegisterInfo &MRI, unsigned Reg) const
 
bool hasVGPRs (const TargetRegisterClass *RC) const
 
const TargetRegisterClass * getEquivalentVGPRClass (const TargetRegisterClass *SRC) const
 
const TargetRegisterClass * getEquivalentSGPRClass (const TargetRegisterClass *VRC) const
 
const TargetRegisterClass * getSubRegClass (const TargetRegisterClass *RC, unsigned SubIdx) const
 
bool shouldRewriteCopySrc (const TargetRegisterClass *DefRC, unsigned DefSubReg, const TargetRegisterClass *SrcRC, unsigned SrcSubReg) const override
 
bool opCanUseLiteralConstant (unsigned OpType) const
 
bool opCanUseInlineConstant (unsigned OpType) const
 
unsigned getPreloadedValue (const MachineFunction &MF, enum PreloadedValue Value) const
 Returns the physical register that Value is stored in. More...
 
unsigned findUnusedRegister (const MachineRegisterInfo &MRI, const TargetRegisterClass *RC, const MachineFunction &MF) const
 Returns a register that is not used at any point in the function. More...
 
unsigned getSGPRPressureSet () const
 
unsigned getVGPRPressureSet () const
 
const TargetRegisterClass * getRegClassForReg (const MachineRegisterInfo &MRI, unsigned Reg) const
 
bool isVGPR (const MachineRegisterInfo &MRI, unsigned Reg) const
 
bool isSGPRPressureSet (unsigned SetID) const
 
bool isVGPRPressureSet (unsigned SetID) const
 
ArrayRef< int16_t > getRegSplitParts (const TargetRegisterClass *RC, unsigned EltSize) const
 
bool shouldCoalesce (MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC) const override
 
unsigned getRegPressureLimit (const TargetRegisterClass *RC, MachineFunction &MF) const override
 
unsigned getRegPressureSetLimit (const MachineFunction &MF, unsigned Idx) const override
 
const int * getRegUnitPressureSets (unsigned RegUnit) const override
 
unsigned getReturnAddressReg (const MachineFunction &MF) const
 
- Public Member Functions inherited from llvm::AMDGPURegisterInfo
 AMDGPURegisterInfo ()
 
unsigned getSubRegFromChannel (unsigned Channel) const
 

Detailed Description

Definition at line 29 of file SIRegisterInfo.h.

Member Enumeration Documentation

Enumerator
PRIVATE_SEGMENT_BUFFER 
DISPATCH_PTR 
QUEUE_PTR 
KERNARG_SEGMENT_PTR 
DISPATCH_ID 
FLAT_SCRATCH_INIT 
WORKGROUP_ID_X 
WORKGROUP_ID_Y 
WORKGROUP_ID_Z 
PRIVATE_SEGMENT_WAVE_BYTE_OFFSET 
IMPLICIT_BUFFER_PTR 
FIRST_VGPR_VALUE 
WORKITEM_ID_X 
WORKITEM_ID_Y 
WORKITEM_ID_Z 

Definition at line 188 of file SIRegisterInfo.h.

Constructor & Destructor Documentation

SIRegisterInfo::SIRegisterInfo ( const SISubtarget &  ST)

Member Function Documentation

void SIRegisterInfo::eliminateFrameIndex ( MachineBasicBlock::iterator  MI,
int  SPAdj,
unsigned  FIOperandNum,
RegScavenger *  RS 
) const
override
bool SIRegisterInfo::eliminateSGPRToVGPRSpillFrameIndex ( MachineBasicBlock::iterator  MI,
int  FI,
RegScavenger *  RS 
) const

Special case of eliminateFrameIndex.

Returns true if the SGPR was spilled to a VGPR and the stack slot can be safely eliminated when all other users are handled.

Definition at line 917 of file SIRegisterInfo.cpp.

References llvm_unreachable(), restoreSGPR(), and spillSGPR().

Referenced by llvm::SIFrameLowering::processFunctionBeforeFrameFinalized().

unsigned SIRegisterInfo::findUnusedRegister ( const MachineRegisterInfo &  MRI,
const TargetRegisterClass *  RC,
const MachineFunction &  MF 
) const

Returns a register that is not used at any point in the function.

If all registers are used, then this function will return

Definition at line 1396 of file SIRegisterInfo.cpp.

References llvm::MachineRegisterInfo::isAllocatable(), and llvm::MachineRegisterInfo::isPhysRegUsed().

Referenced by llvm::SIInstrInfo::calculateLDSSpillAddress().

const MCPhysReg * SIRegisterInfo::getCalleeSavedRegs ( const MachineFunction *  MF) const
override
const uint32_t * SIRegisterInfo::getCallPreservedMask ( const MachineFunction &  MF,
CallingConv::ID  CC 
) const
override

Definition at line 59 of file AMDGPURegisterInfo.cpp.

References llvm::CallingConv::C, and llvm::CallingConv::Fast.

unsigned llvm::SIRegisterInfo::getCSRFirstUseCost ( ) const
inlineoverride

Definition at line 71 of file SIRegisterInfo.h.

const TargetRegisterClass * SIRegisterInfo::getEquivalentSGPRClass ( const TargetRegisterClass *  VRC) const
Returns
A SGPR reg class with the same width as SRC

Definition at line 1254 of file SIRegisterInfo.cpp.

References llvm_unreachable().

Referenced by llvm::SIInstrInfo::readlaneVGPRToSGPR(), and tryChangeVGPRtoSGPRinCopy().

const TargetRegisterClass * SIRegisterInfo::getEquivalentVGPRClass ( const TargetRegisterClass *  SRC) const
Returns
A VGPR reg class with the same width as SRC

Definition at line 1234 of file SIRegisterInfo.cpp.

References llvm_unreachable().

Referenced by foldVGPRCopyIntoRegSequence(), llvm::SIInstrInfo::legalizeOperands(), and llvm::SIInstrInfo::legalizeOpWithMove().

int64_t SIRegisterInfo::getFrameIndexInstrOffset ( const MachineInstr *  MI,
int  Idx 
) const
override
unsigned SIRegisterInfo::getFrameRegister ( const MachineFunction &  MF) const
override
unsigned llvm::SIRegisterInfo::getHWRegIndex ( unsigned  Reg) const
inline

Definition at line 123 of file SIRegisterInfo.h.

Referenced by llvm::SIInstrInfo::copyPhysReg().

int64_t SIRegisterInfo::getMUBUFInstrOffset ( const MachineInstr *  MI) const
const TargetRegisterClass * SIRegisterInfo::getPhysRegClass ( unsigned  Reg) const

Return the 'base' register class for this register.

e.g. SGPR0 => SReg_32, VGPR => VGPR_32 SGPR0_SGPR1 -> SReg_32, etc.

Definition at line 1184 of file SIRegisterInfo.cpp.

References assert(), and llvm::TargetRegisterInfo::isVirtualRegister().

Referenced by llvm::SIInstrInfo::copyPhysReg(), getCopyRegClasses(), llvm::SIInstrInfo::getOpRegClass(), getRegClassForReg(), llvm::SIInstrInfo::isLegalRegOperand(), isSGPRReg(), isVGPR(), restoreSGPR(), and spillSGPR().

const TargetRegisterClass * SIRegisterInfo::getPointerRegClass ( const MachineFunction &  MF,
unsigned  Kind = 0 
) const
override

Definition at line 377 of file SIRegisterInfo.cpp.

unsigned SIRegisterInfo::getPreloadedValue ( const MachineFunction &  MF,
enum PreloadedValue  Value 
) const
StringRef SIRegisterInfo::getRegAsmName ( unsigned  Reg) const
override

Definition at line 1122 of file SIRegisterInfo.cpp.

References llvm::TargetRegisterInfo::getRegAsmName(), and REG_RANGE.

const TargetRegisterClass * SIRegisterInfo::getRegClassForReg ( const MachineRegisterInfo &  MRI,
unsigned  Reg 
) const
unsigned SIRegisterInfo::getRegPressureLimit ( const TargetRegisterClass *  RC,
MachineFunction &  MF 
) const
override
unsigned SIRegisterInfo::getRegPressureSetLimit ( const MachineFunction &  MF,
unsigned  Idx 
) const
override
ArrayRef< int16_t > SIRegisterInfo::getRegSplitParts ( const TargetRegisterClass *  RC,
unsigned  EltSize 
) const
const int * SIRegisterInfo::getRegUnitPressureSets ( unsigned  RegUnit) const
override

Definition at line 1574 of file SIRegisterInfo.cpp.

References llvm::Empty.

Referenced by SIRegisterInfo().

BitVector SIRegisterInfo::getReservedRegs ( const MachineFunction &  MF) const
override
unsigned llvm::SIRegisterInfo::getReturnAddressReg ( const MachineFunction &  MF) const
inline

Definition at line 249 of file SIRegisterInfo.h.

Referenced by llvm::SITargetLowering::LowerReturn().

unsigned llvm::SIRegisterInfo::getSGPRPressureSet ( ) const
inline
const TargetRegisterClass * SIRegisterInfo::getSubRegClass ( const TargetRegisterClass *  RC,
unsigned  SubIdx 
) const
Returns
The register class that is used for a sub-register of RC for the given SubIdx. If SubIdx equals NoSubRegister, RC will be returned.

Definition at line 1272 of file SIRegisterInfo.cpp.

References llvm::countPopulation(), isSGPRClass(), llvm_unreachable(), and llvm::BitmaskEnumDetail::Mask().

Referenced by foldVGPRCopyIntoRegSequence(), and llvm::SIInstrInfo::isLegalRegOperand().

unsigned llvm::SIRegisterInfo::getVGPRPressureSet ( ) const
inline
bool SIRegisterInfo::hasVGPRs ( const TargetRegisterClass *  RC) const
bool SIRegisterInfo::isFrameOffsetLegal ( const MachineInstr *  MI,
unsigned  BaseReg,
int64_t  Offset 
) const
override

Definition at line 366 of file SIRegisterInfo.cpp.

References getMUBUFInstrOffset(), and llvm::SIInstrInfo::isMUBUF().

bool llvm::SIRegisterInfo::isSGPRClass ( const TargetRegisterClass *  RC) const
inline
bool llvm::SIRegisterInfo::isSGPRClassID ( unsigned  RCID) const
inline
Returns
true if this class ID contains only SGPR registers

Definition at line 137 of file SIRegisterInfo.h.

References getRegClass(), and isSGPRClass().

bool llvm::SIRegisterInfo::isSGPRPressureSet ( unsigned  SetID) const
inline

Definition at line 224 of file SIRegisterInfo.h.

References llvm::BitVector::test().

Referenced by SIRegisterInfo().

bool llvm::SIRegisterInfo::isSGPRReg ( const MachineRegisterInfo &  MRI,
unsigned  Reg 
) const
inline
bool SIRegisterInfo::isVGPR ( const MachineRegisterInfo &  MRI,
unsigned  Reg 
) const
bool llvm::SIRegisterInfo::isVGPRPressureSet ( unsigned  SetID) const
inline

Definition at line 227 of file SIRegisterInfo.h.

References llvm::BitVector::test().

Referenced by SIRegisterInfo().

void SIRegisterInfo::materializeFrameBaseRegister ( MachineBasicBlock *  MBB,
unsigned  BaseReg,
int  FrameIdx,
int64_t  Offset 
) const
override
bool SIRegisterInfo::needsFrameBaseReg ( MachineInstr *  MI,
int64_t  Offset 
) const
override
bool llvm::SIRegisterInfo::opCanUseInlineConstant ( unsigned  OpType) const
inline
Returns
True if operands defined with this operand type can accept an inline constant. i.e. An integer value in the range (-16, 64) or -4.0f, -2.0f, -1.0f, -0.5f, 0.0f, 0.5f, 1.0f, 2.0f, 4.0f.

Definition at line 183 of file SIRegisterInfo.h.

References llvm::AMDGPU::OPERAND_SRC_FIRST, and llvm::AMDGPU::OPERAND_SRC_LAST.

Referenced by llvm::SIInstrInfo::isImmOperandLegal().

bool llvm::SIRegisterInfo::opCanUseLiteralConstant ( unsigned  OpType) const
inline
Returns
True if operands defined with this operand type can accept a literal constant (i.e. any 32-bit immediate).

Definition at line 174 of file SIRegisterInfo.h.

References llvm::AMDGPU::OPERAND_REG_IMM_FIRST, and llvm::AMDGPU::OPERAND_REG_IMM_LAST.

Referenced by llvm::SIInstrInfo::isImmOperandLegal().

bool SIRegisterInfo::requiresFrameIndexReplacementScavenging ( const MachineFunction &  MF) const
override
bool SIRegisterInfo::requiresFrameIndexScavenging ( const MachineFunction &  MF) const
override
bool SIRegisterInfo::requiresRegisterScavenging ( const MachineFunction &  Fn) const
override
bool SIRegisterInfo::requiresVirtualBaseRegisters ( const MachineFunction &  Fn) const
override

Definition at line 254 of file SIRegisterInfo.cpp.

unsigned SIRegisterInfo::reservedPrivateSegmentBufferReg ( const MachineFunction &  MF) const

Return the end register initially reserved for the scratch buffer in case spilling is needed.

Definition at line 111 of file SIRegisterInfo.cpp.

References llvm::alignDown(), llvm::SISubtarget::getMaxNumSGPRs(), llvm::MachineFunction::getSubtarget(), and llvm::ARM_MB::ST.

Referenced by reservePrivateMemoryRegs().

unsigned SIRegisterInfo::reservedPrivateSegmentWaveByteOffsetReg ( const MachineFunction &  MF) const

Return the end register initially reserved for the scratch wave offset in case spilling is needed.

Definition at line 137 of file SIRegisterInfo.cpp.

References findPrivateSegmentWaveByteOffsetRegIndex(), llvm::SISubtarget::getMaxNumSGPRs(), llvm::MachineFunction::getSubtarget(), and llvm::ARM_MB::ST.

Referenced by reservePrivateMemoryRegs().

unsigned SIRegisterInfo::reservedStackPtrOffsetReg ( const MachineFunction &  MF) const

Definition at line 144 of file SIRegisterInfo.cpp.

void SIRegisterInfo::resolveFrameIndex ( MachineInstr &  MI,
unsigned  BaseReg,
int64_t  Offset 
) const
override
bool SIRegisterInfo::restoreSGPR ( MachineBasicBlock::iterator  MI,
int  FI,
RegScavenger *  RS,
bool  OnlyToVGPR = false 
) const
bool SIRegisterInfo::shouldCoalesce ( MachineInstr *  MI,
const TargetRegisterClass *  SrcRC,
unsigned  SubReg,
const TargetRegisterClass *  DstRC,
unsigned  DstSubReg,
const TargetRegisterClass *  NewRC 
) const
override

Definition at line 1523 of file SIRegisterInfo.cpp.

bool SIRegisterInfo::shouldRewriteCopySrc ( const TargetRegisterClass *  DefRC,
unsigned  DefSubReg,
const TargetRegisterClass *  SrcRC,
unsigned  SrcSubReg 
) const
override

Definition at line 1313 of file SIRegisterInfo.cpp.

bool SIRegisterInfo::spillSGPR ( MachineBasicBlock::iterator  MI,
int  FI,
RegScavenger *  RS,
bool  OnlyToVGPR = false 
) const

If OnlyToVGPR is true, this will only succeed if this.

Definition at line 608 of file SIRegisterInfo.cpp.

References llvm::MachineInstrBuilder::addFrameIndex(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMemOperand(), llvm::MachineInstrBuilder::addReg(), llvm::SIMachineFunctionInfo::addToSpilledSGPRs(), assert(), llvm::BuildMI(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::ArrayRef< T >::empty(), llvm::MDNode::get(), llvm::MachinePointerInfo::getFixedStack(), llvm::MachineFunction::getFrameInfo(), llvm::SIMachineFunctionInfo::getFrameOffsetReg(), llvm::MachineFunction::getInfo(), llvm::SISubtarget::getInstrInfo(), llvm::getKillRegState(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineFrameInfo::getObjectAlignment(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineBasicBlock::getParent(), getPhysRegClass(), llvm::MachineFunction::getRegInfo(), getRegSplitParts(), llvm::SIMachineFunctionInfo::getScratchRSrcReg(), llvm::SIMachineFunctionInfo::getSGPRToVGPRSpills(), getSpillEltSize(), llvm::MachineFunction::getSubtarget(), llvm::AMDGPUSubtarget::getWavefrontSize(), llvm::RegState::Implicit, llvm::RegScavenger::isRegUsed(), isSGPRClass(), llvm::RegState::Kill, llvm::SIMachineFunctionInfo::SpilledReg::Lane, llvm::MinAlign(), llvm::MachineMemOperand::MOStore, MRI, llvm::ArrayRef< T >::size(), spillSGPRToSMEM(), and llvm::SIMachineFunctionInfo::SpilledReg::VGPR.

Referenced by eliminateFrameIndex(), and eliminateSGPRToVGPRSpillFrameIndex().

bool llvm::SIRegisterInfo::spillSGPRToSMEM ( ) const
inline

Definition at line 48 of file SIRegisterInfo.h.

Referenced by restoreSGPR(), and spillSGPR().

bool llvm::SIRegisterInfo::spillSGPRToVGPR ( ) const
inline
bool SIRegisterInfo::trackLivenessAfterRegAlloc ( const MachineFunction &  MF) const
override

Definition at line 260 of file SIRegisterInfo.cpp.


The documentation for this class was generated from the following files: