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; }