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

#include <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, FIRST_VGPR_VALUE = 15, WORKITEM_ID_X = FIRST_VGPR_VALUE,
  WORKITEM_ID_Y = 16, WORKITEM_ID_Z = 17
}
 

Public Member Functions

 SIRegisterInfo ()
 
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...
 
BitVector getReservedRegs (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 TargetRegisterClassgetPointerRegClass (const MachineFunction &MF, unsigned Kind=0) const override
 
void spillSGPR (MachineBasicBlock::iterator MI, int FI, RegScavenger *RS) const
 
void restoreSGPR (MachineBasicBlock::iterator MI, int FI, RegScavenger *RS) const
 
void eliminateFrameIndex (MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
 
unsigned getHWRegIndex (unsigned Reg) const
 
const TargetRegisterClassgetPhysRegClass (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 TargetRegisterClassgetEquivalentVGPRClass (const TargetRegisterClass *SRC) const
 
const TargetRegisterClassgetEquivalentSGPRClass (const TargetRegisterClass *VRC) const
 
const TargetRegisterClassgetSubRegClass (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 TargetRegisterClassgetRegClassForReg (const MachineRegisterInfo &MRI, unsigned Reg) const
 
bool isVGPR (const MachineRegisterInfo &MRI, unsigned Reg) const
 
bool isSGPRPressureSet (unsigned SetID) const
 
bool isVGPRPressureSet (unsigned SetID) const
 
unsigned getSGPRAllocGranule () const
 
unsigned getTotalNumSGPRs (const SISubtarget &ST) const
 
unsigned getNumAddressableSGPRs (const SISubtarget &ST) const
 
unsigned getNumReservedSGPRs (const SISubtarget &ST, const SIMachineFunctionInfo &MFI) const
 
unsigned getMinNumSGPRs (const SISubtarget &ST, unsigned WavesPerEU) const
 
unsigned getMaxNumSGPRs (const SISubtarget &ST, unsigned WavesPerEU, bool Addressable) const
 
unsigned getMaxNumSGPRs (const MachineFunction &MF) const
 
unsigned getVGPRAllocGranule () const
 
unsigned getTotalNumVGPRs () const
 
unsigned getNumDebuggerReservedVGPRs (const SISubtarget &ST) const
 
unsigned getMinNumVGPRs (unsigned WavesPerEU) const
 
unsigned getMaxNumVGPRs (unsigned WavesPerEU) const
 
unsigned getMaxNumVGPRs (const MachineFunction &MF) const
 
ArrayRef< int16_t > getRegSplitParts (const TargetRegisterClass *RC, unsigned EltSize) const
 
- Public Member Functions inherited from llvm::AMDGPURegisterInfo
 AMDGPURegisterInfo ()
 
unsigned getSubRegFromChannel (unsigned Channel) const
 
const MCPhysReggetCalleeSavedRegs (const MachineFunction *MF) const override
 
unsigned getFrameRegister (const MachineFunction &MF) const override
 

Detailed Description

Definition at line 28 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 
FIRST_VGPR_VALUE 
WORKITEM_ID_X 
WORKITEM_ID_Y 
WORKITEM_ID_Z 

Definition at line 156 of file SIRegisterInfo.h.

Constructor & Destructor Documentation

SIRegisterInfo::SIRegisterInfo ( )

Definition at line 52 of file SIRegisterInfo.cpp.

References assert(), i, isSGPRPressureSet(), and isVGPRPressureSet().

Member Function Documentation

void SIRegisterInfo::eliminateFrameIndex ( MachineBasicBlock::iterator  MI,
int  SPAdj,
unsigned  FIOperandNum,
RegScavenger RS 
) const
override
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 1149 of file SIRegisterInfo.cpp.

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

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

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

Definition at line 1006 of file SIRegisterInfo.cpp.

References llvm::TargetRegisterClass::getSize(), and llvm_unreachable.

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

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

Definition at line 986 of file SIRegisterInfo.cpp.

References llvm::TargetRegisterClass::getSize(), and llvm_unreachable.

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

int64_t SIRegisterInfo::getFrameIndexInstrOffset ( const MachineInstr MI,
int  Idx 
) const
override
unsigned llvm::SIRegisterInfo::getHWRegIndex ( unsigned  Reg) const
inline

Definition at line 91 of file SIRegisterInfo.h.

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

unsigned SIRegisterInfo::getMaxNumSGPRs ( const SISubtarget ST,
unsigned  WavesPerEU,
bool  Addressable 
) const
Returns
Maximum number of SGPRs that meets given number of waves per execution unit requirement for given subtarget.

Definition at line 1211 of file SIRegisterInfo.cpp.

References llvm::AMDGPUSubtarget::getGeneration(), getNumAddressableSGPRs(), and llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS.

Referenced by getAllSGPR128(), getAllSGPRs(), getMaxNumSGPRs(), getReservedRegs(), reservedPrivateSegmentBufferReg(), and reservedPrivateSegmentWaveByteOffsetReg().

unsigned SIRegisterInfo::getMaxNumSGPRs ( const MachineFunction MF) const
Returns
Maximum number of SGPRs that meets number of waves per execution unit requirement for function MF, or number of SGPRs explicitly requested using "amdgpu-num-sgpr" attribute attached to function MF.
Value that meets number of waves per execution unit requirement if explicitly requested value cannot be converted to integer, violates subtarget's specifications, or does not meet number of waves per execution unit requirement.

Definition at line 1236 of file SIRegisterInfo.cpp.

References F, llvm::SISubtarget::FIXED_SGPR_COUNT_FOR_INIT_BUG, llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::AMDGPU::getIntegerAttribute(), getMaxNumSGPRs(), getMinNumSGPRs(), getNumReservedSGPRs(), llvm::MachineFunction::getSubtarget(), llvm::SIMachineFunctionInfo::getWavesPerEU(), llvm::Function::hasFnAttribute(), llvm::SISubtarget::hasSGPRInitBug(), and fuzzer::min().

unsigned SIRegisterInfo::getMaxNumVGPRs ( unsigned  WavesPerEU) const
Returns
Maximum number of VGPRs that meets given number of waves per execution unit requirement.

Definition at line 1311 of file SIRegisterInfo.cpp.

References getTotalNumVGPRs().

Referenced by getMaxNumVGPRs(), and getReservedRegs().

unsigned SIRegisterInfo::getMaxNumVGPRs ( const MachineFunction MF) const
Returns
Maximum number of VGPRs that meets number of waves per execution unit requirement for function MF, or number of VGPRs explicitly requested using "amdgpu-num-vgpr" attribute attached to function MF.
Value that meets number of waves per execution unit requirement if explicitly requested value cannot be converted to integer, violates subtarget's specifications, or does not meet number of waves per execution unit requirement.

Definition at line 1327 of file SIRegisterInfo.cpp.

References F, llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::AMDGPU::getIntegerAttribute(), getMaxNumVGPRs(), getMinNumVGPRs(), getNumDebuggerReservedVGPRs(), llvm::MachineFunction::getSubtarget(), llvm::SIMachineFunctionInfo::getWavesPerEU(), and llvm::Function::hasFnAttribute().

unsigned SIRegisterInfo::getMinNumSGPRs ( const SISubtarget ST,
unsigned  WavesPerEU 
) const
Returns
Minimum number of SGPRs that meets given number of waves per execution unit requirement for given subtarget.

Definition at line 1187 of file SIRegisterInfo.cpp.

References llvm::AMDGPUSubtarget::getGeneration(), and llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS.

Referenced by getMaxNumSGPRs().

unsigned SIRegisterInfo::getMinNumVGPRs ( unsigned  WavesPerEU) const
Returns
Minimum number of SGPRs that meets given number of waves per execution unit requirement.

Definition at line 1295 of file SIRegisterInfo.cpp.

Referenced by getMaxNumVGPRs().

int64_t SIRegisterInfo::getMUBUFInstrOffset ( const MachineInstr MI) const
unsigned SIRegisterInfo::getNumAddressableSGPRs ( const SISubtarget ST) const
Returns
Number of addressable SGPRs supported by the subtarget.

Definition at line 1165 of file SIRegisterInfo.cpp.

References llvm::AMDGPUSubtarget::getGeneration(), and llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS.

Referenced by getMaxNumSGPRs().

unsigned SIRegisterInfo::getNumDebuggerReservedVGPRs ( const SISubtarget ST) const
Returns
Number of reserved VGPRs for debugger use supported by the subtarget.

Definition at line 1288 of file SIRegisterInfo.cpp.

References llvm::SISubtarget::debuggerReserveRegs().

Referenced by getMaxNumVGPRs().

unsigned SIRegisterInfo::getNumReservedSGPRs ( const SISubtarget ST,
const SIMachineFunctionInfo MFI 
) 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 937 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 317 of file SIRegisterInfo.cpp.

unsigned SIRegisterInfo::getPreloadedValue ( const MachineFunction MF,
enum PreloadedValue  Value 
) const
const TargetRegisterClass * SIRegisterInfo::getRegClassForReg ( const MachineRegisterInfo MRI,
unsigned  Reg 
) const
ArrayRef< int16_t > SIRegisterInfo::getRegSplitParts ( const TargetRegisterClass RC,
unsigned  EltSize 
) const
BitVector SIRegisterInfo::getReservedRegs ( const MachineFunction MF) const
override
unsigned llvm::SIRegisterInfo::getSGPRAllocGranule ( ) const
inline
Returns
SGPR allocation granularity supported by the subtarget.

Definition at line 199 of file SIRegisterInfo.h.

unsigned llvm::SIRegisterInfo::getSGPRPressureSet ( ) const
inline

Definition at line 184 of file SIRegisterInfo.h.

Referenced by llvm::SIScheduleDAGMI::SIScheduleDAGMI().

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 1024 of file SIRegisterInfo.cpp.

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

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

unsigned SIRegisterInfo::getTotalNumSGPRs ( const SISubtarget ST) const
Returns
Total number of SGPRs supported by the subtarget.

Definition at line 1159 of file SIRegisterInfo.cpp.

References llvm::AMDGPUSubtarget::getGeneration(), and llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS.

unsigned llvm::SIRegisterInfo::getTotalNumVGPRs ( ) const
inline
Returns
Total number of VGPRs supported by the subtarget.

Definition at line 238 of file SIRegisterInfo.h.

Referenced by getMaxNumVGPRs().

unsigned llvm::SIRegisterInfo::getVGPRAllocGranule ( ) const
inline
Returns
VGPR allocation granularity supported by the subtarget.

Definition at line 233 of file SIRegisterInfo.h.

unsigned llvm::SIRegisterInfo::getVGPRPressureSet ( ) const
inline

Definition at line 185 of file SIRegisterInfo.h.

Referenced by llvm::SIScheduleDAGMI::SIScheduleDAGMI().

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

Definition at line 306 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 105 of file SIRegisterInfo.h.

References getRegClass(), and isSGPRClass().

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

Definition at line 191 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

Definition at line 1475 of file SIRegisterInfo.cpp.

References getRegClassForReg(), and hasVGPRs().

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

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

Definition at line 194 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 151 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 142 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 195 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 98 of file SIRegisterInfo.cpp.

References llvm::alignDown(), and getMaxNumSGPRs().

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

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 105 of file SIRegisterInfo.cpp.

References getMaxNumSGPRs().

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

void SIRegisterInfo::resolveFrameIndex ( MachineInstr MI,
unsigned  BaseReg,
int64_t  Offset 
) const
override
void SIRegisterInfo::restoreSGPR ( MachineBasicBlock::iterator  MI,
int  FI,
RegScavenger RS 
) const
bool SIRegisterInfo::shouldRewriteCopySrc ( const TargetRegisterClass DefRC,
unsigned  DefSubReg,
const TargetRegisterClass SrcRC,
unsigned  SrcSubReg 
) const
override

Definition at line 1065 of file SIRegisterInfo.cpp.

void SIRegisterInfo::spillSGPR ( MachineBasicBlock::iterator  MI,
int  FI,
RegScavenger RS 
) const
bool SIRegisterInfo::trackLivenessAfterRegAlloc ( const MachineFunction MF) const
override

Definition at line 201 of file SIRegisterInfo.cpp.


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