unsigned SIRegisterInfo::getNumReservedSGPRs(const SISubtarget &ST, const SIMachineFunctionInfo &MFI) const { if (MFI.hasFlatScratchInit()) { if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) return 6; // FLAT_SCRATCH, XNACK, VCC (in that order) if (ST.getGeneration() == AMDGPUSubtarget::SEA_ISLANDS) return 4; // FLAT_SCRATCH, VCC (in that order) } if (ST.isXNACKEnabled()) return 4; // XNACK, VCC (in that order) return 2; // VCC. }
static unsigned getNumExtraSGPRs(const SISubtarget &ST, bool VCCUsed, bool FlatScrUsed) { unsigned ExtraSGPRs = 0; if (VCCUsed) ExtraSGPRs = 2; if (ST.getGeneration() < SISubtarget::VOLCANIC_ISLANDS) { if (FlatScrUsed) ExtraSGPRs = 4; } else { if (ST.isXNACKEnabled()) ExtraSGPRs = 4; if (FlatScrUsed) ExtraSGPRs = 6; } return ExtraSGPRs; }
unsigned SIRegisterInfo::getNumSGPRsAllowed(const SISubtarget &ST, unsigned WaveCount) const { if (ST.getGeneration() >= SISubtarget::VOLCANIC_ISLANDS) { switch (WaveCount) { case 10: return 80; case 9: return 80; case 8: return 96; default: return 102; } } else { switch(WaveCount) { case 10: return 48; case 9: return 56; case 8: return 64; case 7: return 72; case 6: return 80; case 5: return 96; default: return 103; } } }
unsigned SIRegisterInfo::getMinNumSGPRs(const SISubtarget &ST, unsigned WavesPerEU) const { if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) { switch (WavesPerEU) { case 0: return 0; case 10: return 0; case 9: return 0; case 8: return 81; default: return 97; } } else { switch (WavesPerEU) { case 0: return 0; case 10: return 0; case 9: return 49; case 8: return 57; case 7: return 65; case 6: return 73; case 5: return 81; default: return 97; } } }
unsigned SIRegisterInfo::getMaxNumSGPRs(const SISubtarget &ST, unsigned WavesPerEU) const { if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) { switch (WavesPerEU) { case 0: return 80; case 10: return 80; case 9: return 80; case 8: return 96; default: return getNumAddressableSGPRs(ST); } } else { switch (WavesPerEU) { case 0: return 48; case 10: return 48; case 9: return 56; case 8: return 64; case 7: return 72; case 6: return 80; case 5: return 96; default: return getNumAddressableSGPRs(ST); } } }
unsigned SIRegisterInfo::getNumReservedSGPRs(const SISubtarget &ST) const { if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) return 6; // VCC, FLAT_SCRATCH, XNACK. return 2; // VCC. }
unsigned SIRegisterInfo::getNumAddressableSGPRs(const SISubtarget &ST) const { if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) return 102; return 104; }
unsigned SIRegisterInfo::getTotalNumSGPRs(const SISubtarget &ST) const { if (ST.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) return 800; return 512; }